/* * Copyright (c) 2001, DecisionSoft Limited All rights reserved. * Please see LICENSE.TXT for more information. */ #ifndef _ATDATETIMEORDERIVEDIMPL_HPP #define _ATDATETIMEORDERIVEDIMPL_HPP #include #include #include class Timezone; class ATDecimalOrDerived; class ATDurationOrDerived; class XPath2MemoryManager; class DynamicContext; class PATHAN_EXPORT ATDateTimeOrDerivedImpl : public ATDateTimeOrDerived { public: /* constructor */ ATDateTimeOrDerivedImpl(const XMLCh* typeURI, const XMLCh* typeName, const XMLCh* value, XPath2MemoryManager* memMgr, const DynamicContext* context); /* Get the name of the primitive type (basic type) of this type * (ie "decimal" for xs:decimal) */ virtual const XMLCh* getPrimitiveTypeName() const; /* Get the namespace URI for this type */ virtual const XMLCh* getTypeURI() const; /* Get the name of this type (ie "integer" for xs:integer) */ virtual const XMLCh* getTypeName() const; /* returns the XMLCh* (canonical) representation of this type */ virtual const XMLCh* asString(const DynamicContext* context) const; /** Releases the memory used by this Item */ virtual void release() const; /* returns true if the two objects represent the same date, * false otherwise */ virtual bool equals(const AnyAtomicType* target, const DynamicContext* context) const; /** * Returns true if and only if this date is greater than the given date. * The order relation on date values is the order relation on their * starting instants. */ virtual bool greaterThan(const ATDateTimeOrDerived* date, const DynamicContext* context) const; /** * Returns true if and only if this date is less than the given date. * The order relation on date values is the order relation on their * starting instants. */ virtual bool lessThan(const ATDateTimeOrDerived* date, const DynamicContext* context) const; /** * Returns an integer representing the year component of this object */ virtual const ATDecimalOrDerived* getYears() const; /** * Returns an integer representing the month component of this object */ virtual const ATDecimalOrDerived* getMonths() const; /** * Returns an integer representing the day component of this object */ virtual const ATDecimalOrDerived* getDays() const; /** * Returns an integer representing the hour component of this object */ virtual const ATDecimalOrDerived* getHours() const; /** * Returns an integer representing the minute component of this object */ virtual const ATDecimalOrDerived* getMinutes() const; /** * Returns an decimal representing the second component of this object */ virtual const ATDecimalOrDerived* getSeconds() const; /** * Returns the timezone associated with this object, or * null, if the timezone is not set */ virtual const Timezone* getTimezone() const; /** * Returns true if the timezone is defined for this object, false otherwise. */ virtual bool hasTimezone() const; /** * Setter for timezone. Overrides the current timezone. (Not to be * confused with addTimezone(). */ virtual const ATDateTimeOrDerived* setTimezone(const Timezone* timezone, const DynamicContext* context) const; virtual const ATDateTimeOrDerived* normalize(const DynamicContext* context) const; /** * Returns an ATDateTimeOrDerived with a timezone added to it */ virtual const ATDateTimeOrDerived* addTimezone(const ATDurationOrDerived* timezone, const DynamicContext* context) const; /** * Returns a date with the given yearMonthDuration added to it */ virtual const ATDateTimeOrDerived* addYearMonthDuration(const ATDurationOrDerived* yearMonth, const DynamicContext* context) const; /** * Returns a date with the given dayTimeDuration added to it */ virtual const ATDateTimeOrDerived* addDayTimeDuration(const ATDurationOrDerived* dayTime, const DynamicContext* context) const; /** * Returns a date with the given yearMonthDuration subtracted from it */ virtual const ATDateTimeOrDerived* subtractYearMonthDuration(const ATDurationOrDerived* yearMonth, const DynamicContext* context) const; /** * Returns a date with the given dayTimeDuration subtracted from it */ virtual const ATDateTimeOrDerived* subtractDayTimeDuration(const ATDurationOrDerived* dayTime, const DynamicContext* context) const; /** * Returns a dayTimeDuration corresponding to the difference between this * and the given ATDateTimeOrDerived* */ virtual const ATDurationOrDerived* subtractDateTimeAsDayTimeDuration(const ATDateTimeOrDerived* date, const DynamicContext* context) const; /** * Returns a dayTimeDuration corresponding to the difference between this * and the given ATDateTimeOrDerived* */ virtual const ATDurationOrDerived* subtractDateTimeAsYearMonthDuration(const ATDateTimeOrDerived* date, const DynamicContext* context) const; /* Get the primitive index associated with this type */ static AnyAtomicType::AtomicObjectType getTypeIndex(); /* Get the primitive type name */ static const XMLCh* getPrimitiveName(); /* Get the primitive index associated with this type */ virtual AnyAtomicType::AtomicObjectType getPrimitiveTypeIndex() const; protected: /* If possible, cast this type to the target type */ virtual const AnyAtomicType* castAsInternal(const XMLCh* targetURI, const XMLCh* targetType, const DynamicContext* context) const; private: // private constructor for use with clone() ATDateTimeOrDerivedImpl(const XMLCh* typeURI, const XMLCh* typeName, const ATDecimalOrDerived* YY, const ATDecimalOrDerived* MM, const ATDecimalOrDerived* DD, const ATDecimalOrDerived* hh, const ATDecimalOrDerived* mm, const ATDecimalOrDerived* ss, const Timezone* timezone, bool hasTimezone, XPath2MemoryManager* memMgr); void setDateTime(const XMLCh* const date, const DynamicContext* context); const ATDateTimeOrDerived* addDayTimeDuration(MAPM days, MAPM hours, MAPM minutes, MAPM seconds, const DynamicContext* context) const; const ATDateTimeOrDerived* subtractDayTimeDuration(MAPM days, MAPM hours, MAPM minutes, MAPM seconds, const DynamicContext* context) const; const ATDateTimeOrDerived* addYearMonthDuration(MAPM years, MAPM months, const DynamicContext* context) const; /* returns the XMLCh* (lexical) representation of this type */ const XMLCh* asLexicalString(const DynamicContext* context) const; int asInt(MAPM num) const; /*The value of this date*/ const ATDecimalOrDerived* _YY; // year as xs:integer const ATDecimalOrDerived* _MM; // month as xs:nonNegativeInteger const ATDecimalOrDerived* _DD; // day as xs:nonNegativeInteger const ATDecimalOrDerived* _hh; // hours as xs:nonNegativeInteger const ATDecimalOrDerived* _mm; // minutes as xs:nonNegativeInteger const ATDecimalOrDerived* _ss; // seconds xs:decimal /* the timezone associated with this ATDateTimeOrDerived */ const Timezone* _timezone; /* true if the timezone is defined */ bool _hasTimezone; /* the name of this type */ const XMLCh* _typeName; /* the uri of this type */ const XMLCh* _typeURI; }; #endif // _ATDATETIMEORDERIVEDIMPL_HPP