MeVisLab Toolbox Reference
mlStringLineMultiField.h
Go to the documentation of this file.
1 /*************************************************************************************
2 **
3 ** Copyright 2010, MeVis Medical Solutions AG
4 **
5 ** The user may use this file in accordance with the license agreement provided with
6 ** the Software or, alternatively, in accordance with the terms contained in a
7 ** written agreement between the user and MeVis Medical Solutions AG.
8 **
9 ** For further information use the contact form at https://www.mevislab.de/contact
10 **
11 **************************************************************************************/
12 
13 #ifndef ML_STRING_LINE_MULTI_FIELD_H
14 #define ML_STRING_LINE_MULTI_FIELD_H
15 
16 
19 
20 #include "MLToolsSystem.h"
21 
22 #include <mlMultiFields.h>
23 
24 ML_START_NAMESPACE
25 
26  //-------------------------------------------------------------------------
31  //-------------------------------------------------------------------------
32  class MLTOOLS_EXPORT StringLineMultiField : public MultiField<std::string>
33  {
34  public:
39  static const std::string DefaultLineSeparator;
40 
42  StringLineMultiField(const std::string &name="");
43 
47  void setStringValue(const std::string &value) override;
48 
58  void setStringValue(const std::string &value, const std::string &sep);
59 
61  void removeSubString(const std::string &str);
62 
65  void removeElements(const std::string &str=std::string());
66 
68  std::string getStringValue() const override;
69 
77  std::string getStringValue(const std::string &sep) const;
78 
82  };
83 
87  MLTOOLS_EXPORT std::ostream& operator<<(std::ostream& s, const StringLineMultiField& stringLineMulti);
88 
92  MLTOOLS_EXPORT std::istream& operator>>(std::istream& s, StringLineMultiField& stringLineMulti);
93 
94 ML_END_NAMESPACE
95 
96 #endif //__mlStringLineMultiField_H
#define MLTOOLS_EXPORT
Resolves system dependencies for this project.
Definition: MLToolsSystem.h:26
Field to represent a dynamic vector of DATATYPE values.
Definition: mlMultiFields.h:62
The field class StringLineMultiField which manages a vector of std::string lines typically separated ...
static const std::string DefaultLineSeparator
The default line separator used for line endings when converting the internal string vector to a stri...
void setStringValue(const std::string &value) override
Same as setStringValue(const std::string &value, char sep) using the "\n" as value for sep; occurrenc...
StringLineMultiField(const std::string &name="")
Constructor. See constructor of MultiField for documentation.
std::string getStringValue(const std::string &sep) const
Returns a string containing the concatenation of all values from the internal vector separated by the...
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 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 override
Same as getStringValue(StringLineMultiField::DefaultLineSeparator).
void removeSubString(const std::string &str)
Removes the character sequence str from each string element of the internal vector.
ML_CLASS_HEADER(StringLineMultiField)
Macro to implement the interface for the Runtime Type System and for the initialization of this class...
std::istream & operator>>(std::istream &in, ml::Variant &variant)
Definition: mlVariant.h:215
MLTOOLS_EXPORT std::ostream & operator<<(std::ostream &s, const StringLineMultiField &stringLineMulti)
All strings of the internal vector are streamed into the output stream and StringLineMultiField::Defa...