Main Page   Class Hierarchy   Compound List   File List   Compound Members   Examples  

BasicTypeSerializer.h

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 
00017 #if !defined(_BASICTYPESERIALIZER_H____OF_AXIS_INCLUDED_)
00018 #define _BASICTYPESERIALIZER_H____OF_AXIS_INCLUDED_
00019 
00020 #include "TypeMapping.h"
00021 #include "AxisTime.h"
00022 #include <string>
00023 using namespace std;
00024 
00025 #define BTS_BUFFSIZE 32
00026 const AxisChar XML_ENTITY_REFERENCE_CAHRS[]    = "<>&\"\'";
00027 /* Entity reference characters */
00028 const AxisChar ENCODED_LESSER_STR[]            = "&lt;";    
00029 /* Encoded string for less than character */
00030 const AxisChar ENCODED_GREATOR_STR[]        = "&gt;";    
00031 /* Encoded string for greator than character */
00032 const AxisChar ENCODED_AMPERSAND_STR[]        = "&amp;";    
00033 /* Encoded string for ampersand character */
00034 const AxisChar ENCODED_DBL_QUOTE_STR[]        = "&quot;";    
00035 /* Encoded string for single quote character */
00036 const AxisChar ENCODED_SGL_QUOTE_STR[]        = "&apos;";    
00037 /* Encoded string for double quote character */
00038 
00039 /*
00040  *   @class BasicTypeSerializer
00041  *   @brief interface for the BasicTypeSerializer class.
00042  *
00043  *   @author Susantha Kumara (skumara@virtusa.com)
00044  */
00045 class BasicTypeSerializer
00046 {
00047 public:
00048     BasicTypeSerializer();
00049     virtual ~BasicTypeSerializer();
00050     const AxisString& getEntityReferenced(const AxisString& str);
00051     const AxisChar* serializeAsElement(const AxisChar* pName, 
00052         const void* pValue, XSDTYPE type);
00053     const AxisChar* serializeAsAttribute(const AxisChar* pName, 
00054         const AxisChar* pPrefix, const void* pValue, XSDTYPE type);
00055     const AxisChar* encodeToHexBinary(const xsd__hexBinary* pBinary);
00056     const AxisChar* encodeToBase64Binary(const xsd__base64Binary* pBinary);
00057     void setStyle(AXIS_BINDING_STYLE nStyle){ m_nStyle = nStyle;};
00058     static const AxisChar* basicTypeStr(XSDTYPE type);
00059 
00060 private:
00061     enum
00062     {
00063         GREATOR_THAN_CHAR    =    L'>',    /* Greator than character */
00064         LESSER_THAN_CHAR    =    L'<',    /* Less than character */
00065         SINGLE_QUOTE_CHAR    =    L'\'',    /* Single quotation character */
00066         DOUBLE_QUOTE_CHAR    =    L'\"',    /* Double quotation character */
00067         AMPERSAND_CHAR        =    L'&'    /* Ampersand character */
00068     };
00069 private:
00070     AxisString m_sSZ;
00071     AxisString m_AuxStr;
00072     AxisString m_strReturnVal;
00073     AxisChar m_Buf[BTS_BUFFSIZE]; 
00074     /* used for numeric to string conversions with sprintf */
00075     AxisTime m_AxisTime;
00076     /* Current Serialization Style */
00077     AXIS_BINDING_STYLE m_nStyle;
00078 };
00079 
00080 #endif 
00081 

Generated on Tue Jun 15 19:13:22 2004 for axiscpp by doxygen1.2.18