C12Adapter Opensource C++ Interface
|
Set of various, mostly string related algorithms. More...
Static Public Member Functions | |
static int | Find (const MVariant &sequence, const MVariant &subSequence) |
Find first occurrence of string in another string. More... | |
static int | FindReverse (const MVariant &sequence, const MVariant &subSequence) |
Find last occurrence of string in another string. More... | |
static MVariant | Replace (const MVariant &source, const MVariant &from, const MVariant &to) |
Replaces all occurrences of 'from' in the source sequence with 'to'. More... | |
static void | InplaceSort (MStdStringVector &collection, bool uniqueOnly=false, bool naturalSort=false) |
Sort the string vector given, possibly remove duplicates. More... | |
static MVariant | Sort (const MVariant &sequence, bool uniqueOnly=false) |
Return the given sequence sorted, possibly remove duplicates. More... | |
static void | InplaceTrimLeft (MStdString &str, MConstChars trimCharacters=NULL) |
Trim the leading characters from the string given, modify this string. More... | |
static void | InplaceTrimRight (MStdString &str, MConstChars trimCharacters=NULL) |
Trim the trailing characters from the string given, modify this string. More... | |
static void | InplaceTrim (MStdString &str, MConstChars trimCharacters=NULL) |
Trim the leading and trailing characters from the string given, modify this string. More... | |
static MVariant | TrimLeft (const MVariant &str, const MVariant &trimCharacters) |
Trim the leading characters or bytes from the string given, return the result. More... | |
static MVariant | TrimRight (const MVariant &str, const MVariant &trimCharacters) |
Trim the trailing characters or bytes from the string given, return the result. More... | |
static MVariant | Trim (const MVariant &str, const MVariant &trimCharacters) |
Trim the leading and trailing characters or bytes from the string given, return the result. More... | |
static MStdString | TrimString (const MStdString &str, MConstChars trimCharacters=NULL) |
Specialized faster version of Trim that works on string type rather than on MVariant. More... | |
static MVariant | Split (const MVariant &str, const MVariant &delimiter, bool trimBlanks=false, bool allowEmpty=false) |
Split the string separated by delimiter into a collection of strings. More... | |
static MVariant | Join (const MVariant &source, const MVariant &delimiter) |
Join the given array of items into a string or byte string using the given delimiter. More... | |
static void | AddUnique (MStdStringVector &source, const MStdString &value) |
Add string value to string collection if it is not there yet. More... | |
static MStdStringVector | SplitWithDelimiter (const MStdString &str, char delimiter, bool trimBlanks=false, bool allowEmpty=false) |
static MStdStringVector | SplitWithDelimiter (const MStdString &str, const MStdString &delimiter, bool trimBlanks=false, bool allowEmpty=false) |
![]() | |
static const MClass * | GetStaticClass () |
Get the declared class of this particular object. More... | |
static bool | IsClassPresent (const MStdString &name) |
Tells if the given class name is available. More... | |
Additional Inherited Members | |
![]() | |
virtual | ~MObject () |
Object destructor. | |
virtual const MClass * | GetClass () const =0 |
Get the final class of the object. More... | |
virtual unsigned | GetEmbeddedSizeof () const |
For embedded object types, return the size of the class. More... | |
bool | IsEmbeddedObject () const |
Tell if the object is of embedded kind. More... | |
SHOW_INTERNAL MVariant | Call (const MStdString &name, const MVariant ¶ms) |
Call the object service with parameters, given as variant. More... | |
MVariant | Call0 (const MStdString &name) |
Call the object service with no parameters. More... | |
MVariant | Call1 (const MStdString &name, const MVariant &p1) |
Call the object service with one parameter. More... | |
MVariant | Call2 (const MStdString &name, const MVariant &p1, const MVariant &p2) |
Call the object service with two parameter. More... | |
MVariant | Call3 (const MStdString &name, const MVariant &p1, const MVariant &p2, const MVariant &p3) |
Call the object service with three parameter. More... | |
MVariant | Call4 (const MStdString &name, const MVariant &p1, const MVariant &p2, const MVariant &p3, const MVariant &p4) |
Call the object service with four parameter. More... | |
MVariant | Call5 (const MStdString &name, const MVariant &p1, const MVariant &p2, const MVariant &p3, const MVariant &p4, const MVariant &p5) |
Call the object service with five parameter. More... | |
MVariant | Call6 (const MStdString &name, const MVariant &p1, const MVariant &p2, const MVariant &p3, const MVariant &p4, const MVariant &p5, const MVariant &p6) |
Call the object service with six parameter. More... | |
virtual MVariant | CallV (const MStdString &name, const MVariant::VariantVector ¶ms) |
Call the object service with parameters, given as variant vector. More... | |
virtual bool | IsPropertyPresent (const MStdString &name) const |
Tell if the property with the given name exists. | |
virtual bool | IsServicePresent (const MStdString &name) const |
Tell if the service with the given name exists. | |
virtual MVariant | GetProperty (const MStdString &name) const |
Get the property value using name of the property. More... | |
virtual void | SetProperty (const MStdString &name, const MVariant &value) |
Set the property using name of the property, and value. More... | |
virtual MStdStringVector | GetAllPropertyNames () const |
Return the list of publicly available properties, persistent or not. More... | |
virtual MStdStringVector | GetAllPersistentPropertyNames () const |
Return the list of persistent properties. More... | |
virtual void | SetPersistentPropertiesToDefault () |
Set the persistent properties of the object to their default values. More... | |
virtual MVariant | GetPersistentPropertyDefaultValue (const MStdString &name) const |
Get the default value of persistent property with the name given. More... | |
virtual void | SetPersistentPropertyToDefault (const MStdString &name) |
Set the persistent property with the name given to default value. More... | |
virtual const char * | GetType () const |
Get the name of the type for the object (could be the same as class name). | |
virtual void | SetType (const MStdString &) |
Intentionally, it will set the name of the type for the object, but the service will not allow setting the name to anything other than the current name. More... | |
virtual void | Validate () |
Validate internal structures of the object. More... | |
![]() | |
static const MClass | s_class |
Class of MObject. | |
![]() | |
MObject () | |
Object constructor, protected as the class is abstract. | |
void | DoSetPersistentPropertiesToDefault (const MClass *staticClass) |
Set the persistent properties to their default values for one object provided the class for that object. More... | |
Set of various, mostly string related algorithms.
This includes:
|
static |
Add string value to string collection if it is not there yet.
This is a C++ only method.
source | Source string collection into which the value will be attempted to be added |
value | Value to be present in collection after the call succeeds |
Find first occurrence of string in another string.
Can work with strings, byte strings, or collections of items. Searches the given sequence in forward direction for the first occurrence of a subsequence.
sequence | Source string or collection, the one where to find a subSequence Can be of types string, byte string, or collection of items, and the type should be the same as for subSequence, or an exception is thrown. |
subSequence | String or collection to find in sequence Can be of types string, byte string, or collection of items, and the type should be the same as for sequence, or an exception is thrown. |
|
static |
Find last occurrence of string in another string.
Can work with strings, byte strings, or collections of items. Searches the given sequence in backward direction for the last occurrence of a subsequence. Return the index of the first element of subSequence.
sequence | Source string or collection, the one where to find a subSequence. Can be of types string, byte string, or collection of items, and the type should be the same as for subSequence, or an exception is thrown. |
subSequence | String or collection to find in sequence Can be of types string, byte string, or collection of items, and the type should be the same as for sequence, or an exception is thrown. |
|
static |
Sort the string vector given, possibly remove duplicates.
Different from Sort, this method changes the given collection and does not return a new collection. This is a C++ only method, not available through Reflection interface.
collection | Sequence of type MStdStringVector to sort. |
uniqueOnly | If true, return only unique items. Default value is false, return all items sorted, with possible duplicates. |
naturalSort | Natural sort is case insensitive, and multidigit numbers are compared as numbers. This way, the sorted sequence will be such as COM1 COM2 COM11, instead of COM1 COM11 COM2 as in the case of lexicographical comparison. |
|
static |
Trim the leading and trailing characters from the string given, modify this string.
This is a non-reflective C++ version of Trim.
str | String to remove characters from, the given string will be modified. |
trimCharacters | Set of characters to remove. If NULL is given, or if the parameter is not present, the control characters and blanks are removed. If given, this should be a zero terminated string of what to remove, such as "\n\t ". |
|
static |
Trim the leading characters from the string given, modify this string.
This is a non-reflective C++ version of TrimLeft.
str | String to remove characters from, the given string will be modified. |
trimCharacters | Set of characters to remove. If NULL is given, or if the parameter is not present, control characters and blanks are removed. If given, this should be a zero terminated string of what to remove, such as "\n\t ". |
|
static |
Trim the trailing characters from the string given, modify this string.
This is a non-reflective C++ version of TrimRight.
str | String to remove characters from, the given string will be modified. |
trimCharacters | Set of characters to remove. If NULL is given, or if the parameter is not present, control characters and blanks are removed. If given, this should be a zero terminated string of what to remove, such as "\n\t ". |
Join the given array of items into a string or byte string using the given delimiter.
If delimiter is of byte, or byte string type, the result string will be a byte string. Otherwise the result will be a string. All items in source should be convertible into the result type.
source | Sequence of items to join together. This should be a collection of items convertible into either string or to byte string. |
delimiter | Delimiter to place in between source strings. |
|
static |
Replaces all occurrences of 'from' in the source sequence with 'to'.
Can work with strings, byte strings, or collections of items. The sequences are not necessarily of the same length, but they should be assignable one to another.
source | Sequence where to replace the items. Can be of types string, byte string, or collection of items, or an exception is thrown. |
from | Sequence to replace. Should be of the same type as source parameter, or an exception is thrown. |
to | Replacement sequence. Should be of the same type as source parameter, or an exception is thrown. |
Return the given sequence sorted, possibly remove duplicates.
sequence | What to sort. The method does not change the parameter, but rather returns it. Shall be of type string, byte string, or collection, or an exception is thrown. |
uniqueOnly | If true, return only unique items. Default value is false, return all items sorted, with possible duplicates. |
|
static |
Split the string separated by delimiter into a collection of strings.
Empty items are not put into collection, like if the list has a separator at the end, it will not be part of the output vector. If the string has no separators, only one item will be returned.
str | String or byte string to split |
delimiter | String or byte string separator, can be one character such as ";", or multiple characters like ", " (there is a blank at the end). The type of delimiter shall be the same as the type of source, or an exception is thrown. |
trimBlanks | Boolean value, whether to remove blanks from each result string in the collection. If false, or if the parameter is not given, the blanks will be retained in the result string. |
allowEmpty | Boolean value, whether to retain empty strings in the result collection. For example, if allowEmpty is false, three empty strings will result from string ",," if separator is ",". When allowEmpty is true, the result will be an empty collection. If not given, this parameter defaults to false, and the result collection can have empty strings. |
|
static |
Split the string into a vector of strings using the given delimiter sequence.
This is a fast C++ variation of split for strings, not reflected. Empty items are not put into collection, like if the list has a separator at the end, it will not be part of the output vector. If the string has no separators, only one item is returned.
str | String to split |
delimiter | String separator, can be one character such as ";", or multiple characters like ", " (there is a blank at the end in this example) |
trimBlanks | Boolean value, whether to remove blanks from each result string in the collection. If false, or if the parameter is not given, the blanks will be retained in the result string. |
allowEmpty | Boolean value, whether to retain empty strings in the result collection. For example, if allowEmpty is false, three empty strings will result from string ",," if separator is ",". When allowEmpty is true, the result will be an empty collection. If not given, this parameter defaults to false, and the result collection can have empty strings. |
|
static |
Split the string into a vector of strings using the given delimiter sequence.
This is a fast C++ variation of split for strings, not reflected. Empty items are not put into collection, like if the list has a separator at the end, it will not be part of the output vector. If the string has no separators, only one item is returned.
str | String to split |
delimiter | String separator, can be one character such as ";", or multiple characters like ", " (there is a blank at the end in this example) |
trimBlanks | Boolean value, whether to remove blanks from each result string in the collection. If false, or if the parameter is not given, the blanks will be retained in the result string. |
allowEmpty | Boolean value, whether to retain empty strings in the result collection. For example, if allowEmpty is false, three empty strings will result from string ",," if separator is ",". When allowEmpty is true, the result will be an empty collection. If not given, this parameter defaults to false, and the result collection can have empty strings. |
Trim the leading and trailing characters or bytes from the string given, return the result.
Either string or byte string can be given as parameter.
str | String or byte string to remove characters from, the given string will not be modified. |
trimCharacters | Set of characters to remove. If the set is empty, for example the variant is empty, the control characters and blanks are removed. If given, this should be a zero terminated string of what to remove, such as "\n\t ". |
|
static |
Trim the leading characters or bytes from the string given, return the result.
Either string or byte string can be given as parameter.
str | String or byte string to remove characters from, the given string will not be modified. |
trimCharacters | Set of characters to remove. If the set is empty, for example the variant is empty, the control characters and blanks are removed. If given, this should be a zero terminated string of what to remove, such as "\n\t ". |
|
static |
Trim the trailing characters or bytes from the string given, return the result.
Either string or byte string can be given as parameter.
str | String or byte string to remove characters from, the given string will not be modified. |
trimCharacters | Set of characters to remove. If the set is empty, for example the variant is empty, the control characters and blanks are removed. If given, this should be a zero terminated string of what to remove, such as "\n\t ". |
|
static |