MeVisLabToolboxReference
ml::StringLineMultiField Class Reference

The field class StringLineMultiField which manages a vector of std::string lines typically separated by "\r\n" on windows systems and by "\n" on non windows systems. More...

#include <mlStringLineMultiField.h>

Inheritance diagram for ml::StringLineMultiField:
ml::MultiField< std::string > ml::Field

List of all members.

Public Member Functions

 StringLineMultiField (const std::string &name="")
 Constructor. See constructor of MultiField for documentation.
void setStringValue (const std::string &value)
 Same as setStringValue(const std::string &value, char sep) using the "\n" as value for sep; additional carriage return '' characters will silently be removed from the strings.
void setStringValue (const std::string &value, const std::string &sep)
 Subdivides value at all positions of sep and stores all values in the internal vector.
void removeSubString (const std::string &str)
 Removes the character sequence str from each string element of the internal vector.
void removeElements (const std::string &str=std::string())
 Removes all entries equal to str; default is an empty string to remove all empty entries.
std::string getStringValue () const
 Same as getStringValue(StringLineMultiField::DefaultLineSeparator).
std::string getStringValue (const std::string &sep) const
 Returns a string containing the concatenation of all values from the internal vector separated by the StringLineMultiField::DefaultLineSeparator.
 ML_CLASS_HEADER (StringLineMultiField)
 Macro to implement the interface for the Runtime Type System and for the initialization of this class.

Static Public Attributes

static const std::string DefaultLineSeparator
 The default line separator used for line endings when converting the internal string vector to a string with the default getString() or operator>>.

Detailed Description

The field class StringLineMultiField which manages a vector of std::string lines typically separated by "\r\n" on windows systems and by "\n" on non windows systems.

See MultiField for documentation of inherited functionality.

Definition at line 30 of file mlStringLineMultiField.h.


Constructor & Destructor Documentation

ml::StringLineMultiField::StringLineMultiField ( const std::string &  name = "")

Constructor. See constructor of MultiField for documentation.


Member Function Documentation

std::string ml::StringLineMultiField::getStringValue ( ) const [virtual]

Same as getStringValue(StringLineMultiField::DefaultLineSeparator).

Reimplemented from ml::MultiField< std::string >.

std::string ml::StringLineMultiField::getStringValue ( const std::string &  sep) const

Returns a string containing the concatenation of all values from the internal vector separated by the StringLineMultiField::DefaultLineSeparator.

After the last element sep is not appended. Note that using other values than StringLineMultiField::DefaultLineSeparator for sep will cause asymmetric conversion from/to setString(value) and getString() methods. So take care and make use of removeChar('
') and removeChar('') if necessary.

ml::StringLineMultiField::ML_CLASS_HEADER ( StringLineMultiField  )

Macro to implement the interface for the Runtime Type System and for the initialization of this class.

See mlRuntimeSubClass.h for more information.

void ml::StringLineMultiField::removeElements ( const std::string &  str = std::string())

Removes all entries equal to str; default is an empty string to remove all empty entries.

void ml::StringLineMultiField::removeSubString ( const std::string &  str)

Removes the character sequence str from each string element of the internal vector.

void ml::StringLineMultiField::setStringValue ( const std::string &  value) [virtual]

Same as setStringValue(const std::string &value, char sep) using the "\n" as value for sep; additional carriage return '' characters will silently be removed from the strings.

Reimplemented from ml::MultiField< std::string >.

void ml::StringLineMultiField::setStringValue ( const std::string &  value,
const std::string &  sep 
)

Subdivides value at all positions of sep and stores all values in the internal vector.

Note that '
' characters in value if sep differs from DefaultLineSeparator will not be not used as separator. This will cause asymmetric behaviour from/to the default setString(value) and getString() methods when those are used for field persistence. So take care when using non line feed characters and make use of removeSubString("\n") and/or removeSubString("\r") if necessary.

Parameters:
valueThe string to be subdivided.
sepThe character sequence used to separate string segments.

Member Data Documentation

The default line separator used for line endings when converting the internal string vector to a string with the default getString() or operator>>.

"\r\n" on windows and "\n" on non windows systems.

Definition at line 37 of file mlStringLineMultiField.h.


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