Main Page   Class Hierarchy   Compound List   File List   Compound Members   File Members   Examples  

BasicTypeSerializer.h

Go to the documentation of this file.
00001 /*
00002  *   Copyright 2003-2004 The Apache Software Foundation.
00003  *
00004  *   Licensed under the Apache License, Version 2.0 (the "License");
00005  *   you may not use this file except in compliance with the License.
00006  *   You may obtain a copy of the License at
00007  *
00008  *       http://www.apache.org/licenses/LICENSE-2.0
00009  *
00010  *   Unless required by applicable law or agreed to in writing, software
00011  *   distributed under the License is distributed on an "AS IS" BASIS,
00012  *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00013  *   See the License for the specific language governing permissions and
00014  *   limitations under the License.
00015  */
00016 
00026 #if !defined(_BASICTYPESERIALIZER_H____OF_AXIS_INCLUDED_)
00027 #define _BASICTYPESERIALIZER_H____OF_AXIS_INCLUDED_
00028 
00029 #include "TypeMapping.h"
00030 #include "AxisTime.h"
00031 #include <string>
00032 using namespace std;
00033 
00034 #define BTS_BUFFSIZE 32
00035 const AxisChar XML_ENTITY_REFERENCE_CAHRS[]    = "<>&\"\'";
00036 /* Entity reference characters */
00037 const AxisChar ENCODED_LESSER_STR[]            = "&lt;";    
00038 /* Encoded string for less than character */
00039 const AxisChar ENCODED_GREATOR_STR[]        = "&gt;";    
00040 /* Encoded string for greator than character */
00041 const AxisChar ENCODED_AMPERSAND_STR[]        = "&amp;";    
00042 /* Encoded string for ampersand character */
00043 const AxisChar ENCODED_DBL_QUOTE_STR[]        = "&quot;";    
00044 /* Encoded string for single quote character */
00045 const AxisChar ENCODED_SGL_QUOTE_STR[]        = "&apos;";    
00046 /* Encoded string for double quote character */
00047 
00048 /*
00049  *   @class BasicTypeSerializer
00050  *   @brief interface for the BasicTypeSerializer class.
00051  *
00052  *   @author Susantha Kumara (skumara@virtusa.com)
00053  */
00054 class BasicTypeSerializer
00055 {
00056 public:
00057     BasicTypeSerializer();
00058     virtual ~BasicTypeSerializer();
00059     const AxisString& getEntityReferenced(const AxisString& str);
00060     const AxisChar* serializeAsElement(const AxisChar* pName, 
00061         const void* pValue, XSDTYPE type);
00062     const AxisChar* serializeAsAttribute(const AxisChar* pName, 
00063         const AxisChar* pPrefix, const void* pValue, XSDTYPE type);
00064     const AxisChar* encodeToHexBinary(const xsd__hexBinary* pBinary);
00065     const AxisChar* encodeToBase64Binary(const xsd__base64Binary* pBinary);
00066     void setStyle(AXIS_BINDING_STYLE nStyle){ m_nStyle = nStyle;};
00067     static const AxisChar* basicTypeStr(XSDTYPE type);
00068 
00069 private:
00070     enum
00071     {
00072         GREATOR_THAN_CHAR    =    L'>',    /* Greator than character */
00073         LESSER_THAN_CHAR    =    L'<',    /* Less than character */
00074         SINGLE_QUOTE_CHAR    =    L'\'',    /* Single quotation character */
00075         DOUBLE_QUOTE_CHAR    =    L'\"',    /* Double quotation character */
00076         AMPERSAND_CHAR        =    L'&'    /* Ampersand character */
00077     };
00078 private:
00079     AxisString m_sSZ;
00080     AxisString m_AuxStr;
00081     AxisString m_strReturnVal;
00082     AxisChar m_Buf[BTS_BUFFSIZE]; 
00083     /* used for numeric to string conversions with sprintf */
00084     AxisTime m_AxisTime;
00085     /* Current Serialization Style */
00086     AXIS_BINDING_STYLE m_nStyle;
00087 };
00088 
00089 #endif 
00090 

Generated on Tue Jun 29 09:27:56 2004 for AxisC++ by doxygen1.2.18