source: NonGTP/Xerces/xerces-c_2_8_0/include/xercesc/util/XMLNumber.hpp @ 2674

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