/* * Copyright (c) 2001, DecisionSoft Limited All rights reserved. * Please see LICENSE.TXT for more information. */ #ifndef _ATDURATIONORDERIVED_HPP #define _ATDURATIONORDERIVED_HPP #include #include #include class XPath2MemoryManager; class ATDecimalOrDerived; class DynamicContext; class PATHAN_EXPORT ATDurationOrDerived : public AnyAtomicType { public: /* Get the name of the primitive type (basic type) of this type * (ie "decimal" for xs:decimal) */ virtual const XMLCh* getPrimitiveTypeName() const = 0; /* Get the namespace URI for this type */ virtual const XMLCh* getTypeURI() const = 0; /* Get the name of this type (ie "integer" for xs:integer) */ virtual const XMLCh* getTypeName() const = 0; /* returns the XMLCh* (canonical) representation of this type */ virtual const XMLCh* asString(const DynamicContext* context) const = 0; /* returns true if this duration is an instance of a xdt:dayTimeDuration */ virtual bool isDayTimeDuration() const = 0; /* returns true if this duration is an instance of a xdt:yearMonthDuration */ virtual bool isYearMonthDuration() const = 0; /* returns true if the two objects have the same duration * false otherwise */ virtual bool equals(const AnyAtomicType* target, const DynamicContext* context) const = 0; /** greaterThan -- only defined for fn:dayTimeDuration and fn:yearMonthDuration */ virtual bool greaterThan(const ATDurationOrDerived* other, const DynamicContext* context) const = 0; /** lessThan -- only defined for fn:dayTimeDuration and fn:yearMonthDuration */ virtual bool lessThan(const ATDurationOrDerived* other, const DynamicContext* context) const = 0; /** Divide this duration by a number -- only available for xdt:dayTimeDuration * and xdt:yearMonthDuration */ virtual const ATDurationOrDerived* divide(const ATDecimalOrDerived* divisor, const DynamicContext* context) const = 0; /** Multiply this duration by a number -- only available for xdt:dayTimeDuration * and xdt:yearMonthDuration */ virtual const ATDurationOrDerived* multiply(const ATDecimalOrDerived* divisor, const DynamicContext* context) const = 0; /** Add a duration to this duration -- only available for xdt:dayTimeDuration * and xdt:yearMonthDuration */ virtual const ATDurationOrDerived* add(const ATDurationOrDerived* other, const DynamicContext* context) const = 0; /** Subtract a duration from this duration -- only available for xdt:dayTimeDuration * and xdt:yearMonthDuration */ virtual const ATDurationOrDerived* subtract(const ATDurationOrDerived* other, const DynamicContext* context) const = 0; /** Returns the year portion of this duration */ virtual const ATDecimalOrDerived* getYears() const = 0; /** Returns the month portion of this duration */ virtual const ATDecimalOrDerived* getMonths() const = 0; /** Returns the days portion of this duration */ virtual const ATDecimalOrDerived* getDays() const = 0; /** Returns the hours portion of this duration */ virtual const ATDecimalOrDerived* getHours() const = 0; /** Returns the minutes portion of this duration */ virtual const ATDecimalOrDerived* getMinutes() const = 0; /** Returns the seconds portion of this duration */ virtual const ATDecimalOrDerived* getSeconds() const = 0; /** normalize this duration (only available for xdt:dayTimeDuration and * xdt:yearMonthDuration **/ virtual const ATDurationOrDerived* normalize(const DynamicContext* context) const = 0; /** Returns true if this Duration is negative, false otherwise */ virtual bool isNegative() const = 0; /** Releases the memory used by this Item */ virtual void release() const = 0; virtual AnyAtomicType::AtomicObjectType getPrimitiveTypeIndex() const = 0; static const XMLCh fgDT_DAYTIMEDURATION[]; static const XMLCh fgDT_DAYTIMEDURATION_XERCESHASH[]; static const XMLCh pattern_DT_DAYTIMEDURATION[]; static const XMLCh fgDT_YEARMONTHDURATION[]; static const XMLCh fgDT_YEARMONTHDURATION_XERCESHASH[]; static const XMLCh pattern_DT_YEARMONTHDURATION[]; protected: /* Protected constructor */ ATDurationOrDerived(XPath2MemoryManager* memMgr): AnyAtomicType(memMgr) {}; }; #endif // _ATDURATIONORDERIVED_HPP