00001 /* 00002 * Copyright (c) 2001-2008 00003 * DecisionSoft Limited. All rights reserved. 00004 * Copyright (c) 2004-2008 00005 * Oracle. All rights reserved. 00006 * 00007 * Licensed under the Apache License, Version 2.0 (the "License"); 00008 * you may not use this file except in compliance with the License. 00009 * You may obtain a copy of the License at 00010 * 00011 * http://www.apache.org/licenses/LICENSE-2.0 00012 * 00013 * Unless required by applicable law or agreed to in writing, software 00014 * distributed under the License is distributed on an "AS IS" BASIS, 00015 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00016 * See the License for the specific language governing permissions and 00017 * limitations under the License. 00018 * 00019 * $Id: ATDurationOrDerived.hpp 475 2008-01-08 18:47:44Z jpcs $ 00020 */ 00021 00022 #ifndef _ATDURATIONORDERIVED_HPP 00023 #define _ATDURATIONORDERIVED_HPP 00024 00025 #include <xercesc/util/XercesDefs.hpp> 00026 00027 #include <xqilla/items/AnyAtomicType.hpp> 00028 #include <xqilla/framework/XQillaExport.hpp> 00029 #include <xqilla/items/ATDecimalOrDerived.hpp> 00030 00031 class XPath2MemoryManager; 00032 class DynamicContext; 00033 00034 class XQILLA_API ATDurationOrDerived : public AnyAtomicType 00035 { 00036 public: 00037 typedef RefCountPointer<const ATDurationOrDerived> Ptr; 00038 00039 /* Get the name of the primitive type (basic type) of this type 00040 * (ie "decimal" for xs:decimal) */ 00041 virtual const XMLCh* getPrimitiveTypeName() const = 0; 00042 00043 /* Get the namespace URI for this type */ 00044 virtual const XMLCh* getTypeURI() const = 0; 00045 00046 /* Get the name of this type (ie "integer" for xs:integer) */ 00047 virtual const XMLCh* getTypeName() const = 0; 00048 00049 /* returns the XMLCh* (canonical) representation of this type */ 00050 virtual const XMLCh* asString(const DynamicContext* context) const = 0; 00051 00052 /* returns true if this duration is an instance of a xdt:dayTimeDuration */ 00053 virtual bool isDayTimeDuration() const = 0; 00054 00055 /* returns true if this duration is an instance of a xdt:yearMonthDuration */ 00056 virtual bool isYearMonthDuration() const = 0; 00057 00058 /* returns true if the two objects have the same duration 00059 * false otherwise */ 00060 virtual bool equals(const AnyAtomicType::Ptr &target, const DynamicContext* context) const = 0; 00061 00064 virtual int compare(const ATDurationOrDerived::Ptr &other, const DynamicContext *context) const = 0; 00065 00068 virtual ATDurationOrDerived::Ptr divide(const Numeric::Ptr &divisor, const DynamicContext* context) const = 0; 00069 00072 virtual ATDecimalOrDerived::Ptr divide(const ATDurationOrDerived::Ptr &divisor, const DynamicContext* context) const = 0; 00073 00076 virtual ATDurationOrDerived::Ptr multiply(const Numeric::Ptr &divisor, const DynamicContext* context) const = 0; 00077 00080 virtual ATDurationOrDerived::Ptr add(const ATDurationOrDerived::Ptr &other, const DynamicContext* context) const = 0; 00081 00084 virtual ATDurationOrDerived::Ptr subtract(const ATDurationOrDerived::Ptr &other, const DynamicContext* context) const = 0; 00085 00087 virtual ATDecimalOrDerived::Ptr getYears(const DynamicContext* context) const = 0; 00088 00090 virtual ATDecimalOrDerived::Ptr getMonths(const DynamicContext* context) const = 0; 00091 00093 virtual ATDecimalOrDerived::Ptr getDays(const DynamicContext* context) const = 0; 00094 00096 virtual ATDecimalOrDerived::Ptr getHours(const DynamicContext* context) const = 0; 00097 00099 virtual ATDecimalOrDerived::Ptr getMinutes(const DynamicContext* context) const = 0; 00100 00102 virtual ATDecimalOrDerived::Ptr getSeconds(const DynamicContext* context) const = 0; 00103 00104 /* return this duration in forms of seconds */ 00105 virtual ATDecimalOrDerived::Ptr asSeconds(const DynamicContext* context) const = 0; 00106 00107 /* return this duration in forms of months */ 00108 virtual ATDecimalOrDerived::Ptr asMonths(const DynamicContext* context) const = 0; 00109 00111 virtual bool isNegative() const = 0; 00112 00113 virtual AnyAtomicType::AtomicObjectType getPrimitiveTypeIndex() const = 0; 00114 00115 static const XMLCh fgDT_DAYTIMEDURATION[]; 00116 static const XMLCh pattern_DT_DAYTIMEDURATION[]; 00117 00118 static const XMLCh fgDT_YEARMONTHDURATION[]; 00119 static const XMLCh pattern_DT_YEARMONTHDURATION[]; 00120 }; 00121 00122 #endif // _ATDURATIONORDERIVED_HPP 00123 00124