rwlogo
Rogue Wave Views 5.6

Rogue Wave Views
Data Access Package API Reference Guide

Product Documentation:

Rogue Wave Views
Documentation Home

IliFormat Class Reference

User interface class. More...

#include <ilviews/dataccess/format.h>

List of all members.

Public Member Functions

 IliFormat (const IliFormat &)
 This is the copy constructor of the IliFormat class.
 IliFormat (const char *definition)
 Initializes a format according to a definition.
 IliFormat ()
 Initializes a default format.
void format (IliString &dest, const IliDate &val) const
 Formats date and appends the result to a string.
void format (IliString &dest, IliDecimal val) const
 Formats decimal and appends the result to a string.
void format (IliString &dest, IlDouble val) const
 Formats double and appends the result to a string.
void format (IliString &dest, IlFloat val) const
 Formats float and appends the result to a string.
void format (IliString &dest, IlInt val) const
 Formats integer and appends the result to a string.
void format (IliString &dest, IlBoolean val) const
 Formats Boolean and appends the result to a string.
void format (IliString &dest, const char *val) const
 Formats string and appends the result to another string.
const char * getDefinition () const
 Returns the definition of the format.
IliFormatType getType () const
 Returns the type of the format.
IlBoolean isNull () const
 Returns IlTrue if the format definition is Null.
IlBoolean isPasswordFormat () const
 Returns IlTrue if the format can be used to format passwords.
IlBoolean isUserDefinedFormat () const
 Returns IlTrue if the format definition consists of a user-defined specification.
IliFormatoperator= (const IliFormat &fmt)
 Copies a format.
int operator== (const IliFormat &fmt) const
 Tests whether two formats are equal.
void read (IL_STDPREF istream &input)
 Reads the format from an input stream.
void setDefinition (const char *definition)
 Sets the definition of a format.
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.

Static Public Member Functions

static void AddAlias (const char *aliasName, const char *definition, IliFormatType type, IliFormatCategory=IliUserFormat)
 Defines a new alias.
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.
static const char * GetAliasDefinition (const char *aliasName)
 Returns the definition for one alias.
static const char * GetAliasDefinition (IlInt aliasIndex)
 Returns the definition for one alias.
static IlInt GetAliasesCount ()
 Returns the count of the format aliases.
static IliFormatCategory GetAliasFormatCategory (IlInt aliasIndex)
 Returns the category for one alias.
static IliFormatType GetAliasFormatType (IlInt aliasIndex)
 Returns the format type for one alias.
static IlInt GetAliasIndex (const char *aliasName)
 Returns the position of one alias.
static const char * GetAliasName (IlInt aliasIndex)
 Returns the name of one alias.
static IliCurrencyPosition GetCurrencyPosition ()
 Returns the position of the currency symbol in formatted output.
static const char * GetCurrencySymbol ()
 Returns the character string used to represent the currency symbol in formatted output.
static char GetDateSeparator ()
 Returns the character used to represent a date separator in formatted output.
static char GetDecimalPoint ()
 Returns the character used to represent a decimal point in formatted output.
static const IliFormatGetDefaultFormat ()
 Returns a constant reference to the default format.
static const char * GetLongMonthLabel (IlInt month)
 Returns the character string used to represent a month.
static const char * GetLongWeekDayLabel (IlInt weekDay)
 Returns the character string used to represent the day.
static IlInt GetMonthByName (const char *name)
 Returns the index of the month from its name.
static const char * GetShortMonthLabel (IlInt month)
 Returns the abbreviated character string used to represent a moth.
static const char * GetShortWeekDayLabel (IlInt weekDay)
 Returns the abbreviated character string used to represent the day.
static char GetThousandsSeparator ()
 Returns the character used to represent the thousands separator in formatted output.
static char GetTimeSeparator ()
 Returns the character used to represent a time separator in formatted output.
static IlBoolean IsDefaultStringLtoR ()
 Returns IlTrue if the formatting of strings proceeds by default from left to right.
static IlBoolean IsMonthBeforeDay ()
 Returns IlTrue if the month should be formatted to the left of the day.
static IlBoolean ReadMessageDatabase (IlvDisplay *disp, const char *file)
 Reads a message database file.
static void RemoveAlias (IlInt aliasIndex)
 Removes an alias.
static void SetAliasDefinition (IlInt aliasIndex, const char *definition)
 Sets the definition of one alias.
static void SetAliasFormatCategory (IlInt aliasIndex, IliFormatCategory c)
 Sets the format category for one alias.
static void SetAliasFormatType (IlInt aliasIndex, IliFormatType type)
 Sets the format type for one alias.
static void SetAliasName (IlInt aliasIndex, const char *name)
 Sets the name of one alias.
static void SetCurrencyPosition (IliCurrencyPosition pos)
 Sets the position of the currency symbol in formatted output.
static void SetCurrencySymbol (const char *)
 Sets the character string used to represent the currency symbol in formatted output.
static void SetDateSeparator (char c)
 Sets the character used to represent a date separator in formatted output.
static void SetDecimalPoint (char c)
 Sets the character used to represent a decimal point in formatted output.
static void SetDefaultStringLtoR (IlBoolean direction)
 Sets the default formatting direction of strings.
static void SetLongMonthLabel (IlInt month, const char *label)
 Sets the character string used to represent a month.
static void SetLongWeekDayLabel (IlInt weekDay, const char *label)
 Sets the character string used to represent the day.
static void SetMonthBeforeDay (IlBoolean before)
 Specifies whether the month is shown before, or after the day, in the formatted output.
static void SetShortMonthLabel (IlInt month, const char *label)
 Sets the abbreviated character string used to represent a month.
static void SetShortWeekDayLabel (IlInt weekDay, const char *str)
 Sets the abbreviated character string used to represent the day.
static void SetThousandsSeparator (char c)
 Sets the character used to represent the thousands separator in formatted output.
static void SetTimeSeparator (char)
 Sets the character used to represent a time separator in formatted output.

Detailed Description

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.

See also:
IliDate, IliString, IliDecimal, IliCurrencyPosition, IliFormatCategory, IliFormatType

Constructor & Destructor Documentation

IliFormat::IliFormat ( const char *  definition  ) 

Initializes a format according to a definition.

Parameters:
definition The format definition.

Member Function Documentation

static void IliFormat::AddAlias ( const char *  aliasName,
const char *  definition,
IliFormatType  type,
IliFormatCategory  = IliUserFormat 
) [static]

Defines a new alias.

Parameters:
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 void IliFormat::ConnectToMessageDatabase ( IlvDisplay display  )  [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.

Parameters:
display The display.
void IliFormat::format ( IliString dest,
const IliDate val 
) const

Formats date and appends the result to a string.

Parameters:
dest The destination string.
val The value.
void IliFormat::format ( IliString dest,
IliDecimal  val 
) const

Formats decimal and appends the result to a string.

Parameters:
dest The destination string.
val The value.
void IliFormat::format ( IliString dest,
IlDouble  val 
) const

Formats double and appends the result to a string.

Parameters:
dest The destination string.
val The value.
void IliFormat::format ( IliString dest,
IlFloat  val 
) const

Formats float and appends the result to a string.

Parameters:
dest The destination string.
val The value.
void IliFormat::format ( IliString dest,
IlInt  val 
) const

Formats integer and appends the result to a string.

Parameters:
dest The destination string.
val The value.
void IliFormat::format ( IliString dest,
IlBoolean  val 
) const

Formats Boolean and appends the result to a string.

Parameters:
dest The destination string.
val The value.
void IliFormat::format ( IliString dest,
const char *  val 
) const

Formats string and appends the result to another string.

Parameters:
dest The destination string.
val The value.
static const char* IliFormat::GetAliasDefinition ( const char *  aliasName  )  [static]

Returns the definition for one alias.

Parameters:
aliasName The alias name.
Returns:
The definition.
static const char* IliFormat::GetAliasDefinition ( IlInt  aliasIndex  )  [static]

Returns the definition for one alias.

Parameters:
aliasIndex The alias index.
Returns:
The definition.
static IlInt IliFormat::GetAliasesCount (  )  [static]

Returns the count of the format aliases.

Returns:
The count.
static IliFormatCategory IliFormat::GetAliasFormatCategory ( IlInt  aliasIndex  )  [static]

Returns the category for one alias.

Parameters:
aliasIndex The alias index.
Returns:
The category.
static IliFormatType IliFormat::GetAliasFormatType ( IlInt  aliasIndex  )  [static]

Returns the format type for one alias.

Parameters:
aliasIndex The alias index.
Returns:
The format type.
static IlInt IliFormat::GetAliasIndex ( const char *  aliasName  )  [static]

Returns the position of one alias.

Parameters:
aliasName The alias name.
Returns:
The position if found, otherwise -1.
static const char* IliFormat::GetAliasName ( IlInt  aliasIndex  )  [static]

Returns the name of one alias.

Parameters:
aliasIndex The alias index.
Returns:
The name.
static IliCurrencyPosition IliFormat::GetCurrencyPosition (  )  [static]

Returns the position of the currency symbol in formatted output.

Returns:
The position of the currency symbol in formatted output. The returned value can be one of the following: IliCP_AtLeft_NoSpace, IliCP_AtLeft_Space, IliCP_AtRight_NoSpace or IliCP_AtRight_Space.
static const char* IliFormat::GetCurrencySymbol (  )  [static]

Returns the character string used to represent the currency symbol in formatted output.

Returns:
The character.
static char IliFormat::GetDateSeparator (  )  [static]

Returns the character used to represent a date separator in formatted output.

Returns:
The character.
static char IliFormat::GetDecimalPoint (  )  [static]

Returns the character used to represent a decimal point in formatted output.

Returns:
The character.
static const IliFormat& IliFormat::GetDefaultFormat (  )  [static]

Returns a constant reference to the default format.

Returns:
A constant reference to the default format.
const char* IliFormat::getDefinition (  )  const

Returns the definition of the format.

Returns:
The definition.
static const char* IliFormat::GetLongMonthLabel ( IlInt  month  )  [static]

Returns the character string used to represent a month.

Parameters:
month. The month (an integer between 0 and 11).
Returns:
The character string.
static const char* IliFormat::GetLongWeekDayLabel ( IlInt  weekDay  )  [static]

Returns the character string used to represent the day.

Parameters:
weekDay The day (an integer between 0 and 6 ).
Returns:
The character string.
static IlInt IliFormat::GetMonthByName ( const char *  name  )  [static]

Returns the index of the month from its name.

Parameters:
name The month name.
Returns:
An integer between 0 and 11, if successful, and -1 if not.
static const char* IliFormat::GetShortMonthLabel ( IlInt  month  )  [static]

Returns the abbreviated character string used to represent a moth.

Parameters:
month. The month (an integer between 0 and 11).
Returns:
The abbreviated character string.
static const char* IliFormat::GetShortWeekDayLabel ( IlInt  weekDay  )  [static]

Returns the abbreviated character string used to represent the day.

Parameters:
weekDay The day (an integer between 0 and 6 ).
Returns:
The abbreviated character string.
static char IliFormat::GetThousandsSeparator (  )  [static]

Returns the character used to represent the thousands separator in formatted output.

Returns:
The character.
static char IliFormat::GetTimeSeparator (  )  [static]

Returns the character used to represent a time separator in formatted output.

Returns:
The character.
IliFormatType IliFormat::getType (  )  const

Returns the type of the format.

Possible values are IliNullFormatType, IliStringFormatType, IliNumberFormatType, or IliDateFormatType.

Returns:
The type.
static IlBoolean IliFormat::IsDefaultStringLtoR (  )  [static]

Returns IlTrue if the formatting of strings proceeds by default from left to right.

Returns:
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 IlBoolean IliFormat::IsMonthBeforeDay (  )  [static]

Returns IlTrue if the month should be formatted to the left of the day.

Returns:
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.

Returns:
IlTrue if the format definition is Null.
IlBoolean IliFormat::isPasswordFormat (  )  const

Returns IlTrue if the format can be used to format passwords.

Returns:
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.

Returns:
IlTrue if the format definition consists of a user-defined specification.
IliFormat& IliFormat::operator= ( const IliFormat fmt  ) 

Copies a format.

Parameters:
fmt The format that will be copied.
int IliFormat::operator== ( const IliFormat fmt  )  const

Tests whether two formats are equal.

Parameters:
fmt The second format.
void IliFormat::read ( IL_STDPREF istream &  input  ) 

Reads the format from an input stream.

Parameters:
input The input stream.
static IlBoolean IliFormat::ReadMessageDatabase ( IlvDisplay disp,
const char *  file 
) [static]

Reads a message database file.

Parameters:
disp The display.
file The message database file must be a valid Rogue Wave Views message database file.
Returns:
IlTrue if the file was successfully located.
static void IliFormat::RemoveAlias ( IlInt  aliasIndex  )  [static]

Removes an alias.

Parameters:
aliasIndex The alias index.
static void IliFormat::SetAliasDefinition ( IlInt  aliasIndex,
const char *  definition 
) [static]

Sets the definition of one alias.

Parameters:
aliasIndex The alias index.
definition The definition.
static void IliFormat::SetAliasFormatCategory ( IlInt  aliasIndex,
IliFormatCategory  c 
) [static]

Sets the format category for one alias.

Parameters:
aliasIndex The alias index.
c The format category.
static void IliFormat::SetAliasFormatType ( IlInt  aliasIndex,
IliFormatType  type 
) [static]

Sets the format type for one alias.

Parameters:
aliasIndex The alias index.
type The format type.
static void IliFormat::SetAliasName ( IlInt  aliasIndex,
const char *  name 
) [static]

Sets the name of one alias.

Parameters:
aliasIndex The alias index.
name The alias name.
static void IliFormat::SetCurrencyPosition ( IliCurrencyPosition  pos  )  [static]

Sets the position of the currency symbol in formatted output.

Parameters:
pos The position.
static void IliFormat::SetCurrencySymbol ( const char *   )  [static]

Sets the character string used to represent the currency symbol in formatted output.

Parameters:
c The character.
static void IliFormat::SetDateSeparator ( char  c  )  [static]

Sets the character used to represent a date separator in formatted output.

Parameters:
c The character.
static void IliFormat::SetDecimalPoint ( char  c  )  [static]

Sets the character used to represent a decimal point in formatted output.

Parameters:
c The character.
static void IliFormat::SetDefaultStringLtoR ( IlBoolean  direction  )  [static]

Sets the default formatting direction of strings.

Parameters:
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.

Parameters:
definition The definition.
static void IliFormat::SetLongMonthLabel ( IlInt  month,
const char *  label 
) [static]

Sets the character string used to represent a month.

Parameters:
month. The month (an integer between 0 and 11).
label The month label.
static void IliFormat::SetLongWeekDayLabel ( IlInt  weekDay,
const char *  label 
) [static]

Sets the character string used to represent the day.

Parameters:
weekDay The day (an integer between 0 and 6 ).
label The day label.
static void IliFormat::SetMonthBeforeDay ( IlBoolean  before  )  [static]

Specifies whether the month is shown before, or after the day, in the formatted output.

Parameters:
before If IlTrue the month is formatted to the left of the day.
static void IliFormat::SetShortMonthLabel ( IlInt  month,
const char *  label 
) [static]

Sets the abbreviated character string used to represent a month.

Parameters:
month. The month (an integer between 0 and 11).
label The month label.
static void IliFormat::SetShortWeekDayLabel ( IlInt  weekDay,
const char *  str 
) [static]

Sets the abbreviated character string used to represent the day.

Parameters:
weekDay The day (an integer between 0 and 6 ).
str The day label.
static void IliFormat::SetThousandsSeparator ( char  c  )  [static]

Sets the character used to represent the thousands separator in formatted output.

Parameters:
c The character.
static void IliFormat::SetTimeSeparator ( char   )  [static]

Sets the character used to represent a time separator in formatted output.

Parameters:
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.

Parameters:
output The output stream.
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends

© Copyright 2012, 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.