00001 /* 00002 * Copyright (c) 2001-2006 00003 * DecisionSoft Limited. All rights reserved. 00004 * Copyright (c) 2004-2006 00005 * Progress Software Corporation. All rights reserved. 00006 * Copyright (c) 2004-2006 00007 * Oracle. All rights reserved. 00008 * 00009 * See the file LICENSE for redistribution information. 00010 * 00011 * $Id: ATDurationOrDerived.hpp,v 1.8 2006/11/01 16:37:14 jpcs Exp $ 00012 */ 00013 00014 #ifndef _ATDURATIONORDERIVED_HPP 00015 #define _ATDURATIONORDERIVED_HPP 00016 00017 #include <xercesc/util/XercesDefs.hpp> 00018 00019 #include <xqilla/items/AnyAtomicType.hpp> 00020 #include <xqilla/framework/XQillaExport.hpp> 00021 #include <xqilla/items/ATDecimalOrDerived.hpp> 00022 00023 class XPath2MemoryManager; 00024 class DynamicContext; 00025 00026 class XQILLA_API ATDurationOrDerived : public AnyAtomicType 00027 { 00028 public: 00029 typedef RefCountPointer<const ATDurationOrDerived> Ptr; 00030 00031 /* Get the name of the primitive type (basic type) of this type 00032 * (ie "decimal" for xs:decimal) */ 00033 virtual const XMLCh* getPrimitiveTypeName() const = 0; 00034 00035 /* Get the namespace URI for this type */ 00036 virtual const XMLCh* getTypeURI() const = 0; 00037 00038 /* Get the name of this type (ie "integer" for xs:integer) */ 00039 virtual const XMLCh* getTypeName() const = 0; 00040 00041 /* returns the XMLCh* (canonical) representation of this type */ 00042 virtual const XMLCh* asString(const DynamicContext* context) const = 0; 00043 00044 /* returns true if this duration is an instance of a xdt:dayTimeDuration */ 00045 virtual bool isDayTimeDuration() const = 0; 00046 00047 /* returns true if this duration is an instance of a xdt:yearMonthDuration */ 00048 virtual bool isYearMonthDuration() const = 0; 00049 00050 /* returns true if the two objects have the same duration 00051 * false otherwise */ 00052 virtual bool equals(const AnyAtomicType::Ptr &target, const DynamicContext* context) const = 0; 00053 00056 virtual int compare(const ATDurationOrDerived::Ptr &other, const DynamicContext *context) const = 0; 00057 00060 virtual ATDurationOrDerived::Ptr divide(const Numeric::Ptr &divisor, const DynamicContext* context) const = 0; 00061 00064 virtual ATDecimalOrDerived::Ptr divide(const ATDurationOrDerived::Ptr &divisor, const DynamicContext* context) const = 0; 00065 00068 virtual ATDurationOrDerived::Ptr multiply(const Numeric::Ptr &divisor, const DynamicContext* context) const = 0; 00069 00072 virtual ATDurationOrDerived::Ptr add(const ATDurationOrDerived::Ptr &other, const DynamicContext* context) const = 0; 00073 00076 virtual ATDurationOrDerived::Ptr subtract(const ATDurationOrDerived::Ptr &other, const DynamicContext* context) const = 0; 00077 00079 virtual ATDecimalOrDerived::Ptr getYears(const DynamicContext* context) const = 0; 00080 00082 virtual ATDecimalOrDerived::Ptr getMonths(const DynamicContext* context) const = 0; 00083 00085 virtual ATDecimalOrDerived::Ptr getDays(const DynamicContext* context) const = 0; 00086 00088 virtual ATDecimalOrDerived::Ptr getHours(const DynamicContext* context) const = 0; 00089 00091 virtual ATDecimalOrDerived::Ptr getMinutes(const DynamicContext* context) const = 0; 00092 00094 virtual ATDecimalOrDerived::Ptr getSeconds(const DynamicContext* context) const = 0; 00095 00096 /* return this duration in forms of seconds */ 00097 virtual ATDecimalOrDerived::Ptr asSeconds(const DynamicContext* context) const = 0; 00098 00099 /* return this duration in forms of months */ 00100 virtual ATDecimalOrDerived::Ptr asMonths(const DynamicContext* context) const = 0; 00101 00103 virtual bool isNegative() const = 0; 00104 00105 virtual AnyAtomicType::AtomicObjectType getPrimitiveTypeIndex() const = 0; 00106 00107 static const XMLCh fgDT_DAYTIMEDURATION[]; 00108 static const XMLCh fgDT_DAYTIMEDURATION_XERCESHASH[]; 00109 static const XMLCh pattern_DT_DAYTIMEDURATION[]; 00110 00111 static const XMLCh fgDT_YEARMONTHDURATION[]; 00112 static const XMLCh fgDT_YEARMONTHDURATION_XERCESHASH[]; 00113 static const XMLCh pattern_DT_YEARMONTHDURATION[]; 00114 }; 00115 00116 #endif // _ATDURATIONORDERIVED_HPP 00117 00118