source: NonGTP/Xerces/xerces/include/xercesc/util/XMLNumber.hpp @ 358

Revision 358, 4.5 KB checked in by bittner, 19 years ago (diff)

xerces added

Line 
1/*
2 * Copyright 2001-2004 The Apache Software Foundation.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17/*
18 * $Id: XMLNumber.hpp,v 1.14 2004/09/08 13:56:24 peiyongz Exp $
19 * $Log: XMLNumber.hpp,v $
20 * Revision 1.14  2004/09/08 13:56:24  peiyongz
21 * Apache License Version 2.0
22 *
23 * Revision 1.13  2004/01/29 11:48:47  cargilld
24 * Code cleanup changes to get rid of various compiler diagnostic messages.
25 *
26 * Revision 1.12  2004/01/13 19:50:56  peiyongz
27 * remove parseContent()
28 *
29 * Revision 1.10  2003/10/17 21:10:55  peiyongz
30 * loadNumber() added
31 *
32 * Revision 1.9  2003/10/02 19:18:12  peiyongz
33 * enum NumberType
34 *
35 * Revision 1.8  2003/09/23 18:16:07  peiyongz
36 * Inplementation for Serialization/Deserialization
37 *
38 * Revision 1.7  2003/05/15 19:07:46  knoaman
39 * Partial implementation of the configurable memory manager.
40 *
41 * Revision 1.6  2003/05/09 15:13:46  peiyongz
42 * Deprecated toString() in XMLNumber family
43 *
44 * Revision 1.5  2003/03/10 20:55:58  peiyongz
45 * Schema Errata E2-40 double/float
46 *
47 * Revision 1.4  2003/02/02 23:54:43  peiyongz
48 * getFormattedString() added to return original and converted value.
49 *
50 * Revision 1.3  2003/01/30 21:55:22  tng
51 * Performance: create getRawData which is similar to toString but return the internal data directly, user is not required to delete the returned memory.
52 *
53 * Revision 1.2  2002/11/04 15:22:05  tng
54 * C++ Namespace Support.
55 *
56 * Revision 1.1.1.1  2002/02/01 22:22:15  peiyongz
57 * sane_include
58 *
59 * Revision 1.2  2001/10/09 21:28:28  peiyongz
60 * explicit ctor/dtor defined.
61 *
62 * Revision 1.1  2001/09/27 14:54:03  peiyongz
63 * DTV Reorganization: new class
64 *
65 */
66
67#ifndef XMLNUMBER_HPP
68#define XMLNUMBER_HPP
69
70#include <xercesc/internal/XSerializable.hpp>
71#include <xercesc/util/XMemory.hpp>
72
73XERCES_CPP_NAMESPACE_BEGIN
74
75class XMLUTIL_EXPORT XMLNumber : public XSerializable, public XMemory
76{
77public:
78
79    enum
80    {
81        LESS_THAN     = -1,
82        EQUAL         = 0,
83        GREATER_THAN  = 1,
84        INDETERMINATE = 2
85    };
86
87    enum NumberType {
88        Float,
89        Double,
90        BigDecimal,
91        DateTime,
92        UnKnown
93    };
94
95    virtual ~XMLNumber();
96
97    /**
98     *  Deprecated: please use getRawData
99     *
100     *  Return string representation of the decimal value.
101     *  A decimal point will be included as necessary,
102     *  the caller of this method is responsible for the
103     *  de-allocation of the memory.
104     */
105    virtual XMLCh*     toString() const = 0;
106   
107        /**
108         *  Return string representation of the decimal value.
109     *  A decimal point will be included as necessary.
110     *  Similar to toString above, but the internal buffer is
111     *  returned directly, user is not required to delete
112     *  the returned buffer
113         */
114    virtual XMLCh*     getRawData() const = 0;   
115
116    /**
117     *  Return the original and converted value of the original data.
118     *  (applicable to double/float)
119     *
120     *  The internal buffer is returned directly, user is not required
121     *  to delete the returned buffer
122     */
123    virtual const XMLCh*     getFormattedString() const = 0;   
124
125        /**
126         * Returns the sign of this number
127     *
128     * -1   negative
129     *  0   zero
130     *  1   positive
131         *
132         */
133    virtual int        getSign() const = 0;
134
135    /***
136     * Support for Serialization/De-serialization
137     ***/
138    DECL_XSERIALIZABLE(XMLNumber)
139
140    static XMLNumber*          loadNumber(XMLNumber::NumberType   numType
141                                        , XSerializeEngine&       serEng);
142
143protected:
144
145    XMLNumber();
146
147private:
148    // -----------------------------------------------------------------------
149    //  Unimplemented constructors and operators
150    // -----------------------------------------------------------------------
151    XMLNumber(const XMLNumber&);
152    XMLNumber& operator=(const XMLNumber&);
153};
154
155XERCES_CPP_NAMESPACE_END
156
157#endif
Note: See TracBrowser for help on using the repository browser.