NCBI C++ ToolKit
Public Types | Public Member Functions | Static Public Member Functions | Private Attributes
CTimeFormat Class Reference

Search Toolkit Book for CTimeFormat

CTimeFormat --. More...

#include <ncbitime.hpp>

List of all members.

Public Types

enum  EFlags {
  fFormat_Simple = (1 << 0), fFormat_Ncbi = (1 << 1), fMatch_Strict = (1 << 5), fMatch_ShortTime = (1 << 6),
  fMatch_ShortFormat = (1 << 7), fMatch_Weak = fMatch_ShortFormat | fMatch_ShortTime, fDefault = fFormat_Simple | fMatch_Strict, eNcbiSimple = fFormat_Simple,
  eNcbi = fFormat_Ncbi, eDefault = fDefault
}
 Flags. More...
enum  EPredefined {
  eISO8601_Year = 0, eISO8601_YearMonth = 1, eISO8601_Date = 2, eISO8601_DateTimeMin = 3,
  eISO8601_DateTimeSec = 4, eISO8601_DateTimeFrac = 5
}
 Predefined formats. More...
typedef unsigned int TFlags
 Binary OR of "EFlags".

Public Member Functions

 CTimeFormat (void)
 Default constructor.
 CTimeFormat (const CTimeFormat &format)
 Copy constructor.
 CTimeFormat (const char *fmt, TFlags flags=fDefault)
 Constructor.
 CTimeFormat (const string &fmt, TFlags flags=fDefault)
 Constructor.
CTimeFormatoperator= (const CTimeFormat &format)
 Assignment operator.
void SetFormat (const char *fmt, TFlags flags=fDefault)
 Set the current time format.
void SetFormat (const string &fmt, TFlags flags=fDefault)
 Set the current time format.
const string & GetString (void) const
 Get format string.
TFlags GetFlags (void) const
 Get format flags.
bool IsEmpty (void) const
 Check that format string is empty.
NCBI_DEPRECATED operator string (void) const
 Return time format as string.

Static Public Member Functions

static CTimeFormat GetPredefined (EPredefined fmt, TFlags flags=fDefault)
 Get predefined format.

Private Attributes

string m_Str
 String format.
TFlags m_Flags
 Format flags.

Detailed Description

CTimeFormat --.

Defines a storage class for time format.

See CTime::SetFormat and CTimeSpan::SetFormat for description of format symbols for specific class.

Definition at line 118 of file ncbitime.hpp.


Member Typedef Documentation

typedef unsigned int CTimeFormat::TFlags

Binary OR of "EFlags".

Definition at line 149 of file ncbitime.hpp.


Member Enumeration Documentation

Flags.

See also:
SetFormat, AsString
Enumerator:
fFormat_Simple 

Use single characters as format symbols.

fFormat_Ncbi 

Specify that each format symbol have a preceding symbol '$'.

This can be useful if you want to include to format string a characters that are a format symbols. To include symbol '$' use '$$'.

fMatch_Strict 

A time string should strictly match the format string.

eg "Y" and "1997"

fMatch_ShortTime 

A format string can have extra leading format symbols, that do not have matching symbols in the time string.

Corresponding time components will be initialized by default in the time object. eg "Y/M/D h:m:s" and "1997"

fMatch_ShortFormat 

eg "Y" and "1997/07/16"

fMatch_Weak 
fDefault 

Default flags.

eNcbiSimple 

"Enums", used for backward compatibility. Please use flags instead.

eNcbi 
eDefault 

Definition at line 124 of file ncbitime.hpp.

Predefined formats.

See also:
GetPredefined, CTime::SetFormat
Enumerator:
eISO8601_Year 

Y (eg 1997)

eISO8601_YearMonth 

Y-M (eg 1997-07)

eISO8601_Date 

Y-M-D (eg 1997-07-16)

eISO8601_DateTimeMin 

Y-M-DTh:m (eg 1997-07-16T19:20)

eISO8601_DateTimeSec 

Y-M-DTh:m:s (eg 1997-07-16T19:20:30)

eISO8601_DateTimeFrac 

Y-M-DTh:m:s.l(eg 1997-07-16T19:20:30.123)

Definition at line 154 of file ncbitime.hpp.


Constructor & Destructor Documentation

CTimeFormat::CTimeFormat ( void  )

Default constructor.

Definition at line 283 of file ncbitime.cpp.

Referenced by GetPredefined().

CTimeFormat::CTimeFormat ( const CTimeFormat format)

Copy constructor.

Definition at line 290 of file ncbitime.cpp.

References format.

CTimeFormat::CTimeFormat ( const char *  fmt,
TFlags  flags = fDefault 
)

Constructor.

See also:
SetFormat

Definition at line 296 of file ncbitime.cpp.

References SetFormat().

CTimeFormat::CTimeFormat ( const string &  fmt,
TFlags  flags = fDefault 
)

Constructor.

See also:
SetFormat

Definition at line 302 of file ncbitime.cpp.

References SetFormat().


Member Function Documentation

CTimeFormat::TFlags CTimeFormat::GetFlags ( void  ) const [inline]

Get format flags.

Returns:
A flags specifying how to match a time string against format string.
See also:
SetFormat, GetString

Definition at line 1973 of file ncbitime.hpp.

Referenced by CTime::AsString(), CTimeSpan::AsString(), CTime::x_Init(), and CTimeSpan::x_Init().

CTimeFormat CTimeFormat::GetPredefined ( EPredefined  fmt,
TFlags  flags = fDefault 
) [static]

Get predefined format.

Parameters:
fmtString of letters describing the time format.
fmt_typeSpecify type of the format string.
Returns:
A time format object.
See also:
EPredefined, SetFormat

Definition at line 319 of file ncbitime.cpp.

References CTimeFormat(), and fFormat_Ncbi.

Referenced by FormatTime(), CProjectService::LoadSettings(), CFileLoadManager::LoadSettings(), CProjectService::SaveSettings(), CFileLoadManager::SaveSettings(), and IBISInteraction::ToAlignAnnot().

const string & CTimeFormat::GetString ( void  ) const [inline]

Get format string.

Returns:
A string of letters describing the time format.
See also:
SetFormat, GetFlags

Definition at line 1967 of file ncbitime.hpp.

Referenced by CTime::AsString(), CTimeSpan::AsString(), FormatTime(), CTime::x_Init(), and CTimeSpan::x_Init().

bool CTimeFormat::IsEmpty ( void  ) const [inline]

Check that format string is empty.

Definition at line 1979 of file ncbitime.hpp.

Referenced by CTime::AsString(), CTimeSpan::AsString(), CStopWatch::AsString(), CTime::CTime(), and CTimeSpan::CTimeSpan().

CTimeFormat::operator string ( void  ) const [inline]

Return time format as string.

Note: This method added temporarely, and will be deleted soon.

Definition at line 1985 of file ncbitime.hpp.

CTimeFormat & CTimeFormat::operator= ( const CTimeFormat format)

Assignment operator.

Definition at line 308 of file ncbitime.cpp.

References m_Flags, and m_Str.

void CTimeFormat::SetFormat ( const char *  fmt,
TFlags  flags = fDefault 
) [inline]

Set the current time format.

Parameters:
fmtString of letters describing the time format.
flagsFlags specifying how to match a time string against format string.
See also:
GetFormat, EFormat

Definition at line 1960 of file ncbitime.hpp.

Referenced by CEventViewModel::CEventViewModel(), CTaskViewModel::CTaskViewModel(), CTimeFormat(), CTime::GetFormat(), CTimeSpan::GetFormat(), and CStopWatch::GetFormat().

void CTimeFormat::SetFormat ( const string &  fmt,
TFlags  flags = fDefault 
) [inline]

Set the current time format.

Parameters:
fmtString of letters describing the time format.
flagsFlags specifying how to match a time string against format string.
See also:
GetFormat, EFormat

Definition at line 1953 of file ncbitime.hpp.


Member Data Documentation

Format flags.

Definition at line 238 of file ncbitime.hpp.

Referenced by operator=().

string CTimeFormat::m_Str [private]

String format.

Definition at line 237 of file ncbitime.hpp.

Referenced by operator=().


The documentation for this class was generated from the following files:
Modified on Wed May 23 13:22:41 2012 by modify_doxy.py rev. 337098