Objective Systems, Inc.  
Home
About ASN.1
Products
Free Software
Documents
Services
Resources
Resellers
Customers
Careers
About Us
Contact Us
 

Google


Objective Systems, Inc.

rtXmlCppMsgBuf.h

Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 2003-2006 Objective Systems, Inc.
00003  *
00004  * This software is furnished under a license and may be used and copied
00005  * only in accordance with the terms of such license and with the
00006  * inclusion of the above copyright notice. This software or any other
00007  * copies thereof may not be provided or otherwise made available to any
00008  * other person. No title to and ownership of the software is hereby
00009  * transferred.
00010  *
00011  * The information in this software is subject to change without notice
00012  * and should not be construed as a commitment by Objective Systems, Inc.
00013  *
00014  * PROPRIETARY NOTICE
00015  *
00016  * This software is an unpublished work subject to a confidentiality agreement
00017  * and is protected by copyright and trade secret law.  Unauthorized copying,
00018  * redistribution or other use of this work is prohibited.
00019  *
00020  * The above notice of copyright on this source code product does not indicate
00021  * any actual or intended publication of such source code.
00022  *
00023  *****************************************************************************/
00027 #ifndef _RTXMLCPPMSGBUF_H_
00028 #define _RTXMLCPPMSGBUF_H_
00029 
00030 #include "rtxsrc/rtxCppMsgBuf.h"
00031 #include "rtxsrc/rtxCppInputStream.h"
00032 #include "rtxsrc/rtxCppOutputStream.h"
00033 #include "rtxmlsrc/osrtxml.h"
00034 #include "rtxmlsrc/rtSaxCppParser.h"
00035 
00044 class EXTERNXML OSXMLMessageBuffer : public OSMessageBuffer {
00045  protected:
00055    OSXMLMessageBuffer (Type bufferType, OSContext* pContext = 0);
00056 
00057  public:
00062    virtual void* getAppInfo ();
00063 
00070    int getIndent ();
00071 
00079    int getIndentChar ();
00080    
00090    virtual void setNamespace 
00091       (const OSUTF8CHAR* prefix, const OSUTF8CHAR* uri);
00092 
00100    virtual void setAppInfo (void* pAppInfo);
00101 
00114    void setFormatting (OSBOOL doFormatting);
00115 
00121    void setIndent (OSUINT8 indent);
00122 
00128    void setIndentChar (char indentChar);
00129 
00130 } ;
00131 
00137 class EXTERNXML OSXMLEncodeBuffer : public OSXMLMessageBuffer {
00138  protected:
00139    OSXMLEncodeBuffer (OSContext* pContext) : 
00140       OSXMLMessageBuffer (XMLEncode, pContext) {}
00141  public:
00145    OSXMLEncodeBuffer ();
00146 
00157    OSXMLEncodeBuffer (OSOCTET* pMsgBuf, size_t msgBufLen);
00158 
00165    virtual size_t getMsgLen () { 
00166       return getByteIndex();
00167    }
00168 
00176    virtual void init ();
00177 
00193    virtual OSBOOL isA (Type bufferType) {
00194       return bufferType == XMLEncode;
00195    }
00196 
00207    virtual long write (const char* filename);
00208 
00220    virtual long write (FILE* fp);
00221 } ;
00222 
00229 class EXTERNXML OSXMLEncodeStream : public OSXMLMessageBuffer {
00230  protected:
00231    OSOutputStream* mpStream;
00232    OSBOOL mbOwnStream;
00233  public:
00241    OSXMLEncodeStream (OSOutputStream& outputStream);
00242 
00252    OSXMLEncodeStream (OSOutputStream* pOutputStream, OSBOOL ownStream = TRUE);
00253 
00254    ~OSXMLEncodeStream ();
00255 
00271    virtual OSBOOL isA (Type bufferType) {
00272       return bufferType == XMLEncode;
00273    }
00274 
00275    virtual const OSOCTET* getMsgPtr () { return 0; }
00276 } ;
00277 
00288 class EXTERNXML OSXMLDecodeBuffer : public OSXMLMessageBuffer {
00289  protected:
00290    union {
00291       const char* fileName;
00292       OSInputStream* pInputStream;
00293       struct {
00294          const OSOCTET* pMemBuf;
00295          size_t         bufSize;
00296       } memBuf;
00297    } mInput;
00298    enum {
00299       INPUT_FILE,
00300       INPUT_STREAM,
00301       INPUT_STREAM_ATTACHED,
00302       INPUT_MEMORY
00303    } mInputId;
00304 
00305    void initContextData ();
00306  public:
00307 
00314    OSXMLDecodeBuffer (const char* xmlFile);
00315 
00323    OSXMLDecodeBuffer (const OSOCTET* msgbuf, size_t bufsiz);
00324 
00332    OSXMLDecodeBuffer (OSInputStream& inputStream);
00333 
00334    ~OSXMLDecodeBuffer ();
00335 
00348    int decodeXML (OSXMLReader* pReader);
00349 
00361    int parseElementName (OSUTF8CHAR** ppName);
00362 
00374    int parseElemQName (OSXMLQName* pQName);
00375 
00376    OSUINT32 setMaxErrors (OSUINT32 maxErrors);
00377 
00384    inline const char* getXmlFileName() { 
00385       return (mInputId == INPUT_FILE) ? mInput.fileName : 0; 
00386    }
00387 
00388    virtual OSBOOL isA (Type bufferType) {
00389       return bufferType == XMLDecode;
00390    }
00391 
00392 } ;
00393 
00394 #endif

This file was last modified on 8 Jan 2007.
XBinder, Version 1.1.9