C++/Tree Mapping Runtime Library
List of all members
duration< C, B > Class Template Reference

Class corresponding to the XML Schema duration built-in type. More...

#include <date-time.hxx>

Inheritance diagram for duration< C, B >:

Constructors

 duration (bool negative, unsigned int years, unsigned int months, unsigned int days, unsigned int hours, unsigned int minutes, double seconds)
 Initialize a potentially negative instance with the years, months, days, hours, minutes, and seconds components.
 
 duration (const duration &x, flags f=0, container *c=0)
 Copy constructor.
 
virtual duration_clone (flags f=0, container *c=0) const
 Copy the instance polymorphically.
 
template<typename S >
 duration (istream< S > &s, flags f=0, container *c=0)
 Create an instance from a data representation stream.
 
 duration (const xercesc::DOMElement &e, flags f=0, container *c=0)
 Create an instance from a DOM element.
 
 duration (const xercesc::DOMAttr &a, flags f=0, container *c=0)
 Create an instance from a DOM Attribute.
 
 duration (const std::basic_string< C > &s, const xercesc::DOMElement *e, flags f=0, container *c=0)
 Create an instance from a string fragment.
 
bool negative () const
 Determine if duration is negative.
 
void negative (bool n)
 Change duration sign.
 
unsigned int years () const
 Get the years component.
 
void years (unsigned int y)
 Set the years component.
 
unsigned int months () const
 Get the months component.
 
void months (unsigned int m)
 Set the months component.
 
unsigned int days () const
 Get the days component.
 
void days (unsigned int d)
 Set the days component.
 
unsigned int hours () const
 Get the hours component.
 
void hours (unsigned int h)
 Set the hours component.
 
unsigned int minutes () const
 Get the minutes component.
 
void minutes (unsigned int m)
 Set the minutes component.
 
double seconds () const
 Get the seconds component.
 
void seconds (double s)
 Set the seconds component.
 

Detailed Description

template<typename C, typename B>
class xsd::cxx::tree::duration< C, B >

Class corresponding to the XML Schema duration built-in type.

The duration class represents a potentially negative duration in the form of years, months, days, hours, minutes, and seconds.

Constructor & Destructor Documentation

◆ duration() [1/6]

template<typename C , typename B >
duration ( bool  negative,
unsigned int  years,
unsigned int  months,
unsigned int  days,
unsigned int  hours,
unsigned int  minutes,
double  seconds 
)

Initialize a potentially negative instance with the years, months, days, hours, minutes, and seconds components.

Parameters
negativeA boolean value indicating whether the duration is negative (true) or positive (false).
yearsThe years component.
monthsThe months component.
daysThe days component.
hoursThe hours component.
minutesThe minutes component.
secondsThe seconds component.

◆ duration() [2/6]

template<typename C , typename B >
duration ( const duration< C, B > &  x,
flags  f = 0,
container c = 0 
)

Copy constructor.

Parameters
xAn instance to make a copy of.
fFlags to create the copy with.
cA pointer to the object that will contain the copy.

For polymorphic object models use the _clone function instead.

◆ duration() [3/6]

template<typename C , typename B >
template<typename S >
duration ( istream< S > &  s,
flags  f = 0,
container c = 0 
)

Create an instance from a data representation stream.

Parameters
sA stream to extract the data from.
fFlags to create the new instance with.
cA pointer to the object that will contain the new instance.

◆ duration() [4/6]

template<typename C , typename B >
duration ( const xercesc::DOMElement &  e,
flags  f = 0,
container c = 0 
)

Create an instance from a DOM element.

Parameters
eA DOM element to extract the data from.
fFlags to create the new instance with.
cA pointer to the object that will contain the new instance.

◆ duration() [5/6]

template<typename C , typename B >
duration ( const xercesc::DOMAttr &  a,
flags  f = 0,
container c = 0 
)

Create an instance from a DOM Attribute.

Parameters
aA DOM attribute to extract the data from.
fFlags to create the new instance with.
cA pointer to the object that will contain the new instance.

◆ duration() [6/6]

template<typename C , typename B >
duration ( const std::basic_string< C > &  s,
const xercesc::DOMElement *  e,
flags  f = 0,
container c = 0 
)

Create an instance from a string fragment.

Parameters
sA string fragment to extract the data from.
eA pointer to DOM element containing the string fragment.
fFlags to create the new instance with.
cA pointer to the object that will contain the new instance.

Member Function Documentation

◆ _clone()

template<typename C , typename B >
virtual duration * _clone ( flags  f = 0,
container c = 0 
) const
virtual

Copy the instance polymorphically.

Parameters
fFlags to create the copy with.
cA pointer to the object that will contain the copy.
Returns
A pointer to the dynamically allocated copy.

This function ensures that the dynamic type of the instance is used for copying and should be used for polymorphic object models instead of the copy constructor.

◆ negative() [1/2]

template<typename C , typename B >
bool negative ( ) const

Determine if duration is negative.

Returns
True if duration is negative, false otherwise.

◆ negative() [2/2]

template<typename C , typename B >
void negative ( bool  n)

Change duration sign.

Parameters
nA boolean value indicating whether duration is negative (true) or positive (false).

◆ years() [1/2]

template<typename C , typename B >
unsigned int years ( ) const

Get the years component.

Returns
The years component.

◆ years() [2/2]

template<typename C , typename B >
void years ( unsigned int  y)

Set the years component.

Parameters
yThe new years component.

◆ months() [1/2]

template<typename C , typename B >
unsigned int months ( ) const

Get the months component.

Returns
The months component.

◆ months() [2/2]

template<typename C , typename B >
void months ( unsigned int  m)

Set the months component.

Parameters
mThe new months component.

◆ days() [1/2]

template<typename C , typename B >
unsigned int days ( ) const

Get the days component.

Returns
The days component.

◆ days() [2/2]

template<typename C , typename B >
void days ( unsigned int  d)

Set the days component.

Parameters
dThe new days component.

◆ hours() [1/2]

template<typename C , typename B >
unsigned int hours ( ) const

Get the hours component.

Returns
The hours component.

◆ hours() [2/2]

template<typename C , typename B >
void hours ( unsigned int  h)

Set the hours component.

Parameters
hThe new hours component.

◆ minutes() [1/2]

template<typename C , typename B >
unsigned int minutes ( ) const

Get the minutes component.

Returns
The minutes component.

◆ minutes() [2/2]

template<typename C , typename B >
void minutes ( unsigned int  m)

Set the minutes component.

Parameters
mThe new minutes component.

◆ seconds() [1/2]

template<typename C , typename B >
double seconds ( ) const

Get the seconds component.

Returns
The seconds component.

◆ seconds() [2/2]

template<typename C , typename B >
void seconds ( double  s)

Set the seconds component.

Parameters
sThe new seconds component.

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

Copyright © 2005-2023 Code Synthesis.