Rogue Wave Views |
Rogue Wave Views Documentation Home |
User interface class. More...
#include <ilviews/dataccess/format.h>
Public Member Functions | |
IliFormat () | |
Initializes a default format. | |
IliFormat (const char *definition) | |
Initializes a format according to a definition. More... | |
IliFormat (const IliFormat &) | |
This is the copy constructor of the IliFormat class. | |
void | format (IliString &dest, const char *val) const |
Formats string and appends the result to another string. More... | |
void | format (IliString &dest, IlBoolean val) const |
Formats Boolean and appends the result to a string. More... | |
void | format (IliString &dest, IlInt val) const |
Formats integer and appends the result to a string. More... | |
void | format (IliString &dest, IlFloat val) const |
Formats float and appends the result to a string. More... | |
void | format (IliString &dest, IlDouble val) const |
Formats double and appends the result to a string. More... | |
void | format (IliString &dest, IliDecimal val) const |
Formats decimal and appends the result to a string. More... | |
void | format (IliString &dest, const IliDate &val) const |
Formats date and appends the result to a string. More... | |
const char * | getDefinition () const |
Returns the definition of the format. More... | |
IliFormatType | getType () const |
Returns the type of the format. More... | |
IlBoolean | isNull () const |
Returns IlTrue if the format definition is Null . More... | |
IlBoolean | isPasswordFormat () const |
Returns IlTrue if the format can be used to format passwords. More... | |
IlBoolean | isUserDefinedFormat () const |
Returns IlTrue if the format definition consists of a user-defined specification. More... | |
IliFormat & | operator= (const IliFormat &fmt) |
Copies a format. More... | |
int | operator== (const IliFormat &fmt) const |
Tests whether two formats are equal. More... | |
void | read (IL_STDPREF istream &input) |
Reads the format from an input stream. More... | |
void | setDefinition (const char *definition) |
Sets the definition of a format. More... | |
void | write (IL_STDPREF ostream &output) const |
Writes the format definition to an output stream in such a way that it may be read back by the read member function. More... | |
Static Public Member Functions | |
static void | AddAlias (const char *aliasName, const char *definition, IliFormatType type, IliFormatCategory category=IliUserFormat) |
Defines a new alias. More... | |
static void | ConnectToMessageDatabase (IlvDisplay *display) |
Attaches a language hook to the display so that it can be notified about a change in the current language of the display. More... | |
static const char * | GetAliasDefinition (IlInt aliasIndex) |
Returns the definition for one alias. More... | |
static const char * | GetAliasDefinition (const char *aliasName) |
Returns the definition for one alias. More... | |
static IlInt | GetAliasesCount () |
Returns the count of the format aliases. More... | |
static IliFormatCategory | GetAliasFormatCategory (IlInt aliasIndex) |
Returns the category for one alias. More... | |
static IliFormatType | GetAliasFormatType (IlInt aliasIndex) |
Returns the format type for one alias. More... | |
static IlInt | GetAliasIndex (const char *aliasName) |
Returns the position of one alias. More... | |
static const char * | GetAliasName (IlInt aliasIndex) |
Returns the name of one alias. More... | |
static IliCurrencyPosition | GetCurrencyPosition () |
Returns the position of the currency symbol in formatted output. More... | |
static const char * | GetCurrencySymbol () |
Returns the character string used to represent the currency symbol in formatted output. More... | |
static char | GetDateSeparator () |
Returns the character used to represent a date separator in formatted output. More... | |
static char | GetDecimalPoint () |
Returns the character used to represent a decimal point in formatted output. More... | |
static const IliFormat & | GetDefaultFormat () |
Returns a constant reference to the default format. More... | |
static const char * | GetLongMonthLabel (IlInt month) |
Returns the character string used to represent a month. More... | |
static const char * | GetLongWeekDayLabel (IlInt weekDay) |
Returns the character string used to represent the day. More... | |
static IlInt | GetMonthByName (const char *name) |
Returns the index of the month from its name. More... | |
static const char * | GetShortMonthLabel (IlInt month) |
Returns the abbreviated character string used to represent a month. More... | |
static const char * | GetShortWeekDayLabel (IlInt weekDay) |
Returns the abbreviated character string used to represent the day. More... | |
static char | GetThousandsSeparator () |
Returns the character used to represent the thousands separator in formatted output. More... | |
static char | GetTimeSeparator () |
Returns the character used to represent a time separator in formatted output. More... | |
static IlBoolean | IsDefaultStringLtoR () |
Returns IlTrue if the formatting of strings proceeds by default from left to right. More... | |
static IlBoolean | IsMonthBeforeDay () |
Returns IlTrue if the month should be formatted to the left of the day. More... | |
static IlBoolean | ReadMessageDatabase (IlvDisplay *disp, const char *file) |
Reads a message database file. More... | |
static void | RemoveAlias (IlInt aliasIndex) |
Removes an alias. More... | |
static void | SetAliasDefinition (IlInt aliasIndex, const char *definition) |
Sets the definition of one alias. More... | |
static void | SetAliasFormatCategory (IlInt aliasIndex, IliFormatCategory c) |
Sets the format category for one alias. More... | |
static void | SetAliasFormatType (IlInt aliasIndex, IliFormatType type) |
Sets the format type for one alias. More... | |
static void | SetAliasName (IlInt aliasIndex, const char *name) |
Sets the name of one alias. More... | |
static void | SetCurrencyPosition (IliCurrencyPosition pos) |
Sets the position of the currency symbol in formatted output. More... | |
static void | SetCurrencySymbol (const char *c) |
Sets the character string used to represent the currency symbol in formatted output. More... | |
static void | SetDateSeparator (char c) |
Sets the character used to represent a date separator in formatted output. More... | |
static void | SetDecimalPoint (char c) |
Sets the character used to represent a decimal point in formatted output. More... | |
static void | SetDefaultStringLtoR (IlBoolean direction) |
Sets the default formatting direction of strings. More... | |
static void | SetLongMonthLabel (IlInt month, const char *label) |
Sets the character string used to represent a month. More... | |
static void | SetLongWeekDayLabel (IlInt weekDay, const char *label) |
Sets the character string used to represent the day. More... | |
static void | SetMonthBeforeDay (IlBoolean before) |
Specifies whether the month is shown before, or after the day, in the formatted output. More... | |
static void | SetShortMonthLabel (IlInt month, const char *label) |
Sets the abbreviated character string used to represent a month. More... | |
static void | SetShortWeekDayLabel (IlInt weekDay, const char *str) |
Sets the abbreviated character string used to represent the day. More... | |
static void | SetThousandsSeparator (char c) |
Sets the character used to represent the thousands separator in formatted output. More... | |
static void | SetTimeSeparator (char c) |
Sets the character used to represent a time separator in formatted output. More... | |
User interface class.
Library: dataccess
An IliFormat
object is used to format values into character strings according to specific rules. It is either a user-defined format specification (for example, "#,##0.00") or a predefined format (for example, "Currency"). Although the formatting process is controlled by the format specification, it may use some global settings (such as the character that represents a decimal point). The IliFormat
class contains a set of static member functions that can be used to query and set the global settings, and that affect the formatting process. It is possible to name a format specification so that it may be conveniently referenced. This can be done through the aliasing mechanism provided by the IliFormat
class.
IliFormat::IliFormat | ( | const char * | definition | ) |
Initializes a format according to a definition.
definition | The format definition. |
|
static |
Defines a new alias.
aliasName | The alias name. |
definition | The definition. |
type | The format type. |
category | The format category can be one of the following values: IliSystemFormat , IliApplicationFormat or IliUserFormat . |
|
static |
Attaches a language hook to the display so that it can be notified about a change in the current language of the display.
It is necessary to call this member function at initialization time after the date.dbm
message database file has been successfully read by the ReadMessageDatabase
member function.
display | The display. |
void IliFormat::format | ( | IliString & | dest, |
const char * | val | ||
) | const |
Formats string and appends the result to another string.
dest | The destination string. |
val | The value. |
Formats Boolean and appends the result to a string.
dest | The destination string. |
val | The value. |
Formats integer and appends the result to a string.
dest | The destination string. |
val | The value. |
Formats float and appends the result to a string.
dest | The destination string. |
val | The value. |
Formats double and appends the result to a string.
dest | The destination string. |
val | The value. |
void IliFormat::format | ( | IliString & | dest, |
IliDecimal | val | ||
) | const |
Formats decimal and appends the result to a string.
dest | The destination string. |
val | The value. |
Formats date and appends the result to a string.
dest | The destination string. |
val | The value. |
|
static |
Returns the definition for one alias.
aliasIndex | The alias index. |
|
static |
Returns the definition for one alias.
aliasName | The alias name. |
|
static |
Returns the count of the format aliases.
|
static |
Returns the category for one alias.
aliasIndex | The alias index. |
|
static |
Returns the format type for one alias.
aliasIndex | The alias index. |
|
static |
Returns the position of one alias.
aliasName | The alias name. |
-1
.
|
static |
Returns the name of one alias.
aliasIndex | The alias index. |
|
static |
Returns the position of the currency symbol in formatted output.
IliCP_AtLeft_NoSpace
, IliCP_AtLeft_Space
, IliCP_AtRight_NoSpace
or IliCP_AtRight_Space
.
|
static |
Returns the character string used to represent the currency symbol in formatted output.
|
static |
Returns the character used to represent a date separator in formatted output.
|
static |
Returns the character used to represent a decimal point in formatted output.
|
static |
Returns a constant reference to the default format.
const char* IliFormat::getDefinition | ( | ) | const |
Returns the definition of the format.
|
static |
Returns the character string used to represent a month.
month | The month (an integer between 0 and 11 ). |
|
static |
Returns the character string used to represent the day.
weekDay | The day (an integer between 0 and 6 ). |
|
static |
Returns the index of the month from its name.
name | The month name. |
0
and 11
, if successful, and -1
if not.
|
static |
Returns the abbreviated character string used to represent a month.
month | The month (an integer between 0 and 11 ). |
|
static |
Returns the abbreviated character string used to represent the day.
weekDay | The day (an integer between 0 and 6 ). |
|
static |
Returns the character used to represent the thousands separator in formatted output.
|
static |
Returns the character used to represent a time separator in formatted output.
IliFormatType IliFormat::getType | ( | ) | const |
Returns the type of the format.
Possible values are IliNullFormatType
, IliStringFormatType
, IliNumberFormatType
, or IliDateFormatType
.
|
static |
Returns IlTrue
if the formatting of strings proceeds by default from left to right.
IlTrue
if the formatting of strings proceeds by default (i.e., when the "!" symbol was not used in the format specifications) from left to right.
|
static |
Returns IlTrue
if the month should be formatted to the left of the day.
IlTrue
if the month should be formatted to the left of the day. IlBoolean IliFormat::isNull | ( | ) | const |
Returns IlTrue
if the format definition is Null
.
IlTrue
if the format definition is Null
. IlBoolean IliFormat::isPasswordFormat | ( | ) | const |
Returns IlTrue
if the format can be used to format passwords.
IlTrue
if the format can be used to format passwords. IlBoolean IliFormat::isUserDefinedFormat | ( | ) | const |
Returns IlTrue
if the format definition consists of a user-defined specification.
IlTrue
if the format definition consists of a user-defined specification. Copies a format.
fmt | The format that will be copied. |
int IliFormat::operator== | ( | const IliFormat & | fmt | ) | const |
Tests whether two formats are equal.
fmt | The second format. |
void IliFormat::read | ( | IL_STDPREF istream & | input | ) |
Reads the format from an input stream.
input | The input stream. |
|
static |
Reads a message database file.
disp | The display. |
file | The message database file must be a valid Rogue Wave Views message database file. |
IlTrue
if the file was successfully located.
|
static |
Removes an alias.
aliasIndex | The alias index. |
|
static |
Sets the definition of one alias.
aliasIndex | The alias index. |
definition | The definition. |
|
static |
Sets the format category for one alias.
aliasIndex | The alias index. |
c | The format category. |
|
static |
Sets the format type for one alias.
aliasIndex | The alias index. |
type | The format type. |
|
static |
Sets the name of one alias.
aliasIndex | The alias index. |
name | The alias name. |
|
static |
Sets the position of the currency symbol in formatted output.
pos | The position. |
|
static |
Sets the character string used to represent the currency symbol in formatted output.
c | The character. |
|
static |
Sets the character used to represent a date separator in formatted output.
c | The character. |
|
static |
Sets the character used to represent a decimal point in formatted output.
c | The character. |
|
static |
Sets the default formatting direction of strings.
direction | If IlTrue , sets the default formatting direction of strings to "left to right". Otherwise the default formatting direction is set to "right to left". |
void IliFormat::setDefinition | ( | const char * | definition | ) |
Sets the definition of a format.
definition | The definition. |
|
static |
Sets the character string used to represent a month.
month | The month (an integer between 0 and 11 ). |
label | The month label. |
|
static |
Sets the character string used to represent the day.
weekDay | The day (an integer between 0 and 6 ). |
label | The day label. |
|
static |
Specifies whether the month is shown before, or after the day, in the formatted output.
before | If IlTrue the month is formatted to the left of the day. |
|
static |
Sets the abbreviated character string used to represent a month.
month | The month (an integer between 0 and 11 ). |
label | The month label. |
|
static |
Sets the abbreviated character string used to represent the day.
weekDay | The day (an integer between 0 and 6 ). |
str | The day label. |
|
static |
Sets the character used to represent the thousands separator in formatted output.
c | The character. |
|
static |
Sets the character used to represent a time separator in formatted output.
c | The character. |
void IliFormat::write | ( | IL_STDPREF ostream & | output | ) | const |
Writes the format definition to an output stream in such a way that it may be read back by the read
member function.
output | The output stream. |
© Copyright 2015, Rogue Wave Software, Inc. All Rights Reserved.
Rogue Wave is a registered trademark of Rogue Wave Software, Inc. in the United States and other countries. All other trademarks are the property of their respective owners.