Main Page | Modules | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members

ltkcpp_xmltext.h

Go to the documentation of this file.
00001 
00002 /*
00003  ***************************************************************************
00004  *  Copyright 2007,2008 Impinj, Inc.
00005  *
00006  *  Licensed under the Apache License, Version 2.0 (the "License");
00007  *  you may not use this file except in compliance with the License.
00008  *  You may obtain a copy of the License at
00009  *
00010  *      http://www.apache.org/licenses/LICENSE-2.0
00011  *
00012  *  Unless required by applicable law or agreed to in writing, software
00013  *  distributed under the License is distributed on an "AS IS" BASIS,
00014  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00015  *  See the License for the specific language governing permissions and
00016  *  limitations under the License.
00017  *
00018  ***************************************************************************
00019  */
00020 
00021 
00035 namespace LLRP
00036 {
00037 class CXMLTextEncoder;
00038 class CXMLTextEncoderStream;
00039 
00040 class CXMLTextEncoder : public CEncoder
00041 {
00042     friend class CXMLTextEncoderStream;
00043 
00044   private:
00045     char *                      m_pBuffer;
00046     int                         m_nBuffer;
00047     int                         m_iNext;
00048 
00049   public:
00050     int                         m_bOverflow;
00051 
00052   public:
00053     CXMLTextEncoder (
00054       char *                    pBuffer,
00055       int                       nBuffer);
00056 
00057     ~CXMLTextEncoder (void);
00058 
00059     void
00060     encodeElement (
00061       const CElement *          pElement);
00062 };
00063 
00064 class CXMLTextEncoderStream : public CEncoderStream
00065 {
00066     friend class CXMLTextEncoder;
00067 
00068   public:
00069     void
00070     putRequiredSubParameter (
00071       const CParameter *        pParameter,
00072       const CTypeDescriptor *   pRefType);
00073 
00074     void
00075     putOptionalSubParameter (
00076       const CParameter *        pParameter,
00077       const CTypeDescriptor *   pRefType);
00078 
00079     void
00080     putRequiredSubParameterList (
00081       const tListOfParameters * pParameterList,
00082       const CTypeDescriptor *   pRefType);
00083 
00084     void
00085     putOptionalSubParameterList (
00086       const tListOfParameters * pParameterList,
00087       const CTypeDescriptor *   pRefType);
00088 
00089     /*
00090      * 8-bit types
00091      */
00092 
00093     void
00094     put_u8 (
00095       llrp_u8_t                 Value,
00096       const CFieldDescriptor *  pFieldDescriptor);
00097 
00098     void
00099     put_s8 (
00100       llrp_s8_t                 Value,
00101       const CFieldDescriptor *  pFieldDescriptor);
00102 
00103     void
00104     put_u8v (
00105       llrp_u8v_t                Value,
00106       const CFieldDescriptor *  pFieldDescriptor);
00107 
00108     void
00109     put_s8v (
00110       llrp_s8v_t                Value,
00111       const CFieldDescriptor *  pFieldDescriptor);
00112 
00113     /*
00114      * 16-bit types
00115      */
00116 
00117     void
00118     put_u16 (
00119       llrp_u16_t                Value,
00120       const CFieldDescriptor *  pFieldDescriptor);
00121 
00122     void
00123     put_s16 (
00124       llrp_s16_t                Value,
00125       const CFieldDescriptor *  pFieldDescriptor);
00126 
00127     void
00128     put_u16v (
00129       llrp_u16v_t               Value,
00130       const CFieldDescriptor *  pFieldDescriptor);
00131 
00132     void
00133     put_s16v (
00134       llrp_s16v_t               Value,
00135       const CFieldDescriptor *  pFieldDescriptor);
00136 
00137     /*
00138      * 32-bit types
00139      */
00140 
00141     void
00142     put_u32 (
00143       llrp_u32_t                Value,
00144       const CFieldDescriptor *  pFieldDescriptor);
00145 
00146     void
00147     put_s32 (
00148       llrp_s32_t                Value,
00149       const CFieldDescriptor *  pFieldDescriptor);
00150 
00151     void
00152     put_u32v (
00153       llrp_u32v_t               Value,
00154       const CFieldDescriptor *  pFieldDescriptor);
00155 
00156     void
00157     put_s32v (
00158       llrp_s32v_t               Value,
00159       const CFieldDescriptor *  pFieldDescriptor);
00160 
00161     /*
00162      * 64-bit types
00163      */
00164 
00165     void
00166     put_u64 (
00167       llrp_u64_t                Value,
00168       const CFieldDescriptor *  pFieldDescriptor);
00169 
00170     void
00171     put_s64 (
00172       llrp_s64_t                Value,
00173       const CFieldDescriptor *  pFieldDescriptor);
00174 
00175     void
00176     put_u64v (
00177       llrp_u64v_t               Value,
00178       const CFieldDescriptor *  pFieldDescriptor);
00179 
00180     void
00181     put_s64v (
00182       llrp_s64v_t               Value,
00183       const CFieldDescriptor *  pFieldDescriptor);
00184 
00185     /*
00186      * Special types
00187      */
00188 
00189     void
00190     put_u1 (
00191       llrp_u1_t                 Value,
00192       const CFieldDescriptor *  pFieldDescriptor);
00193 
00194     void
00195     put_u1v (
00196       llrp_u1v_t                Value,
00197       const CFieldDescriptor *  pFieldDescriptor);
00198 
00199     void
00200     put_u2 (
00201       llrp_u2_t                 Value,
00202       const CFieldDescriptor *  pFieldDescriptor);
00203 
00204     void
00205     put_u96 (
00206       llrp_u96_t                Value,
00207       const CFieldDescriptor *  pFieldDescriptor);
00208 
00209     void
00210     put_utf8v (
00211       llrp_utf8v_t              Value,
00212       const CFieldDescriptor *  pFieldDescriptor);
00213 
00214     void
00215     put_bytesToEnd (
00216       llrp_bytesToEnd_t         Value,
00217       const CFieldDescriptor *  pFieldDescriptor);
00218 
00219     /*
00220      * Enumerated types of various sizes
00221      */
00222 
00223     void
00224     put_e1 (
00225       int                       eValue,
00226       const CFieldDescriptor *  pFieldDescriptor);
00227 
00228     void
00229     put_e2 (
00230       int                       eValue,
00231       const CFieldDescriptor *  pFieldDescriptor);
00232 
00233     void
00234     put_e8 (
00235       int                       eValue,
00236       const CFieldDescriptor *  pFieldDescriptor);
00237 
00238     void
00239     put_e16 (
00240       int                       eValue,
00241       const CFieldDescriptor *  pFieldDescriptor);
00242 
00243     void
00244     put_e32 (
00245       int                       eValue,
00246       const CFieldDescriptor *  pFieldDescriptor);
00247 
00248     void
00249     put_e8v (
00250       llrp_u8v_t                Value,
00251       const CFieldDescriptor *  pFieldDescriptor);
00252 
00253     /*
00254      * Reserved types are some number of bits
00255      */
00256 
00257     void
00258     put_reserved (
00259       unsigned int              nBits);
00260 
00261   private:
00262     CXMLTextEncoderStream (
00263       CXMLTextEncoder *         pEncoder);
00264 
00265     CXMLTextEncoderStream (
00266       CXMLTextEncoderStream *   pEnclosingEncoderStream);
00267 
00268     CXMLTextEncoder *           m_pEncoder;
00269     CXMLTextEncoderStream *     m_pEnclosingEncoderStream;
00270     const CTypeDescriptor *     m_pRefType;
00271     unsigned int                m_nDepth;
00272 
00273     void
00274     putElement (
00275       const CElement *          pElement);
00276 
00277     void
00278     put_enum (
00279       int                       eValue,
00280       const CFieldDescriptor *  pFieldDescriptor);
00281 
00282     void
00283     indent(int delta = 0);
00284 
00285     void
00286     appendOpenTag (
00287       const char *              pName);
00288 
00289     void
00290     appendCloseTag (
00291       const char *              pName);
00292 
00293     void
00294     appendPrefixedTagName (
00295       const char *              pName);
00296 
00297     void
00298     appendFormat (
00299       char *                    pFmtStr,
00300                                 ...);
00301 
00302 };
00303 
00304 };

Generated on Wed Nov 26 12:27:45 2008 for LTKCPP-- LLRP Toolkit C Plus Plus Library by  doxygen 1.3.9.1