company logo

String - String value

odaba::Strings are used for passing parameters to and retrieve content from ODABA interface functions. The odaba::String class provides character strings of defined StringCodingTypes . odaba::String uses implicit sharing (copy-on-write) to reduce memory usage and to avoid the needless copying of data.

Beside the String data type, more specific string classes are provided in order to support strings with more specific syntax:

  • Key ( TypedString ) - passing key values in CSV format
  • Instance ( TypedString ) - passing key values in ESDF format
  • OSIString - passing access paths or expressions in OSI format

The behavior of odaba:String is similar to QString from QT. odaba:String supports units, bytes and code points (characters) for expressing positions in a string. When not explicitly stated differently, code points are used by default. The class does not support combined characters.

Under Linux, default encoding is set to UTF8, UTF16 or UTF32, when system locale refers to UTF encoding.

Notes:

For UTF8 or UTF16 encoding, units may differ from code points, since unit size is 1 or 2, while code point size may reach 4 bytes.

String encoding

The odaba::String class supports fifferent encoding types for text data. The default text data types STRING and CHAR are strored in local encoding format, which depends on computer configuration, i.e. as long as an application is using STRING and CHAR for text data types, the application will run without any problem, since all string constants provided within the application are also assumed to be defined in local 8 bit encoding.

When, however, data has to be imported from external sources, this might be provided using different coding types (e.g. UTF8). Also, some applications need to support multi-lingual text fields, in wchich case richer text encodings are required. Such cases might be handled by using unicode encoding types provide as text data types UTF8 , UTF16 or UTF32 . When reading data stored with unicode encoding types, it is provided by default with te encoding type as being defined in the database. Passing those strings to the .NET interface, always recodes strings to UTF16. In C++ applications the application has to care about proper encoding formats.

Nevertheless, the String class provides implicit recoding whenever meaningfull. The rule is, that parameters or operands will be recoded to the encoding type of the result string or the string to be manupulated. In some cases (e.g. operator+), the result string is undefined or there is no result string. In those cases, the right operand is recoded into the encoding type of the left operand or parameters are encoded into the coding type of the calling String object.

Attributes
    Function Groups
    Functions