TextFile :: writeFormatted - Write formatted text
The function writes text passed in sFormatString to the file. placeholders in the format string (%s) will be replaced by variables passed as parameter or parameter list.
The function supports indenting according to indentSize ind indent() / unindent() calls. Indent settings will be processed after replacement.
Moreover, the function supports line numbers by providing the current line number in lineNumber .
The function requires formatted text processing. Any other kind of text processing will cause an exception.
Implementation overview
- Write formatted line
TextFile :: writeFormatted ( sFormatString ) - Write formatstring replacing placeholder
TextFile :: writeFormatted ( sFormatString, sString ) - Write formatstring replacing placeholders
TextFile :: writeFormatted ( sFormatString, sParmList )
Implementation details
-
Write formatted line
TextFile  :: writeFormatted ( odaba::String &sFormatString )
The function writes data passed in sFormatString to the file inserting requested indents. No text replacement is done for the format string.
- sFormatString
- Format string
The format string contains text constants and place holders represented by "%s". Place holders are replaced by parameters according to their place holder position (first place holder is replaced by the value of the first parameter etc.)
The function tries to resolve parameters in the following order:
- get property value, when parameter is a property name
- get option value
- (NULL), when parameter could not be resolved
All parameter values are automatically converted to strings before replacing the place holder.
to list
- sFormatString
- Format string
-
Write formatstring replacing placeholder
TextFile  :: writeFormatted ( odaba::String &sFormatString, odaba::String &sString )
The function replaces the first placeholder (%s) in sFormatString by the value passed in sString before writing text to file. Indent settings will be processed after replacement.
- sFormatString
- Format string
The format string contains text constants and place holders represented by "%s". Place holders are replaced by parameters according to their place holder position (first place holder is replaced by the value of the first parameter etc.)
The function tries to resolve parameters in the following order:
- get property value, when parameter is a property name
- get option value
- (NULL), when parameter could not be resolved
All parameter values are automatically converted to strings before replacing the place holder.
- sString - String value
to list
- sFormatString
- Format string
-
Write formatstring replacing placeholders
TextFile  :: writeFormatted ( odaba::String &sFormatString, odaba::StringList &sParmList )
The function replaces the placeholders (%s) in sFormatString by values passed in sParmList before writing text to file. In case sParmList contains more values as place holders in sFormatString , additional values are ignored. In case of more placeholders than values in sParmList , placeholders remain in string.
- sFormatString
- Format string
The format string contains text constants and place holders represented by "%s". Place holders are replaced by parameters according to their place holder position (first place holder is replaced by the value of the first parameter etc.)
The function tries to resolve parameters in the following order:
- get property value, when parameter is a property name
- get option value
- (NULL), when parameter could not be resolved
All parameter values are automatically converted to strings before replacing the place holder.
- sParmList
- Parameter list
Parameters passed in a string list. In some cases, parameters containing spaces have to be quoted.
to list
- sFormatString
- Format string