GlobalObjects
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
glo::StringRecordAttribute Class Reference

Class for the string attributes of a Record. Represents an attribute of the type 'std::string' of a persistent object. More...

#include <GloStringRecordAttribute.h>

Inheritance diagram for glo::StringRecordAttribute:

Public Member Functions

 StringRecordAttribute (ClassInfoAttribute *pType, const std::streampos &rFilePos)
 
 StringRecordAttribute (ClassInfoAttribute *pType, const std::string &rsValue, const std::streampos &rFilePos)
 
virtual bool dataIsFieldContent () const override
 
virtual int getAcceptedStringLength () const
 
virtual int getAttributeValueBlob (eut::Blob &rBlob) const override
 
virtual BaseRecordAttributegetCopy () override
 
virtual unsigned short getDataFieldLength () const override
 
virtual std::string getDataReference () const override
 
const std::string & getFileName () const
 
virtual int getFormattedFieldContents (std::string &rsRetVal, DATA_REFERENCE_INFO &rRetValInfo, ObjID ObjID) override
 
virtual std::string getValueAsDataString () const override
 
virtual std::string getValueAsDisplayString () const override
 
virtual std::string getValueAsStreamString () const override
 
virtual std::string getValueAsString () const override
 
std::string getValueAsString (const std::string &rsValue, bool bFillBlanks) const
 
virtual void * getValueAsVoidPointer () override
 
const std::string & getValueRef () const
 
virtual void initNew () override
 
virtual void setDataReference (const std::string &rsDataReference) override
 
void setDeterminedFileNameFromAttributeValue (ObjID ObjID)
 
void setFileName (const std::string &rsFileName)
 
void setValue (const std::string &rsValue)
 
virtual void setValueFromVoid (void *pValue) override
 
virtual int takeValue (const BaseRecordAttribute &rT) override
 
virtual int updateDataReference (const std::string &rsDataPath, DATA_REFERENCE_INFO MethodInfo) override
 
bool operator== (const StringRecordAttribute &rT) const
 Comparison operator.
 
bool operator!= (const StringRecordAttribute &rT) const
 Comparison operator.
 
- Public Member Functions inherited from glo::BaseRecordAttribute
 BaseRecordAttribute (ClassInfoAttribute *pClassInfoAttribut, const std::streampos &rFilePos)
 
virtual ~BaseRecordAttribute ()
 
unsigned int forget ()
 
AttributeID getAttributeID () const
 
unsigned long getClassID () const
 
ClassInfoAttributegetClassInfoAttribute () const
 
std::string getClassMemberName () const
 
std::string getClassName () const
 
EnDataType getDataType () const
 
std::string getFieldName () const
 
int getFieldPos ()
 
std::streampos getFilePosition () const
 
EnDataTypeGroup getInfoType ()
 
unsigned int getReferenceCount () const
 
std::string getTableFieldName () const
 
std::string getTableName () const
 
ClassInfoAttribute::Type getType () const
 
std::string getTypeAsCppString () const
 
std::string getTypeAsString () const
 
std::string getTypeInfo () const
 
unsigned int remember ()
 
void setFilePosition (const std::streampos &rFilePos)
 
virtual int setValueFromObjectAttributeID (Persistent &rObject, const AttributeID &rAttributeID)
 
bool operator== (const BaseRecordAttribute &rT) const
 Comparison operator, all attributes are compared.
 
bool operator!= (const BaseRecordAttribute &rT) const
 Comparison operator, all attributes are compared.
 

Protected Member Functions

 StringRecordAttribute ()
 
 StringRecordAttribute (const StringRecordAttribute &rT)
 
virtual ~StringRecordAttribute ()
 
- Protected Member Functions inherited from glo::BaseRecordAttribute
 BaseRecordAttribute ()
 
 BaseRecordAttribute (const BaseRecordAttribute &rT)
 

Private Member Functions

StringRecordAttributeoperator= (const StringRecordAttribute &)
 

Private Attributes

std::string m_sAlternativeFileName
 
std::string m_strValue
 

Detailed Description

Class for the string attributes of a Record. Represents an attribute of the type 'std::string' of a persistent object.

Author
Helmut Jakoby

Constructor & Destructor Documentation

◆ StringRecordAttribute() [1/4]

glo::StringRecordAttribute::StringRecordAttribute ( )
protected

The standard constructor is not available.

Referenced by StringRecordAttribute(), operator!=(), operator=(), and operator==().

◆ ~StringRecordAttribute()

virtual glo::StringRecordAttribute::~StringRecordAttribute ( )
protectedvirtual

The destructor is not available. The object may only be removed from memory using forget().

◆ StringRecordAttribute() [2/4]

glo::StringRecordAttribute::StringRecordAttribute ( ClassInfoAttribute * pType,
const std::streampos & rFilePos )

Constructor with parameter passing.

Parameters
[in]pTypeA class information attribute is expected.
[in]rFilePosThe file position.
Exceptions
eut::ErrorNExceptionAn exception will be thrown if an error occurs.
Attention
Since objects of these classes are only instantiated by internal objects like Record and TableReaderInterface, and they know what they are doing, a type check of the class information attribute is omitted!

◆ StringRecordAttribute() [3/4]

glo::StringRecordAttribute::StringRecordAttribute ( ClassInfoAttribute * pType,
const std::string & rsValue,
const std::streampos & rFilePos )

Constructor with parameter passing.

Parameters
[in]pTypeA class information attribute is expected.
[in]rsValueThe value of the attribute.
[in]rFilePosThe file position.
Exceptions
eut::ErrorNExceptionAn exception will be thrown if an error occurs.
Attention
Since objects of these classes are only instantiated by internal objects like Record and TableReaderInterface, and they know what they are doing, a type check of the class information attribute is omitted!

◆ StringRecordAttribute() [4/4]

glo::StringRecordAttribute::StringRecordAttribute ( const StringRecordAttribute & rT)
protected

Copy constructor.

Parameters
[in]rTThe data is copied from this object.
See also
getCopy()

References StringRecordAttribute().

Member Function Documentation

◆ dataIsFieldContent()

virtual bool glo::StringRecordAttribute::dataIsFieldContent ( ) const
overridevirtual

Returns false, because attribute data is stored both as field content and, if too long, outside the table. If the data is stored outside the table, the reference to it is in the table field.

Returns
see above

Implements glo::BaseRecordAttribute.

◆ getAcceptedStringLength()

virtual int glo::StringRecordAttribute::getAcceptedStringLength ( ) const
virtual

Returns the accepted string length.

Returns
If return == 0, then length may be what the system accepts as maximum length.

◆ getAttributeValueBlob()

virtual int glo::StringRecordAttribute::getAttributeValueBlob ( eut::Blob & rBlob) const
overridevirtual

Returns only one mistake here! The DataStreamer retrieves the data via the file name.

Returns
Always returns ERR_METHOD_FORBIDDEN.

Reimplemented from glo::BaseRecordAttribute.

◆ getCopy()

virtual BaseRecordAttribute * glo::StringRecordAttribute::getCopy ( )
overridevirtual

Returns a copy of the object. Sometimes a copy of an attribute is needed, e.g. if a deep-copied record (with copied attributes) is needed.

Returns
The copy of this attribute
Attention
The supplied object must be removed from memory by the calling instance.

Implements glo::BaseRecordAttribute.

References glo::BaseRecordAttribute::BaseRecordAttribute().

◆ getDataFieldLength()

virtual unsigned short glo::StringRecordAttribute::getDataFieldLength ( ) const
overridevirtual

Returns the field length of the attribute value converted to a formatted data string.

Returns
The current field length.

Implements glo::BaseRecordAttribute.

◆ getDataReference()

virtual std::string glo::StringRecordAttribute::getDataReference ( ) const
overridevirtual

Returns the file name in which the data of the passed RecordAttribute are stored.

Returns
If necessary, the existing file name. If empty, then there is probably none.

Reimplemented from glo::BaseRecordAttribute.

◆ getFileName()

const std::string & glo::StringRecordAttribute::getFileName ( ) const

Returns the name of the file in which a possibly too long string should be stored.

Returns
The file name.
Note
The file name is delivered without path and without file extension.

◆ getFormattedFieldContents()

virtual int glo::StringRecordAttribute::getFormattedFieldContents ( std::string & rsRetVal,
DATA_REFERENCE_INFO & rRetValInfo,
ObjID ObjID )
overridevirtual

Delivers its string content as a formatted table field and information whether an external file for the data set attribute should be rewritten, kept or deleted.
If the value of the string needs to be stored in a file, this file name is returned. The name of the external file is then also set in the m_sAlternativeFileName attribute.

Parameters
[in,out]rsRetValThe table field as it should be written.
[in,out]rRetValInfoThe information how to handle an external file.
[in]ObjIDIf a file name has to be created, the file name is formed from this object ID. Usually this is the object ID of the object whose attribute value is requested.
Returns
A return value < 0 indicates an error.

Reimplemented from glo::BaseRecordAttribute.

◆ getValueAsDataString()

virtual std::string glo::StringRecordAttribute::getValueAsDataString ( ) const
overridevirtual

Returns the value as a formatted data string in the correct length (filled with blanks at the front, if necessary, or truncated at the back if too long).

Returns
The value as formatted data string.

Implements glo::BaseRecordAttribute.

◆ getValueAsDisplayString()

virtual std::string glo::StringRecordAttribute::getValueAsDisplayString ( ) const
overridevirtual

Returns the value as it can be displayed for the GUI. If it is longer than STRING_MAX_TEXT_LENGTH, it is truncated and terminated with "...".

Returns
The value for the display.

Implements glo::BaseRecordAttribute.

◆ getValueAsStreamString()

virtual std::string glo::StringRecordAttribute::getValueAsStreamString ( ) const
overridevirtual

Returns the value as string for the DataStreamer.

Returns
The value for the DataStreamer.

Implements glo::BaseRecordAttribute.

◆ getValueAsString() [1/2]

virtual std::string glo::StringRecordAttribute::getValueAsString ( ) const
overridevirtual

Returns the value as string.

Returns
The value as string.

Implements glo::BaseRecordAttribute.

◆ getValueAsString() [2/2]

std::string glo::StringRecordAttribute::getValueAsString ( const std::string & rsValue,
bool bFillBlanks ) const

Transforms a string according to the length specified in its class information attribute.

Parameters
[in]rsValueThe string to be transformed.
[in]bFillBlanksIf true, missing characters are filled up with blanks.
Returns
The resulting string.

◆ getValueAsVoidPointer()

virtual void * glo::StringRecordAttribute::getValueAsVoidPointer ( )
overridevirtual

Returns a raw pointer to the value.

Returns
The raw pointer to the value.

Implements glo::BaseRecordAttribute.

◆ getValueRef()

const std::string & glo::StringRecordAttribute::getValueRef ( ) const

Returns the reference to the value.

Returns
The value.

◆ initNew()

virtual void glo::StringRecordAttribute::initNew ( )
overridevirtual

Reinitializes the attribute, the value is set to "".

Implements glo::BaseRecordAttribute.

◆ operator!=()

bool glo::StringRecordAttribute::operator!= ( const StringRecordAttribute & rT) const

Comparison operator.

Parameters
[in]rTThe object to be compared with this one.

References StringRecordAttribute().

◆ operator=()

StringRecordAttribute & glo::StringRecordAttribute::operator= ( const StringRecordAttribute & )
private

The assignment operator is not available.

References StringRecordAttribute().

◆ operator==()

bool glo::StringRecordAttribute::operator== ( const StringRecordAttribute & rT) const

Comparison operator.

Parameters
[in]rTThe object to be compared with this one.

References StringRecordAttribute().

◆ setDataReference()

virtual void glo::StringRecordAttribute::setDataReference ( const std::string & rsDataReference)
overridevirtual

Sets the name of the file in which a possibly too long string should be stored.

Parameters
[in]rsDataReferenceThe file name.
Note
The file name is passed without path and without file extension.

Reimplemented from glo::BaseRecordAttribute.

◆ setDeterminedFileNameFromAttributeValue()

void glo::StringRecordAttribute::setDeterminedFileNameFromAttributeValue ( ObjID ObjID)

Sets the identified designation of the file in which the string is to be accommodated if there is something to save.

Parameters
[in]ObjIDIf a file name has to be created, the file name is formed from this object ID. Usually this is the object ID of the object whose attribute value is requested.

◆ setFileName()

void glo::StringRecordAttribute::setFileName ( const std::string & rsFileName)

Sets the name of the file in which a possibly too long string should be stored.

Parameters
[in]rsFileNameThe file name.
Note
The file name is passed without path and without file extension.

◆ setValue()

void glo::StringRecordAttribute::setValue ( const std::string & rsValue)

Sets the value of the attribute.

Parameters
[in]rsValueThe new value.

◆ setValueFromVoid()

virtual void glo::StringRecordAttribute::setValueFromVoid ( void * pValue)
overridevirtual

Sets the value of the attribute. Is assigned via a static_cast.

Parameters
[in]pValueThe raw pointer to the value.

Implements glo::BaseRecordAttribute.

◆ takeValue()

virtual int glo::StringRecordAttribute::takeValue ( const BaseRecordAttribute & rT)
overridevirtual

Adopts the value from transferred attribute, if possible. An attempt is made to cast the value in some way.

Parameters
[in]rTThe persistent attribute from which the values are to be taken.
Returns
An error or warning message from subclasses will be delivered if the cast does not work.

Reimplemented from glo::BaseRecordAttribute.

References glo::BaseRecordAttribute::BaseRecordAttribute().

◆ updateDataReference()

virtual int glo::StringRecordAttribute::updateDataReference ( const std::string & rsDataPath,
DATA_REFERENCE_INFO MethodInfo )
overridevirtual

Deletes or writes an external file with the string data.

Parameters
[in]rsDataPathThe full directory name where the data can be found. The data is always located in a subdirectory of the directory where the schema file is located (e.g. "C:/Path/Data/").
[in]MethodInfoThe information how to handle an external file.
Returns
A return value < 0 indicates an error.

Reimplemented from glo::BaseRecordAttribute.

Member Data Documentation

◆ m_sAlternativeFileName

std::string glo::StringRecordAttribute::m_sAlternativeFileName
private

If the string is too long, it will be placed in a file with this name.

◆ m_strValue

std::string glo::StringRecordAttribute::m_strValue
private

The value of the attribute.


The documentation for this class was generated from the following file: