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, 2015 Oracle and/or its affiliates. All rights reserved.
5 *
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
20#ifndef _ATDURATIONORDERIVED_HPP
21#define _ATDURATIONORDERIVED_HPP
22
23#include <xercesc/util/XercesDefs.hpp>
24
26#include <xqilla/framework/XQillaExport.hpp>
28
30class DynamicContext;
31
32class XQILLA_API ATDurationOrDerived : public AnyAtomicType
33{
34public:
36
37 /* Get the name of the primitive type (basic type) of this type
38 * (ie "decimal" for xs:decimal) */
39 virtual const XMLCh* getPrimitiveTypeName() const = 0;
40
41 /* Get the namespace URI for this type */
42 virtual const XMLCh* getTypeURI() const = 0;
43
44 /* Get the name of this type (ie "integer" for xs:integer) */
45 virtual const XMLCh* getTypeName() const = 0;
46
47 /* returns the XMLCh* (canonical) representation of this type */
48 virtual const XMLCh* asString(const DynamicContext* context) const = 0;
49
50 /* returns true if this duration is an instance of a xdt:dayTimeDuration */
51 virtual bool isDayTimeDuration() const = 0;
52
53 /* returns true if this duration is an instance of a xdt:yearMonthDuration */
54 virtual bool isYearMonthDuration() const = 0;
55
56 /* returns true if the two objects have the same duration
57 * false otherwise */
58 virtual bool equals(const AnyAtomicType::Ptr &target, const DynamicContext* context) const = 0;
59
62 virtual int compare(const ATDurationOrDerived::Ptr &other, const DynamicContext *context) const = 0;
63
66 virtual ATDurationOrDerived::Ptr divide(const Numeric::Ptr &divisor, const DynamicContext* context) const = 0;
67
70 virtual ATDecimalOrDerived::Ptr divide(const ATDurationOrDerived::Ptr &divisor, const DynamicContext* context) const = 0;
71
74 virtual ATDurationOrDerived::Ptr multiply(const Numeric::Ptr &divisor, const DynamicContext* context) const = 0;
75
78 virtual ATDurationOrDerived::Ptr add(const ATDurationOrDerived::Ptr &other, const DynamicContext* context) const = 0;
79
82 virtual ATDurationOrDerived::Ptr subtract(const ATDurationOrDerived::Ptr &other, const DynamicContext* context) const = 0;
83
85 virtual ATDecimalOrDerived::Ptr getYears(const DynamicContext* context) const = 0;
86
88 virtual ATDecimalOrDerived::Ptr getMonths(const DynamicContext* context) const = 0;
89
91 virtual ATDecimalOrDerived::Ptr getDays(const DynamicContext* context) const = 0;
92
94 virtual ATDecimalOrDerived::Ptr getHours(const DynamicContext* context) const = 0;
95
97 virtual ATDecimalOrDerived::Ptr getMinutes(const DynamicContext* context) const = 0;
98
100 virtual ATDecimalOrDerived::Ptr getSeconds(const DynamicContext* context) const = 0;
101
102 /* return this duration in forms of seconds */
103 virtual ATDecimalOrDerived::Ptr asSeconds(const DynamicContext* context) const = 0;
104
105 /* return this duration in forms of months */
106 virtual ATDecimalOrDerived::Ptr asMonths(const DynamicContext* context) const = 0;
107
109 virtual bool isNegative() const = 0;
110
112
113 static const XMLCh fgDT_DAYTIMEDURATION[];
114 static const XMLCh pattern_DT_DAYTIMEDURATION[];
115
116 static const XMLCh fgDT_YEARMONTHDURATION[];
117 static const XMLCh pattern_DT_YEARMONTHDURATION[];
118};
119
120#endif // _ATDURATIONORDERIVED_HPP
121
122
Definition: ATDurationOrDerived.hpp:33
virtual const XMLCh * asString(const DynamicContext *context) const =0
virtual ATDecimalOrDerived::Ptr asMonths(const DynamicContext *context) const =0
virtual bool isNegative() const =0
Returns true if this Duration is negative, false otherwise.
virtual int compare(const ATDurationOrDerived::Ptr &other, const DynamicContext *context) const =0
Returns less than 0 if this is less that other, 0 if they are the same, and greater than 0 otherwise.
virtual ATDecimalOrDerived::Ptr getMinutes(const DynamicContext *context) const =0
Returns the minutes portion of this duration.
virtual const XMLCh * getTypeName() const =0
virtual bool equals(const AnyAtomicType::Ptr &target, const DynamicContext *context) const =0
virtual ATDecimalOrDerived::Ptr getSeconds(const DynamicContext *context) const =0
Returns the seconds portion of this duration.
virtual ATDecimalOrDerived::Ptr getMonths(const DynamicContext *context) const =0
Returns the month portion of this duration.
virtual bool isDayTimeDuration() const =0
virtual ATDecimalOrDerived::Ptr divide(const ATDurationOrDerived::Ptr &divisor, const DynamicContext *context) const =0
Divide this duration by a duration – only available for xdt:dayTimeDuration and xdt:yearMonthDuration...
virtual ATDecimalOrDerived::Ptr getYears(const DynamicContext *context) const =0
Returns the year portion of this duration.
virtual ATDecimalOrDerived::Ptr getHours(const DynamicContext *context) const =0
Returns the hours portion of this duration.
virtual bool isYearMonthDuration() const =0
virtual ATDurationOrDerived::Ptr subtract(const ATDurationOrDerived::Ptr &other, const DynamicContext *context) const =0
Subtract a duration from this duration – only available for xdt:dayTimeDuration and xdt:yearMonthDura...
virtual AnyAtomicType::AtomicObjectType getPrimitiveTypeIndex() const =0
RefCountPointer< const ATDurationOrDerived > Ptr
Definition: ATDurationOrDerived.hpp:35
virtual ATDurationOrDerived::Ptr multiply(const Numeric::Ptr &divisor, const DynamicContext *context) const =0
Multiply this duration by a number – only available for xdt:dayTimeDuration and xdt:yearMonthDuration...
virtual const XMLCh * getPrimitiveTypeName() const =0
virtual ATDecimalOrDerived::Ptr getDays(const DynamicContext *context) const =0
Returns the days portion of this duration.
virtual const XMLCh * getTypeURI() const =0
virtual ATDecimalOrDerived::Ptr asSeconds(const DynamicContext *context) const =0
virtual ATDurationOrDerived::Ptr divide(const Numeric::Ptr &divisor, const DynamicContext *context) const =0
Divide this duration by a number – only available for xdt:dayTimeDuration and xdt:yearMonthDuration.
virtual ATDurationOrDerived::Ptr add(const ATDurationOrDerived::Ptr &other, const DynamicContext *context) const =0
Add a duration to this duration – only available for xdt:dayTimeDuration and xdt:yearMonthDuration.
Definition: AnyAtomicType.hpp:31
AtomicObjectType
Definition: AnyAtomicType.hpp:34
The execution time dynamic context interface.
Definition: DynamicContext.hpp:39
Super class of all the reference counted wrappers for Items.
Definition: ReferenceCounted.hpp:62
Definition: XPath2MemoryManager.hpp:46