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 class 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, class 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, class 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 class 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 class DateTime *dt) const
 subtracts a DateTime value from the current value and returns the new value, the caller owns the pointer's reference count

Static Public Member Functions

static DLLEXPORT DateTimeNodegetDateFromISOWeek (int year, int week, int day, class ExceptionSink *xsink)
 returns a DateTimeNode value as generated from the ISO-8601 week information

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:
r sets 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_year the year value
n_month the months value
n_day the days value
n_hour the hours value
n_minute the minutes value
n_second the seconds value
n_ms the milliseconds value
n_relative the relative flag

DLLEXPORT DateTimeNode::DateTimeNode ( int64  seconds  ) 

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

Parameters:
seconds the 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:
seconds the number of seconds from January 1, 1970
ms the 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:
date the 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:
tms a structure giving the absolute date to set


Member Function Documentation

DLLEXPORT DateTimeNode* DateTimeNode::add ( const class 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 int DateTimeNode::getAsString ( QoreString str,
int  foff,
class 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:
str the QoreString reference to concatenate the date/time value to
foff ignored for this implementation of the file
xsink ignored for this implementation of the file
See also:
QoreNodeAsStringHelper

Implements AbstractQoreNode.

virtual DLLEXPORT QoreString* DateTimeNode::getAsString ( bool &  del,
int  foff,
class 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:
del output parameter: always set to true by this function, meaning that the caller owns the QoreString pointer returned (and must delete it manually)
foff ignored for this implementation of the file
xsink ignored 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.

static DLLEXPORT DateTimeNode* DateTimeNode::getDateFromISOWeek ( int  year,
int  week,
int  day,
class 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:
year the ISO-8601 year (may differ from the actual calendar year)
week the ISO-8601 week number in the year
day the ISO-8601 day number (1=Mon, 7=Sun)
xsink if an error occurs, the Qore-language exception information will be added here

Reimplemented from DateTime.

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

assigns this date/time representation to the passed DateTime reference

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

Reimplemented from AbstractQoreNode.

virtual DLLEXPORT class 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:
del output 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::getStringRepresentation ( QoreString str  )  const [virtual]

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

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

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:
del output 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 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:
v the value to compare
xsink if 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:
v the value to compare
xsink is not used in this implementation of the function

Implements AbstractQoreNode.

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 class 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:

doxygen