Class for the string attributes of a Record. Represents an attribute of the type 'std::string' of a persistent object.
More...
#include <GloStringRecordAttribute.h>
|
| StringRecordAttribute (ClassInfoAttribute *pType, const std::streampos &rFilePos) |
|
| StringRecordAttribute (ClassInfoAttribute *pType, const std::string &rsValue, const std::streampos &rFilePos) |
|
virtual bool | dataIsFieldContent () const |
|
virtual int | getAcceptedStringLength () const |
|
virtual int | getAttributeValueBlob (eut::Blob &rBlob) const |
|
virtual BaseRecordAttribute * | getCopy () |
|
virtual unsigned short | getDataFieldLength () const |
|
virtual std::string | getDataReference () const |
|
const std::string & | getFileName () const |
|
virtual int | getFormattedFieldContents (std::string &rsRetVal, DATA_REFERENCE_INFO &rRetValInfo, ObjID ObjID) |
|
virtual std::string | getValueAsDataString () const |
|
virtual std::string | getValueAsDisplayString () const |
|
virtual std::string | getValueAsStreamString () const |
|
virtual std::string | getValueAsString () const |
|
std::string | getValueAsString (const std::string &rsValue, bool bFillBlanks) const |
|
virtual void * | getValueAsVoidPointer () |
|
const std::string & | getValueRef () const |
|
virtual void | initNew () |
|
virtual void | setDataReference (const std::string &rsDataReference) |
|
void | setDeterminedFileNameFromAttributeValue (ObjID ObjID) |
|
void | setFileName (const std::string &rsFileName) |
|
void | setValue (const std::string &rsValue) |
|
virtual void | setValueFromVoid (void *pValue) |
|
virtual int | takeValue (const BaseRecordAttribute &rT) |
|
virtual int | updateDataReference (const std::string &rsDataPath, DATA_REFERENCE_INFO MethodInfo) |
|
|
bool | operator== (const StringRecordAttribute &rT) const |
| Comparison operator.
|
|
bool | operator!= (const StringRecordAttribute &rT) const |
| Comparison operator.
|
|
| BaseRecordAttribute (ClassInfoAttribute *pClassInfoAttribut, const std::streampos &rFilePos) |
|
virtual | ~BaseRecordAttribute () |
|
unsigned int | forget () |
|
AttributeID | getAttributeID () const |
|
ClassInfoAttribute * | getClassInfoAttribute () 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.
|
|
Class for the string attributes of a Record. Represents an attribute of the type 'std::string' of a persistent object.
- Copyright
- © 2010 Helmut Jakoby
- Author
- Helmut Jakoby
◆ StringRecordAttribute() [1/4]
glo::StringRecordAttribute::StringRecordAttribute |
( |
| ) |
|
|
protected |
The standard constructor is not available.
◆ ~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] | pType | A class information attribute is expected. |
[in] | rFilePos | The file position. |
- Exceptions
-
- 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] | pType | A class information attribute is expected. |
[in] | rsValue | The value of the attribute. |
[in] | rFilePos | The file position. |
- Exceptions
-
- 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]
Copy constructor.
- Parameters
-
[in] | rT | The data is copied from this object. |
- See also
- getCopy()
◆ dataIsFieldContent()
virtual bool glo::StringRecordAttribute::dataIsFieldContent |
( |
| ) |
const |
|
virtual |
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 |
|
virtual |
◆ getCopy()
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.
◆ getDataFieldLength()
virtual unsigned short glo::StringRecordAttribute::getDataFieldLength |
( |
| ) |
const |
|
virtual |
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 |
|
virtual |
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 ) |
|
virtual |
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] | rsRetVal | The table field as it should be written. |
[in,out] | rRetValInfo | The information how to handle an external file. |
[in] | ObjID | If 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 |
|
virtual |
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 |
|
virtual |
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 |
|
virtual |
◆ getValueAsString() [1/2]
virtual std::string glo::StringRecordAttribute::getValueAsString |
( |
| ) |
const |
|
virtual |
◆ 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] | rsValue | The string to be transformed. |
[in] | bFillBlanks | If true, missing characters are filled up with blanks. |
- Returns
- The resulting string.
◆ getValueAsVoidPointer()
virtual void * glo::StringRecordAttribute::getValueAsVoidPointer |
( |
| ) |
|
|
virtual |
◆ getValueRef()
const std::string & glo::StringRecordAttribute::getValueRef |
( |
| ) |
const |
Returns the reference to the value.
- Returns
- The value.
◆ initNew()
virtual void glo::StringRecordAttribute::initNew |
( |
| ) |
|
|
virtual |
◆ operator!=()
Comparison operator.
- Parameters
-
[in] | rT | The object to be compared with this one. |
◆ operator=()
The assignment operator is not available.
◆ operator==()
Comparison operator.
- Parameters
-
[in] | rT | The object to be compared with this one. |
◆ setDataReference()
virtual void glo::StringRecordAttribute::setDataReference |
( |
const std::string & | rsDataReference | ) |
|
|
virtual |
Sets the name of the file in which a possibly too long string should be stored.
- Parameters
-
[in] | rsDataReference | The 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] | ObjID | If 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] | rsFileName | The 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] | rsValue | The new value. |
◆ setValueFromVoid()
virtual void glo::StringRecordAttribute::setValueFromVoid |
( |
void * | pValue | ) |
|
|
virtual |
Sets the value of the attribute. Is assigned via a static_cast.
- Parameters
-
[in] | pValue | The raw pointer to the value. |
Implements glo::BaseRecordAttribute.
◆ takeValue()
Adopts the value from transferred attribute, if possible. An attempt is made to cast the value in some way.
- Parameters
-
[in] | rT | The 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.
◆ updateDataReference()
virtual int glo::StringRecordAttribute::updateDataReference |
( |
const std::string & | rsDataPath, |
|
|
DATA_REFERENCE_INFO | MethodInfo ) |
|
virtual |
Deletes or writes an external file with the string data.
- Parameters
-
[in] | rsDataPath | The 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] | MethodInfo | The information how to handle an external file. |
- Returns
- A return value < 0 indicates an error.
Reimplemented from glo::BaseRecordAttribute.
◆ 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: