|
1 /* |
|
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 /* |
|
18 * Licensed to the Apache Software Foundation (ASF) under one or more |
|
19 * contributor license agreements. See the NOTICE file distributed with |
|
20 * this work for additional information regarding copyright ownership. |
|
21 * The ASF licenses this file to You under the Apache License, Version 2.0 |
|
22 * (the "License"); you may not use this file except in compliance with |
|
23 * the License. You may obtain a copy of the License at |
|
24 * |
|
25 * http://www.apache.org/licenses/LICENSE-2.0 |
|
26 * |
|
27 * Unless required by applicable law or agreed to in writing, software |
|
28 * distributed under the License is distributed on an "AS IS" BASIS, |
|
29 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
30 * See the License for the specific language governing permissions and |
|
31 * limitations under the License. |
|
32 */ |
|
33 |
|
34 /* |
|
35 * $Id: XMLNumber.hpp 568078 2007-08-21 11:43:25Z amassari $ |
|
36 */ |
|
37 |
|
38 #ifndef XMLNUMBER_HPP |
|
39 #define XMLNUMBER_HPP |
|
40 |
|
41 #include <xercesc/internal/XSerializable.hpp> |
|
42 #include <xercesc/util/XMemory.hpp> |
|
43 |
|
44 XERCES_CPP_NAMESPACE_BEGIN |
|
45 |
|
46 class XMLUTIL_EXPORT XMLNumber : public XSerializable, public XMemory |
|
47 { |
|
48 public: |
|
49 |
|
50 enum |
|
51 { |
|
52 LESS_THAN = -1, |
|
53 EQUAL = 0, |
|
54 GREATER_THAN = 1, |
|
55 INDETERMINATE = 2 |
|
56 }; |
|
57 |
|
58 enum NumberType { |
|
59 Float, |
|
60 Double, |
|
61 BigDecimal, |
|
62 DateTime, |
|
63 UnKnown |
|
64 }; |
|
65 |
|
66 virtual ~XMLNumber(); |
|
67 |
|
68 /** |
|
69 * Deprecated: please use getRawData |
|
70 * |
|
71 * Return string representation of the decimal value. |
|
72 * A decimal point will be included as necessary, |
|
73 * the caller of this method is responsible for the |
|
74 * de-allocation of the memory. |
|
75 */ |
|
76 virtual XMLCh* toString() const = 0; |
|
77 |
|
78 /** |
|
79 * Return string representation of the decimal value. |
|
80 * A decimal point will be included as necessary. |
|
81 * Similar to toString above, but the internal buffer is |
|
82 * returned directly, user is not required to delete |
|
83 * the returned buffer |
|
84 */ |
|
85 virtual XMLCh* getRawData() const = 0; |
|
86 |
|
87 /** |
|
88 * Return the original and converted value of the original data. |
|
89 * (applicable to double/float) |
|
90 * |
|
91 * The internal buffer is returned directly, user is not required |
|
92 * to delete the returned buffer |
|
93 */ |
|
94 virtual const XMLCh* getFormattedString() const = 0; |
|
95 |
|
96 /** |
|
97 * Returns the sign of this number |
|
98 * |
|
99 * -1 negative |
|
100 * 0 zero |
|
101 * 1 positive |
|
102 * |
|
103 */ |
|
104 virtual int getSign() const = 0; |
|
105 |
|
106 /*** |
|
107 * Support for Serialization/De-serialization |
|
108 ***/ |
|
109 DECL_XSERIALIZABLE(XMLNumber) |
|
110 |
|
111 static XMLNumber* loadNumber(XMLNumber::NumberType numType |
|
112 , XSerializeEngine& serEng); |
|
113 |
|
114 protected: |
|
115 |
|
116 XMLNumber(); |
|
117 XMLNumber(const XMLNumber&); |
|
118 |
|
119 private: |
|
120 // ----------------------------------------------------------------------- |
|
121 // Unimplemented operators |
|
122 // ----------------------------------------------------------------------- |
|
123 XMLNumber& operator=(const XMLNumber&); |
|
124 }; |
|
125 |
|
126 XERCES_CPP_NAMESPACE_END |
|
127 |
|
128 #endif |