source: NonGTP/Xerces/xercesc/util/XMLNumber.hpp @ 188

Revision 188, 6.4 KB checked in by mattausch, 19 years ago (diff)

added xercesc to support

Line 
1/*
2 * The Apache Software License, Version 1.1
3 *
4 * Copyright (c) 2001-2003 The Apache Software Foundation.  All rights
5 * reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 *
11 * 1. Redistributions of source code must retain the above copyright
12 *    notice, this list of conditions and the following disclaimer.
13 *
14 * 2. Redistributions in binary form must reproduce the above copyright
15 *    notice, this list of conditions and the following disclaimer in
16 *    the documentation and/or other materials provided with the
17 *    distribution.
18 *
19 * 3. The end-user documentation included with the redistribution,
20 *    if any, must include the following acknowledgment:
21 *       "This product includes software developed by the
22 *        Apache Software Foundation (http://www.apache.org/)."
23 *    Alternately, this acknowledgment may appear in the software itself,
24 *    if and wherever such third-party acknowledgments normally appear.
25 *
26 * 4. The names "Xerces" and "Apache Software Foundation" must
27 *    not be used to endorse or promote products derived from this
28 *    software without prior written permission. For written
29 *    permission, please contact apache\@apache.org.
30 *
31 * 5. Products derived from this software may not be called "Apache",
32 *    nor may "Apache" appear in their name, without prior written
33 *    permission of the Apache Software Foundation.
34 *
35 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
36 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
37 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
38 * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
39 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
40 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
41 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
42 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
43 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
44 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
45 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
46 * SUCH DAMAGE.
47 * ====================================================================
48 *
49 * This software consists of voluntary contributions made by many
50 * individuals on behalf of the Apache Software Foundation, and was
51 * originally based on software copyright (c) 1999, International
52 * Business Machines, Inc., http://www.ibm.com .  For more information
53 * on the Apache Software Foundation, please see
54 * <http://www.apache.org/>.
55 */
56
57/*
58 * $Id: XMLNumber.hpp,v 1.13 2004/01/29 11:48:47 cargilld Exp $
59 * $Log: XMLNumber.hpp,v $
60 * Revision 1.13  2004/01/29 11:48:47  cargilld
61 * Code cleanup changes to get rid of various compiler diagnostic messages.
62 *
63 * Revision 1.12  2004/01/13 19:50:56  peiyongz
64 * remove parseContent()
65 *
66 * Revision 1.10  2003/10/17 21:10:55  peiyongz
67 * loadNumber() added
68 *
69 * Revision 1.9  2003/10/02 19:18:12  peiyongz
70 * enum NumberType
71 *
72 * Revision 1.8  2003/09/23 18:16:07  peiyongz
73 * Inplementation for Serialization/Deserialization
74 *
75 * Revision 1.7  2003/05/15 19:07:46  knoaman
76 * Partial implementation of the configurable memory manager.
77 *
78 * Revision 1.6  2003/05/09 15:13:46  peiyongz
79 * Deprecated toString() in XMLNumber family
80 *
81 * Revision 1.5  2003/03/10 20:55:58  peiyongz
82 * Schema Errata E2-40 double/float
83 *
84 * Revision 1.4  2003/02/02 23:54:43  peiyongz
85 * getFormattedString() added to return original and converted value.
86 *
87 * Revision 1.3  2003/01/30 21:55:22  tng
88 * Performance: create getRawData which is similar to toString but return the internal data directly, user is not required to delete the returned memory.
89 *
90 * Revision 1.2  2002/11/04 15:22:05  tng
91 * C++ Namespace Support.
92 *
93 * Revision 1.1.1.1  2002/02/01 22:22:15  peiyongz
94 * sane_include
95 *
96 * Revision 1.2  2001/10/09 21:28:28  peiyongz
97 * explicit ctor/dtor defined.
98 *
99 * Revision 1.1  2001/09/27 14:54:03  peiyongz
100 * DTV Reorganization: new class
101 *
102 */
103
104#ifndef XMLNUMBER_HPP
105#define XMLNUMBER_HPP
106
107#include <xercesc/internal/XSerializable.hpp>
108#include <xercesc/util/XMemory.hpp>
109
110XERCES_CPP_NAMESPACE_BEGIN
111
112class XMLUTIL_EXPORT XMLNumber : public XSerializable, public XMemory
113{
114public:
115
116    enum
117    {
118        LESS_THAN     = -1,
119        EQUAL         = 0,
120        GREATER_THAN  = 1,
121        INDETERMINATE = 2
122    };
123
124    enum NumberType {
125        Float,
126        Double,
127        BigDecimal,
128        DateTime,
129        UnKnown
130    };
131
132    virtual ~XMLNumber();
133
134    /**
135     *  Deprecated: please use getRawData
136     *
137     *  Return string representation of the decimal value.
138     *  A decimal point will be included as necessary,
139     *  the caller of this method is responsible for the
140     *  de-allocation of the memory.
141     */
142    virtual XMLCh*     toString() const = 0;
143   
144        /**
145         *  Return string representation of the decimal value.
146     *  A decimal point will be included as necessary.
147     *  Similar to toString above, but the internal buffer is
148     *  returned directly, user is not required to delete
149     *  the returned buffer
150         */
151    virtual XMLCh*     getRawData() const = 0;   
152
153    /**
154     *  Return the original and converted value of the original data.
155     *  (applicable to double/float)
156     *
157     *  The internal buffer is returned directly, user is not required
158     *  to delete the returned buffer
159     */
160    virtual const XMLCh*     getFormattedString() const = 0;   
161
162        /**
163         * Returns the sign of this number
164     *
165     * -1   negative
166     *  0   zero
167     *  1   positive
168         *
169         */
170    virtual int        getSign() const = 0;
171
172    /***
173     * Support for Serialization/De-serialization
174     ***/
175    DECL_XSERIALIZABLE(XMLNumber)
176
177    static XMLNumber*          loadNumber(XMLNumber::NumberType   numType
178                                        , XSerializeEngine&       serEng);
179
180protected:
181
182    XMLNumber();
183
184private:
185    // -----------------------------------------------------------------------
186    //  Unimplemented constructors and operators
187    // -----------------------------------------------------------------------
188    XMLNumber(const XMLNumber&);
189    XMLNumber& operator=(const XMLNumber&);
190};
191
192XERCES_CPP_NAMESPACE_END
193
194#endif
Note: See TracBrowser for help on using the repository browser.