34#ifndef _QORE_DATETIMENODE_H
36#define _QORE_DATETIMENODE_H
38#include <qore/AbstractQoreNode.h>
39#include <qore/DateTime.h>
41class qore_date_private;
58 DLLEXPORT
virtual bool getAsBoolImpl()
const;
64 DLLEXPORT
virtual int getAsIntImpl()
const;
70 DLLEXPORT
virtual int64 getAsBigIntImpl()
const;
76 DLLEXPORT
virtual double getAsFloatImpl()
const;
103 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);
151 DLLEXPORT
DateTimeNode(
const AbstractQoreZoneInfo* zone,
const char* date);
287 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);
311 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);
333 DLLLOCAL
void*
operator new(size_t);
345 DLLLOCAL
const DateTime* operator->() {
return dt; }
346 DLLLOCAL
const DateTime* operator*() {
return dt; }
360 DLLLOCAL
void*
operator new(size_t);
399 DLLLOCAL
const DateTimeNode* operator->() {
return dt; }
The base class for all value and parse types in Qore expression trees.
Definition: AbstractQoreNode.h:57
DLLEXPORT void ref() const
increments the reference count
virtual DLLEXPORT class DateTime * getDateTimeRepresentation(bool &del) const
returns the DateTime representation of this type (default implementation: returns ZeroDate,...
DLLLOCAL qore_type_t getType() const
returns the data type
Definition: AbstractQoreNode.h:175
Holds absolute and relative date/time values in Qore with precision to the microsecond.
Definition: DateTime.h:93
Qore's parse tree/value type for date-time values, reference-counted, dynamically-allocated only.
Definition: DateTimeNode.h:45
static DLLLOCAL qore_type_t getStaticTypeCode()
returns the type code (useful in templates)
Definition: DateTimeNode.h:272
DLLEXPORT DateTimeNode(const char *date, ExceptionSink *xsink)
constructor for setting the date from a string with a flexible format, throws a Qore-language excepti...
DLLEXPORT DateTimeNode(const QoreValue v)
constructor for creating a relative date from a value representing a number of seconds
virtual DLLEXPORT AbstractQoreNode * realCopy() const
returns a copy of the object; the caller owns the reference count
DLLEXPORT DateTimeNode(const AbstractQoreZoneInfo *zone, const QoreValue v)
constructor for creating an absolute date from a value representing a number of seconds
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,...
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) ...
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...
DLLEXPORT DateTimeNode * unaryMinus() const
returns the negative time from the current time
DLLEXPORT DateTimeNode * refSelf() const
returns this with an incremented ref count
static DLLEXPORT DateTimeNode * makeRelativeFromSeconds(int64 n_second, int n_us=0)
static "constructor" to create a relative 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
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...
DLLEXPORT DateTimeNode(const AbstractQoreZoneInfo *zone, const char *date)
constructor for setting the date from a string with a flexible format
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, int ms)
constructor for setting an absolute date based on the number of seconds from January 1,...
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 DateTimeNode * subtractBy(const DateTime *dt) const
subtracts a DateTime value from the current value and returns the new value, the caller owns the poin...
DLLEXPORT DateTimeNode(const char *date)
constructor for setting the date from a string with a flexible format, silently accepts invalid date ...
virtual DLLEXPORT bool is_equal_soft(const AbstractQoreNode *v, ExceptionSink *xsink) const
tests for equality with possible type conversion (soft compare)
virtual DLLEXPORT void getStringRepresentation(QoreString &str) const
concatentates the date/time value in the format YYYYMMDDHHmmDD to an existing QoreString reference
static DLLEXPORT DateTimeNode * makeAbsolute(const AbstractQoreZoneInfo *n_zone, int n_year, int n_month, int n_day, int n_hour, int n_minute, int n_second, int n_us, ExceptionSink *xsink)
static "constructor" to create an absolute time, including microseconds, throws an exception with inv...
virtual DLLEXPORT int parseInit(QoreValue &val, QoreParseContext &parse_context)
returns the type information
virtual DLLEXPORT QoreString * getStringRepresentation(bool &del) const
returns a string in the format YYYYMMDDHHmmSS, del is set to true
DLLEXPORT DateTimeNode(hashdecl tm *tms)
constructor for setting an absolute date based on a "hashdecl tm"
static DLLEXPORT DateTimeNode * getDateFromISOWeek(int year, int week, int day, ExceptionSink *xsink)
returns a DateTimeNode value as generated from the ISO-8601 week information
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...
virtual DLLEXPORT DateTime * getDateTimeRepresentation(bool &del) const
returns "this" as a DateTime, del is set to false
DLLEXPORT DateTimeNode * copy() const
returns a copy of the DateTimeNode, the caller owns the pointer's reference count
DLLEXPORT DateTimeNode(const DateTime &dt)
constructor to set the date from a DateTime value
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
virtual DLLEXPORT const char * getTypeName() const
returns the type name as a c string
DLLEXPORT DateTimeNode(bool r=false)
constructor for an empty object
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...
DLLEXPORT DateTimeNode(int64 seconds)
constructor for setting an absolute date based on the number of seconds from January 1,...
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
static DLLLOCAL const char * getStaticTypeName()
returns the type name (useful in templates)
Definition: DateTimeNode.h:267
DLLEXPORT DateTimeNode(const DateTimeNode &dt)
copy constructor
virtual DLLEXPORT void getDateTimeRepresentation(DateTime &dt) const
assigns this date/time representation to the passed DateTime reference
virtual DLLEXPORT ~DateTimeNode()
protected destructor only called when references = 0, use deref() instead
manages calls to AbstractQoreNode::getDateTimeRepresentation() when a DateTimeNode value is required
Definition: DateTimeNode.h:353
DLLLOCAL DateTimeNodeValueHelper(const AbstractQoreNode *n, ExceptionSink *xsink)
gets the DateTimeNode value and sets the temporary flag
DLLLOCAL DateTimeNode * getReferencedValue()
returns a referenced value - the caller will own the reference
Definition: DateTimeNode.h:407
DLLLOCAL ~DateTimeNodeValueHelper()
dereferences the DateTimeNode value if necessary
Definition: DateTimeNode.h:394
DLLLOCAL DateTimeNodeValueHelper(const AbstractQoreNode *n)
gets the DateTimeNode value and sets the temporary flag
Definition: DateTimeNode.h:364
DLLEXPORT DateTimeNodeValueHelper(const QoreValue &n)
gets the DateTime value and set the delete flag
manages calls to AbstractQoreNode::getDateTimeRepresentation() when a simple DateTime value is requir...
Definition: DateTimeNode.h:326
DLLEXPORT DateTimeValueHelper(const QoreValue &n)
gets the DateTime value and set the delete flag
DLLEXPORT DateTimeValueHelper(const AbstractQoreNode *n)
gets the DateTime value and set the delete flag
DLLEXPORT ~DateTimeValueHelper()
deletes the DateTime value being managed if necessary
container for holding Qore-language exception information and also for registering a "thread_exit" ca...
Definition: ExceptionSink.h:50
Qore's string type supported by the QoreEncoding class.
Definition: QoreString.h:93
base class for simple value types
Definition: AbstractQoreNode.h:372
int16_t qore_type_t
used to identify unique Qore data and parse types (descendents of AbstractQoreNode)
Definition: common.h:70
long long int64
64bit integer type, cannot use int64_t here since it breaks the API on some 64-bit systems due to equ...
Definition: common.h:260
const qore_type_t NT_DATE
type value for DateTimeNode
Definition: node_types.h:46
The main value class in Qore, designed to be passed by value.
Definition: QoreValue.h:276