Qore's parse tree/value type for date-time values, reference-counted, dynamically-allocated only. More...
#include <DateTimeNode.h>
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 QoreString * | getStringRepresentation (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 DateTime * | getDateTimeRepresentation (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 QoreString * | getAsString (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 const char * | getTypeName () const |
returns the type name as a c string | |
DLLEXPORT DateTimeNode * | copy () const |
returns a copy of the DateTimeNode, the caller owns the pointer's reference count | |
DLLEXPORT 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 | |
DLLEXPORT 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 | |
DLLEXPORT DateTimeNode * | unaryMinus () const |
returns the negative time from the current time | |
Static Public Member Functions | |
static DLLEXPORT DateTimeNode * | getDateFromISOWeek (int year, int week, int day, ExceptionSink *xsink) |
returns a DateTimeNode value as generated from the ISO-8601 week information | |
static DLLEXPORT DateTimeNode * | makeAbsolute (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 DateTimeNode * | makeAbsolute (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 DateTimeNode * | makeAbsoluteLocal (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 DateTimeNode * | makeRelative (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 |
Qore's parse tree/value type for date-time values, reference-counted, dynamically-allocated only.
DLLEXPORT DateTimeNode::DateTimeNode | ( | bool | r = false |
) |
constructor for an empty object
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
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
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)
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]
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"
tms | a structure giving the absolute date to set |
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
DLLEXPORT DateTimeNode* DateTimeNode::copy | ( | ) | const |
returns a copy of the DateTimeNode, the caller owns the pointer's reference count
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, ...>
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 |
Implements AbstractQoreNode.
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
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 |
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
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
dt | the reference where the current date/time value will be copied |
Reimplemented from AbstractQoreNode.
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
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 |
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
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
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 |
Reimplemented from 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
v | the value to compare | |
xsink | is not used in this implementation of the function |
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
zone | time zone for the date/time value, 0 = UTC, |
seconds | the number of seconds from January 1, 1970 | |
us | the 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
zone | time zone for the date/time value, 0 = UTC, |
seconds | the number of seconds from January 1, 1970 in the time zone passed as the first argument | |
us | the 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
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