34 #ifndef _QORE_DATETIMENODE_H
36 #define _QORE_DATETIMENODE_H
38 #include <qore/AbstractQoreNode.h>
39 #include <qore/DateTime.h>
41 class qore_date_private;
50 DLLLOCAL DateTimeNode& operator=(
const DateTimeNode &);
57 DLLEXPORT
virtual bool getAsBoolImpl()
const;
63 DLLEXPORT
virtual int getAsIntImpl()
const;
69 DLLEXPORT
virtual int64 getAsBigIntImpl()
const;
75 DLLEXPORT
virtual double getAsFloatImpl()
const;
78 DLLLOCAL DateTimeNode(qore_date_private *n_priv);
89 DLLEXPORT DateTimeNode(
bool r =
false);
102 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);
108 DLLEXPORT DateTimeNode(int64 seconds);
115 DLLEXPORT DateTimeNode(int64 seconds,
int ms);
120 DLLEXPORT DateTimeNode(
const char *date);
126 DLLEXPORT DateTimeNode(
const AbstractQoreZoneInfo *zone,
const char *date);
132 DLLEXPORT DateTimeNode(
struct tm *tms);
135 DLLEXPORT DateTimeNode(
const DateTimeNode &dt);
138 DLLEXPORT DateTimeNode(
const DateTime &dt);
206 DLLEXPORT DateTimeNode *
copy()
const;
212 DLLEXPORT DateTimeNode *
add(
const DateTime *dt)
const;
244 DLLEXPORT
static 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);
252 DLLEXPORT
static DateTimeNode *
makeAbsolute(
const AbstractQoreZoneInfo *zone, int64 seconds,
int us = 0);
260 DLLEXPORT
static DateTimeNode *
makeAbsoluteLocal(
const AbstractQoreZoneInfo *zone, int64 seconds,
int us = 0);
263 DLLEXPORT
static 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);
280 DLLLOCAL DateTimeValueHelper& operator=(
const DateTimeValueHelper&);
281 DLLLOCAL
void *
operator new(size_t);
306 DLLLOCAL
const DateTime *operator->() {
return dt; }
307 DLLLOCAL
const DateTime *operator*() {
return dt; }
320 DLLLOCAL DateTimeNodeValueHelper& operator=(
const DateTimeNodeValueHelper&);
321 DLLLOCAL
void *
operator new(size_t);
350 DLLLOCAL
const DateTimeNode *operator->() {
return dt; }
DLLLOCAL DateTimeNodeValueHelper(const AbstractQoreNode *n)
gets the DateTimeNode value and sets the temporary flag
Definition: DateTimeNode.h:325
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
DLLLOCAL DateTimeValueHelper(const AbstractQoreNode *n)
gets the DateTime value and set the delete flag
Definition: DateTimeNode.h:285
DLLEXPORT DateTimeNode * unaryMinus() const
returns the negative time from the current time
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 c...
Holds absolute and relative date/time values in Qore with precision to the microsecond.
Definition: DateTime.h:93
The base class for all value and parse types in Qore expression trees.
Definition: AbstractQoreNode.h:55
DLLLOCAL ~DateTimeNodeValueHelper()
dereferences the DateTimeNode value if necessary
Definition: DateTimeNode.h:345
const qore_type_t NT_DATE
type value for DateTimeNode
Definition: node_types.h:46
virtual DLLEXPORT class DateTime * getDateTimeRepresentation(bool &del) const
returns the DateTime representation of this type (default implementation: returns ZeroDate...
static DLLLOCAL const char * getStaticTypeName()
returns the type name (useful in templates)
Definition: DateTimeNode.h:224
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 r...
virtual DLLEXPORT ~DateTimeNode()
protected destructor only called when references = 0, use deref() instead
DLLEXPORT DateTimeNode * subtractBy(const DateTime *dt) const
subtracts a DateTime value from the current value and returns the new value, the caller owns the poin...
signed short qore_type_t
used to identify unique Qore data and parse types (descendents of AbstractQoreNode) ...
Definition: common.h:67
Qore's string type supported by the QoreEncoding class.
Definition: QoreString.h:50
static DLLLOCAL qore_type_t getStaticTypeCode()
returns the type code (useful in templates)
Definition: DateTimeNode.h:229
virtual DLLEXPORT class AbstractQoreNode * realCopy() const
returns a copy of the object; the caller owns the reference count
manages calls to AbstractQoreNode::getDateTimeRepresentation() when a simple DateTime value is requir...
Definition: DateTimeNode.h:274
Qore's parse tree/value type for date-time values, reference-counted, dynamically-allocated only...
Definition: DateTimeNode.h:44
virtual DLLEXPORT const char * getTypeName() const
returns the type name as a c string
virtual DLLEXPORT DateTime * getDateTimeRepresentation(bool &del) const
returns "this" as a DateTime, del is set to false
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 ...
DLLEXPORT void ref() const
increments the reference count
container for holding Qore-language exception information and also for registering a "thread_exit" ca...
Definition: ExceptionSink.h:43
virtual DLLEXPORT QoreString * getStringRepresentation(bool &del) const
returns a string in the format YYYYMMDDHHmmSS, del is set to true
manages calls to AbstractQoreNode::getDateTimeRepresentation() when a DateTimeNode value is required ...
Definition: DateTimeNode.h:314
DLLLOCAL qore_type_t getType() const
returns the data type
Definition: AbstractQoreNode.h:294
DLLLOCAL DateTimeNode * getReferencedValue()
returns a referenced value - the caller will own the reference
Definition: DateTimeNode.h:358
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...
static DLLEXPORT DateTimeNode * getDateFromISOWeek(int year, int week, int day, ExceptionSink *xsink)
returns a DateTimeNode value as generated from the ISO-8601 week information
base class for simple value types
Definition: AbstractQoreNode.h:425
DLLEXPORT DateTimeNode * copy() const
returns a copy of the DateTimeNode, the caller owns the pointer's reference count ...
DLLLOCAL ~DateTimeValueHelper()
deletes the DateTime value being managed if necessary
Definition: DateTimeNode.h:302
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