Vault  4.1
Public Member Functions
VInstantFormatter Class Reference

This class describes how a VInstant should be formatted as a string. More...

#include <vinstant.h>

List of all members.

Public Member Functions

 VInstantFormatter ()
 Constructs a formatter for the default locale with a default format specifier.
 VInstantFormatter (const VInstantFormatterLocaleInfo &localeInfo)
 Constructs a formatter for a specified locale with a default format specifier.
 VInstantFormatter (const VString &formatSpecifier)
 Constructs a formatter for the default locale with a specified format specifier.
 VInstantFormatter (const VString &formatSpecifier, const VInstantFormatterLocaleInfo &localeInfo)
 Constructs a formatter for a specified locale and format specifier.
VString formatLocalString (const VInstant &when) const
 Builds and returns a local time zone time stamp string for the specified instant, according to the locale and format specifier supplied to the constructor of this formatter.
VString formatUTCString (const VInstant &when) const
 Builds and returns a UTC time zone time stamp string for the specified instant, according to the locale and format specifier supplied to the constructor of this formatter.
VString getFormatSpecifier () const

Detailed Description

This class describes how a VInstant should be formatted as a string.

You construct it with a format specifier string, whose contents lay out the fields that you want in the string, and their form. The format specifier implements as closely as possible the same directives as the Java SimpleDateFormat documentation describes: <http://docs.oracle.com/javase/7/docs/api/java/text/SimpleDateFormat.html> You can also supply a locale info object to indicate the language of non-numeric parts of the string. In the future this may also include some aspects of formatting that differ per locale rather than per format specifier.

Because there is nothing mutable in this class, and because there is no transient internal state in the object, the format() method can be called freely by multiple threads at the same time.

Definition at line 1317 of file vinstant.h.


Constructor & Destructor Documentation

VInstantFormatter::VInstantFormatter ( const VInstantFormatterLocaleInfo localeInfo)

Constructs a formatter for a specified locale with a default format specifier.

Parameters:
localeInfothe locale to use

Definition at line 1412 of file vinstant.cpp.

VInstantFormatter::VInstantFormatter ( const VString formatSpecifier)

Constructs a formatter for the default locale with a specified format specifier.

Parameters:
formatSpecifierthe format to apply

Definition at line 1418 of file vinstant.cpp.

VInstantFormatter::VInstantFormatter ( const VString formatSpecifier,
const VInstantFormatterLocaleInfo localeInfo 
)

Constructs a formatter for a specified locale and format specifier.

Parameters:
formatSpecifierthe format to apply
localeInfothe locale to use

Definition at line 1424 of file vinstant.cpp.


Member Function Documentation

VString VInstantFormatter::formatLocalString ( const VInstant when) const

Builds and returns a local time zone time stamp string for the specified instant, according to the locale and format specifier supplied to the constructor of this formatter.

Assuming that the local time zone is non-UTC, if the format specifier includes time zone, it will be non-zero such as "-07:00" depending on the particular specifier.

Definition at line 1430 of file vinstant.cpp.

References VInstant::getLocalInstantFields(), and VInstant::getLocalOffsetMilliseconds().

VString VInstantFormatter::formatUTCString ( const VInstant when) const

Builds and returns a UTC time zone time stamp string for the specified instant, according to the locale and format specifier supplied to the constructor of this formatter.

If the format specifier includes the time zone, it will indicate UTC in a form such as "Z" or "+0:00" depending on the particular specifier.

Definition at line 1434 of file vinstant.cpp.

References VInstant::getUTCInstantFields().


The documentation for this class was generated from the following files:

Copyright ©1997-2014 Trygve Isaacson. All rights reserved. This documentation was generated with Doxygen.