SourcePro® API Reference Guide

Product Documentation:
   SourcePro
Documentation Home
List of all members | Public Member Functions
RWTimeTupleOffsetFormatter Class Reference

Formats a RWTimeTupleOffset based on a user-defined format. More...

#include <rw/tools/timetupleoffsetformatter.h>

Public Member Functions

 RWTimeTupleOffsetFormatter (const RWCString &format)
 
 RWTimeTupleOffsetFormatter (RWCString &&format)
 
 RWTimeTupleOffsetFormatter (const RWTimeTupleOffsetFormatter &rhs)
 
 RWTimeTupleOffsetFormatter (RWTimeTupleOffsetFormatter &&rhs)
 
 ~RWTimeTupleOffsetFormatter ()
 
RWCString operator() (const RWTimeTupleOffset &tt) const
 
RWCString operator() (const RWTimeTupleOffset &tt, const RWLocale &locale) const
 
RWTimeTupleOffsetFormatteroperator= (const RWTimeTupleOffsetFormatter &rhs)
 
RWTimeTupleOffsetFormatteroperator= (RWTimeTupleOffsetFormatter &&rhs)
 

Detailed Description

RWTimeTupleOffsetFormatter uses a strftime()-based format specification, however not all strftime() format specifiers are supported, and some have a different meaning than in strftime().

The format specification may contain conversion specifications and literal characters. A conversion specification consists of a leading '%' character, an optional format flag character, an optional field width, and a conversion specification character to terminate. All other characters are considered to be literals and are copied to the output directly. For example, the format string '%+6Y' uses the format flag '+', a field width of 6, and the format specification character 'Y'.

The following table shows the conversion specification characters that may be used with RWTimeTupleOffsetFormatter. In all cases, the behavior of the format function is unspecified when the input tuple is not normalized.

Conversion character Meaning
%b Replaced by the locale's abbreviated month name. Month values outside the range [1,12] result in unspecified behavior.
%B Replaced by the locale's full month name. Month values outside the range [1,12] result in unspecified behavior.
%C Replaced by the year divided by 100 and truncated to an integer, as a decimal number. Year values outside the range [INT_MIN + 1,INT_MAX] result in unspecified behavior.
%d Replaced by the day of the month as a decimal number [01,31]. Day of month values outside the range [1,31] result in unspecified behavior.
%e Replaced by the day of the month as a decimal number [1,31]; a single digit is preceded by a space. Day of month values outside the range [1,31] result in unspecified behavior.
%m Replaced by the month as a decimal number [01,12]. Month values outside the range [1,12] result in unspecified behavior.
%y Replaced by the last two digits of the year as a decimal number [00,99]. Year values outside the range [INT_MIN + 1,INT_MAX] result in unspecified behavior.
%Y Replaced by the year as a decimal number (for example, 1997). Year values outside the range [INT_MIN + 1,INT_MAX] result in unspecified behavior.
%F Replaced by the fractional seconds as a decimal number [000000000000,999999999999]. Picosecond values outside the range [0,999999999999] result in unspecified behavior.
%H Replaced by the hour (24-hour clock) as a decimal number [00,23]. Hour values outside the range [0,23] result in unspecified behavior.
%I Replaced by the hour (12-hour clock) as a decimal number [01,12]. Hour values outside the range [0,23] result in unspecified behavior.
%M Replaced by the minute as a decimal number [00,59]. Minute values outside the range [0,59] result in unspecified behavior.
%p Replaced by the locale's equivalent of either a.m. or p.m., as if a call were made to locale.asString(..., 'p') for the provided locale, or RWLocale::global() if no locale is provided.
%r Replaced by the time in a.m. and p.m. notation, as if a call were made to locale.asString(..., 'r') for the provided locale, or RWLocale::global() if no locale is provided.
%S Replaced by the second as a decimal number [00,60]. The range is up to 60 to allow for occasional leap seconds. Second values outside the range [0,60] result in unspecified behavior.
%z Replaced by the offset from UTC in the ISO 8601:2000 standard format (+hh:mm or -hh:mm). For example, -04:30 means 4 hours 30 minutes behind UTC (west of Greenwich). Offset values outside the range [-359999,359999] result in unspecified behavior.
%% Replaced by %

Not all conversions support the flag or field width specifiers. The following tables summarize the supported format options and their meanings for each format specification character that supports them.

Conversion character Flag Meaning
%C + Sign should be output for positive values, but only when the specified field width or the number of digits to represent is greater than 2. A minimum field width must be specified.
0 The output should be padded with 0 out to the minimum field width or 2, whichever is greater. A minimum field width must be specified.
<width> An unsigned integer that specifies the minimum field width, including the sign.
%Y + Sign should be output for positive values, but only when the specified field width or the number of digits to represent is greater than 4. A minimum field width must be specified.
0 The output should be padded with 0 out to the minimum field width or 2, whichever is greater. A minimum field width must be specified.
<width> An unsigned integer that specifies the minimum field width, including the sign.
%F <width> An unsigned integer that specifies the field width. If the number of digits to represent is greater than this value, the result will be truncated.

As an example, given the year 15, the full format specification "%+5Y" would produce "+0015", and "%5Y" would produce "00015".

Constructor & Destructor Documentation

RWTimeTupleOffsetFormatter::RWTimeTupleOffsetFormatter ( const RWCString format)
inline

Constructs an RWTimeTupleOffsetFormatter with the format specification format.

RWTimeTupleOffsetFormatter::RWTimeTupleOffsetFormatter ( RWCString &&  format)
inline

Constructs an RWTimeTupleOffsetFormatter with the format specification format.

Condition:
This method is available only on platforms with rvalue reference support.
RWTimeTupleOffsetFormatter::RWTimeTupleOffsetFormatter ( const RWTimeTupleOffsetFormatter rhs)
inline

Copy constructor.

RWTimeTupleOffsetFormatter::RWTimeTupleOffsetFormatter ( RWTimeTupleOffsetFormatter &&  rhs)
inline

Move constructor.

Condition:
This method is available only on platforms with rvalue reference support.
RWTimeTupleOffsetFormatter::~RWTimeTupleOffsetFormatter ( )
inline

Destructor.

Member Function Documentation

RWCString RWTimeTupleOffsetFormatter::operator() ( const RWTimeTupleOffset tt) const

Generates a string representation of tt based on the current format. For locale-specific behavior, the RWLocale returned by RWLocale::global() is used.

RWCString RWTimeTupleOffsetFormatter::operator() ( const RWTimeTupleOffset tt,
const RWLocale locale 
) const

Generates a string representation of tt based on the current format. For locale-specific behavior, locale is used.

RWTimeTupleOffsetFormatter & RWTimeTupleOffsetFormatter::operator= ( const RWTimeTupleOffsetFormatter rhs)
inline

Copy assignment operator.

RWTimeTupleOffsetFormatter & RWTimeTupleOffsetFormatter::operator= ( RWTimeTupleOffsetFormatter &&  rhs)
inline

Move assignment operator.

Condition:
This method is available only on platforms with rvalue reference support.

Copyright © 2021 Rogue Wave Software, Inc., a Perforce company. All Rights Reserved.