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;
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);
264 DLLEXPORT
virtual void parseInit(
QoreValue& val, LocalVar* oflag,
int pflag,
int& lvids,
const QoreTypeInfo*& typeInfo);
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);
292 DLLEXPORT
static 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);
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);
373 dt = const_cast<DateTimeNode*>(reinterpret_cast<const DateTimeNode*>(n));
399 DLLLOCAL
const DateTimeNode* operator->() {
return dt; }
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 qore_type_t getType() const
returns the data type
Definition: AbstractQoreNode.h:172
DLLEXPORT DateTimeNode * unaryMinus() const
returns the negative time from the current time
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:54
static DLLEXPORT DateTimeNode * makeRelativeFromSeconds(int64 n_second, int n_us=0)
static "constructor" to create a relative time, including microseconds
virtual DLLEXPORT DateTime * getDateTimeRepresentation(bool &del) const
returns "this" as a DateTime, del is set to false
DLLLOCAL ~DateTimeNodeValueHelper()
dereferences the DateTimeNode value if necessary
Definition: DateTimeNode.h:394
const qore_type_t NT_DATE
type value for DateTimeNode
Definition: node_types.h:46
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...
static DLLLOCAL const char * getStaticTypeName()
returns the type name (useful in templates)
Definition: DateTimeNode.h:267
virtual DLLEXPORT ~DateTimeNode()
protected destructor only called when references = 0, use deref() instead
Qore's string type supported by the QoreEncoding class.
Definition: QoreString.h:81
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
static DLLLOCAL qore_type_t getStaticTypeCode()
returns the type code (useful in templates)
Definition: DateTimeNode.h:272
manages calls to AbstractQoreNode::getDateTimeRepresentation() when a simple DateTime value is requir...
Definition: DateTimeNode.h:326
DLLEXPORT DateTimeNode * copy() const
returns a copy of the DateTimeNode, the caller owns the pointer's reference count
Qore's parse tree/value type for date-time values, reference-counted, dynamically-allocated only.
Definition: DateTimeNode.h:45
The main value class in Qore, designed to be passed by value.
Definition: QoreValue.h:262
virtual DLLEXPORT class DateTime * getDateTimeRepresentation(bool &del) const
returns the DateTime representation of this type (default implementation: returns ZeroDate,...
container for holding Qore-language exception information and also for registering a "thread_exit" ca...
Definition: ExceptionSink.h:46
DLLEXPORT DateTimeNode * refSelf() const
returns this with an incremented ref count
virtual DLLEXPORT bool is_equal_soft(const AbstractQoreNode *v, ExceptionSink *xsink) const
tests for equality with possible type conversion (soft compare)
DLLEXPORT ~DateTimeValueHelper()
deletes the DateTime value being managed if necessary
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
virtual DLLEXPORT QoreString * getStringRepresentation(bool &del) const
returns a string in the format YYYYMMDDHHmmSS, del is set to true
DLLEXPORT void ref() const
increments the reference count
manages calls to AbstractQoreNode::getDateTimeRepresentation() when a DateTimeNode value is required
Definition: DateTimeNode.h:353
DLLLOCAL DateTimeNode * getReferencedValue()
returns a referenced value - the caller will own the reference
Definition: DateTimeNode.h:407
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,...
int16_t qore_type_t
used to identify unique Qore data and parse types (descendents of AbstractQoreNode)
Definition: common.h:70
static DLLEXPORT DateTimeNode * getDateFromISOWeek(int year, int week, int day, ExceptionSink *xsink)
returns a DateTimeNode value as generated from the ISO-8601 week information
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 void parseInit(QoreValue &val, LocalVar *oflag, int pflag, int &lvids, const QoreTypeInfo *&typeInfo)
returns the type information
base class for simple value types
Definition: AbstractQoreNode.h:366
virtual DLLEXPORT AbstractQoreNode * realCopy() const
returns a copy of the object; the caller owns the reference count
virtual DLLEXPORT const char * getTypeName() const
returns the type name as a c string
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...
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