Qore Programming Language  0.8.3
Public Member Functions | Static Public Member Functions | Protected Member Functions
DateTimeNode Class Reference

Qore's parse tree/value type for date-time values, reference-counted, dynamically-allocated only. More...

#include <DateTimeNode.h>

Inheritance diagram for DateTimeNode:
SimpleValueQoreNode DateTime SimpleQoreNode AbstractQoreNode QoreReferenceCounter

List of all members.

Public Member Functions

DLLEXPORT DateTimeNode (bool r=false)
 constructor for an empty object
DLLEXPORT DateTimeNode (int n_year, int n_month, int n_day, int n_hour=0, int n_minute=0, int n_second=0, short n_ms=0, bool n_relative=false)
 constructor for setting all parameters
DLLEXPORT DateTimeNode (int64 seconds)
 constructor for setting an absolute date based on the number of seconds from January 1, 1970
DLLEXPORT DateTimeNode (int64 seconds, int ms)
 constructor for setting an absolute date based on the number of seconds from January 1, 1970 (plus milliseconds)
DLLEXPORT DateTimeNode (const char *date)
 constructor for setting the date from a string in the format YYYYMMDDHHmmSS
DLLEXPORT DateTimeNode (struct tm *tms)
 constructor for setting an absolute date based on a "struct tm"
DLLEXPORT DateTimeNode (const DateTimeNode &dt)
 copy constructor
DLLEXPORT DateTimeNode (const DateTime &dt)
 constructor to set the date from a DateTime value
virtual DLLEXPORT QoreStringgetStringRepresentation (bool &del) const
 returns a string in the format YYYYMMDDHHmmSS, del is set to true
virtual DLLEXPORT void getStringRepresentation (QoreString &str) const
 concatentates the date/time value in the format YYYYMMDDHHmmDD to an existing QoreString reference
virtual DLLEXPORT DateTimegetDateTimeRepresentation (bool &del) const
 returns "this" as a DateTime, del is set to false
virtual DLLEXPORT void getDateTimeRepresentation (DateTime &dt) const
 assigns this date/time representation to the passed DateTime reference
virtual DLLEXPORT QoreStringgetAsString (bool &del, int foff, ExceptionSink *xsink) const
 returns the date/time value as a formatted string for n and N printf formatting, del is set to true
virtual DLLEXPORT int getAsString (QoreString &str, int foff, ExceptionSink *xsink) const
 concatenates a string representation of the date/time value (designed for n and N printf formatting) to a QoreString reference
virtual DLLEXPORT class
AbstractQoreNode
realCopy () const
 returns a copy of the object; the caller owns the reference count
virtual DLLEXPORT bool is_equal_soft (const AbstractQoreNode *v, ExceptionSink *xsink) const
 tests for equality with possible type conversion (soft compare)
virtual DLLEXPORT bool is_equal_hard (const AbstractQoreNode *v, ExceptionSink *xsink) const
 tests for equality ("deep compare" including all contained values for container types) without type conversions (hard compare)
virtual DLLEXPORT const char * getTypeName () const
 returns the type name as a c string
DLLEXPORT DateTimeNodecopy () const
 returns a copy of the DateTimeNode, the caller owns the pointer's reference count
DLLEXPORT DateTimeNodeadd (const DateTime *dt) const
 adds a DateTime value to the current value and returns the new value, the caller owns the pointer's reference count
DLLEXPORT DateTimeNodesubtractBy (const DateTime *dt) const
 subtracts a DateTime value from the current value and returns the new value, the caller owns the pointer's reference count
DLLEXPORT DateTimeNodeunaryMinus () const
 returns the negative time from the current time

Static Public Member Functions

static DLLEXPORT DateTimeNodegetDateFromISOWeek (int year, int week, int day, ExceptionSink *xsink)
 returns a DateTimeNode value as generated from the ISO-8601 week information
static DLLEXPORT DateTimeNodemakeAbsolute (const AbstractQoreZoneInfo *n_zone, int n_year, int n_month, int n_day, int n_hour=0, int n_minute=0, int n_second=0, int n_us=0)
 static "constructor" to create an absolute time, including microseconds
static DLLEXPORT DateTimeNodemakeAbsolute (const AbstractQoreZoneInfo *zone, int64 seconds, int us=0)
 static "constructor" to create an absolute time as an offset from the epoch, including microseconds
static DLLEXPORT DateTimeNodemakeAbsoluteLocal (const AbstractQoreZoneInfo *zone, int64 seconds, int us=0)
 static "constructor" to create an absolute time as an offset from the given time zone's epoch, including microseconds
static DLLEXPORT DateTimeNodemakeRelative (int n_year, int n_month, int n_day, int n_hour=0, int n_minute=0, int n_second=0, int n_us=0)
 static "constructor" to create a relative time, including microseconds

Protected Member Functions

virtual DLLEXPORT ~DateTimeNode ()
 protected destructor only called when references = 0, use deref() instead

Detailed Description

Qore's parse tree/value type for date-time values, reference-counted, dynamically-allocated only.


Constructor & Destructor Documentation

DLLEXPORT DateTimeNode::DateTimeNode ( bool  r = false)

constructor for an empty object

Parameters:
rsets the "relative" flag for the object
DLLEXPORT DateTimeNode::DateTimeNode ( int  n_year,
int  n_month,
int  n_day,
int  n_hour = 0,
int  n_minute = 0,
int  n_second = 0,
short  n_ms = 0,
bool  n_relative = false 
)

constructor for setting all parameters

Parameters:
n_yearthe year value
n_monththe months value
n_daythe days value
n_hourthe hours value
n_minutethe minutes value
n_secondthe seconds value
n_msthe milliseconds value
n_relativethe relative flag
DLLEXPORT DateTimeNode::DateTimeNode ( int64  seconds)

constructor for setting an absolute date based on the number of seconds from January 1, 1970

Parameters:
secondsthe number of seconds from January 1, 1970
DLLEXPORT DateTimeNode::DateTimeNode ( int64  seconds,
int  ms 
)

constructor for setting an absolute date based on the number of seconds from January 1, 1970 (plus milliseconds)

Parameters:
secondsthe number of seconds from January 1, 1970
msthe milliseconds portion of the time
DLLEXPORT DateTimeNode::DateTimeNode ( const char *  date)

constructor for setting the date from a string in the format YYYYMMDDHHmmSS

additionally a milliseconds value can be appended with a period and 3 integers in the format [.xxx]

Parameters:
datethe string to use to set the date in the format YYYYMMDDHHmmSS[.xxx]
DLLEXPORT DateTimeNode::DateTimeNode ( struct tm *  tms)

constructor for setting an absolute date based on a "struct tm"

Parameters:
tmsa structure giving the absolute date to set

Member Function Documentation

DLLEXPORT DateTimeNode* DateTimeNode::add ( const DateTime dt) const

adds a DateTime value to the current value and returns the new value, the caller owns the pointer's reference count

Returns:
a new DateTimeNode value, the caller owns the pointer's reference count

Reimplemented from DateTime.

DLLEXPORT DateTimeNode* DateTimeNode::copy ( ) const

returns a copy of the DateTimeNode, the caller owns the pointer's reference count

Returns:
a copy of the DateTimeNode, the caller owns the pointer's reference count
virtual DLLEXPORT QoreString* DateTimeNode::getAsString ( bool &  del,
int  foff,
ExceptionSink xsink 
) const [virtual]

returns the date/time value as a formatted string for n and N printf formatting, del is set to true

the format for absolute date/time value is: YYYY-MM-DD HH:mm:SS the format for relative date/time values is: <time: x years, x months, ...> NOTE: do not use this function directly, use QoreStringValueHelper instead

Parameters:
deloutput parameter: always set to true by this function, meaning that the caller owns the QoreString pointer returned (and must delete it manually)
foffignored for this implementation of the file
xsinkignored for this implementation of the file
Returns:
a QoreString pointer, use the del output parameter to determine ownership of the pointer
See also:
QoreStringValueHelper

Implements AbstractQoreNode.

virtual DLLEXPORT int DateTimeNode::getAsString ( QoreString str,
int  foff,
ExceptionSink xsink 
) const [virtual]

concatenates a string representation of the date/time value (designed for n and N printf formatting) to a QoreString reference

the format for absolute date/time value is: YYYY-MM-DD HH:mm:SS the format for relative date/time values is: <time: x years, x months, ...>

Parameters:
strthe QoreString reference to concatenate the date/time value to
foffignored for this implementation of the file
xsinkignored for this implementation of the file
See also:
QoreNodeAsStringHelper

Implements AbstractQoreNode.

static DLLEXPORT DateTimeNode* DateTimeNode::getDateFromISOWeek ( int  year,
int  week,
int  day,
ExceptionSink xsink 
) [static]

returns a DateTimeNode value as generated from the ISO-8601 week information

NOTE: ISO-8601 week days go from 1 - 7 = Mon - Sun, a 0 return value means an exception was raised in the case the ISO-8601 week information is invalid

Parameters:
yearthe ISO-8601 year (may differ from the actual calendar year)
weekthe ISO-8601 week number in the year
daythe ISO-8601 day number (1=Mon, 7=Sun)
xsinkif an error occurs, the Qore-language exception information will be added here

Reimplemented from DateTime.

virtual DLLEXPORT DateTime* DateTimeNode::getDateTimeRepresentation ( bool &  del) const [virtual]

returns "this" as a DateTime, del is set to false

NOTE: Use the DateTimeValueHelper class instead of using this function directly

Parameters:
deloutput parameter: if del is true, then the returned DateTime pointer belongs to the caller (and must be deleted manually), if false, then it must not be
See also:
DateTimeValueHelper

Reimplemented from AbstractQoreNode.

virtual DLLEXPORT void DateTimeNode::getDateTimeRepresentation ( DateTime dt) const [virtual]

assigns this date/time representation to the passed DateTime reference

Parameters:
dtthe reference where the current date/time value will be copied

Reimplemented from AbstractQoreNode.

virtual DLLEXPORT QoreString* DateTimeNode::getStringRepresentation ( bool &  del) const [virtual]

returns a string in the format YYYYMMDDHHmmSS, del is set to true

NOTE: do not use this function directly, use QoreStringValueHelper instead

Parameters:
deloutput parameter: if del is true, then the resulting QoreString pointer belongs to the caller (and must be deleted manually), if false it must not be
Returns:
a QoreString pointer, use the del output parameter to determine ownership of the pointer
See also:
QoreStringValueHelper

Reimplemented from AbstractQoreNode.

virtual DLLEXPORT void DateTimeNode::getStringRepresentation ( QoreString str) const [virtual]

concatentates the date/time value in the format YYYYMMDDHHmmDD to an existing QoreString reference

Parameters:
stra reference to a QoreString where date/time value will be concatenated in the format YYYYMMDDHHmmDD

Reimplemented from AbstractQoreNode.

virtual DLLEXPORT bool DateTimeNode::is_equal_hard ( const AbstractQoreNode v,
ExceptionSink xsink 
) const [virtual]

tests for equality ("deep compare" including all contained values for container types) without type conversions (hard compare)

Parameters:
vthe value to compare
xsinkif an error occurs, the Qore-language exception information will be added here
Returns:
true if the objects are equal, false if not

Implements AbstractQoreNode.

virtual DLLEXPORT bool DateTimeNode::is_equal_soft ( const AbstractQoreNode v,
ExceptionSink xsink 
) const [virtual]

tests for equality with possible type conversion (soft compare)

this function does not throw any Qore-language exceptions

Parameters:
vthe value to compare
xsinkis not used in this implementation of the function

Implements AbstractQoreNode.

static DLLEXPORT DateTimeNode* DateTimeNode::makeAbsolute ( const AbstractQoreZoneInfo *  zone,
int64  seconds,
int  us = 0 
) [static]

static "constructor" to create an absolute time as an offset from the epoch, including microseconds

Parameters:
zonetime zone for the date/time value, 0 = UTC,
See also:
currentTZ()
Parameters:
secondsthe number of seconds from January 1, 1970
usthe microseconds portion of the time

Reimplemented from DateTime.

static DLLEXPORT DateTimeNode* DateTimeNode::makeAbsoluteLocal ( const AbstractQoreZoneInfo *  zone,
int64  seconds,
int  us = 0 
) [static]

static "constructor" to create an absolute time as an offset from the given time zone's epoch, including microseconds

Parameters:
zonetime zone for the date/time value, 0 = UTC,
See also:
currentTZ()
Parameters:
secondsthe number of seconds from January 1, 1970 in the time zone passed as the first argument
usthe microseconds portion of the time

Reimplemented from DateTime.

virtual DLLEXPORT class AbstractQoreNode* DateTimeNode::realCopy ( ) const [virtual]

returns a copy of the object; the caller owns the reference count

Returns:
a copy of the object; the caller owns the reference count

Implements AbstractQoreNode.

DLLEXPORT DateTimeNode* DateTimeNode::subtractBy ( const DateTime dt) const

subtracts a DateTime value from the current value and returns the new value, the caller owns the pointer's reference count

Returns:
a new DateTimeNode value, the caller owns the pointer's reference count

Reimplemented from DateTime.


The documentation for this class was generated from the following file:
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Defines