SourceForge.net Logo
ATDurationOrDerived.hpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2001-2008
3  * DecisionSoft Limited. All rights reserved.
4  * Copyright (c) 2004-2008
5  * Oracle. All rights reserved.
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  *
19  * $Id$
20  */
21 
22 #ifndef _ATDURATIONORDERIVED_HPP
23 #define _ATDURATIONORDERIVED_HPP
24 
25 #include <xercesc/util/XercesDefs.hpp>
26 
28 #include <xqilla/framework/XQillaExport.hpp>
30 
32 class DynamicContext;
33 
34 class XQILLA_API ATDurationOrDerived : public AnyAtomicType
35 {
36 public:
38 
39  /* Get the name of the primitive type (basic type) of this type
40  * (ie "decimal" for xs:decimal) */
41  virtual const XMLCh* getPrimitiveTypeName() const = 0;
42 
43  /* Get the namespace URI for this type */
44  virtual const XMLCh* getTypeURI() const = 0;
45 
46  /* Get the name of this type (ie "integer" for xs:integer) */
47  virtual const XMLCh* getTypeName() const = 0;
48 
49  /* returns the XMLCh* (canonical) representation of this type */
50  virtual const XMLCh* asString(const DynamicContext* context) const = 0;
51 
52  /* returns true if this duration is an instance of a xdt:dayTimeDuration */
53  virtual bool isDayTimeDuration() const = 0;
54 
55  /* returns true if this duration is an instance of a xdt:yearMonthDuration */
56  virtual bool isYearMonthDuration() const = 0;
57 
58  /* returns true if the two objects have the same duration
59  * false otherwise */
60  virtual bool equals(const AnyAtomicType::Ptr &target, const DynamicContext* context) const = 0;
61 
64  virtual int compare(const ATDurationOrDerived::Ptr &other, const DynamicContext *context) const = 0;
65 
68  virtual ATDurationOrDerived::Ptr divide(const Numeric::Ptr &divisor, const DynamicContext* context) const = 0;
69 
72  virtual ATDecimalOrDerived::Ptr divide(const ATDurationOrDerived::Ptr &divisor, const DynamicContext* context) const = 0;
73 
76  virtual ATDurationOrDerived::Ptr multiply(const Numeric::Ptr &divisor, const DynamicContext* context) const = 0;
77 
80  virtual ATDurationOrDerived::Ptr add(const ATDurationOrDerived::Ptr &other, const DynamicContext* context) const = 0;
81 
84  virtual ATDurationOrDerived::Ptr subtract(const ATDurationOrDerived::Ptr &other, const DynamicContext* context) const = 0;
85 
87  virtual ATDecimalOrDerived::Ptr getYears(const DynamicContext* context) const = 0;
88 
90  virtual ATDecimalOrDerived::Ptr getMonths(const DynamicContext* context) const = 0;
91 
93  virtual ATDecimalOrDerived::Ptr getDays(const DynamicContext* context) const = 0;
94 
96  virtual ATDecimalOrDerived::Ptr getHours(const DynamicContext* context) const = 0;
97 
99  virtual ATDecimalOrDerived::Ptr getMinutes(const DynamicContext* context) const = 0;
100 
102  virtual ATDecimalOrDerived::Ptr getSeconds(const DynamicContext* context) const = 0;
103 
104  /* return this duration in forms of seconds */
105  virtual ATDecimalOrDerived::Ptr asSeconds(const DynamicContext* context) const = 0;
106 
107  /* return this duration in forms of months */
108  virtual ATDecimalOrDerived::Ptr asMonths(const DynamicContext* context) const = 0;
109 
111  virtual bool isNegative() const = 0;
112 
114 
115  static const XMLCh fgDT_DAYTIMEDURATION[];
116  static const XMLCh pattern_DT_DAYTIMEDURATION[];
117 
118  static const XMLCh fgDT_YEARMONTHDURATION[];
119  static const XMLCh pattern_DT_YEARMONTHDURATION[];
120 };
121 
122 #endif // _ATDURATIONORDERIVED_HPP
123 
124