00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00021 #ifndef MemBufFormatTarget_HEADER_GUARD_
00022 #define MemBufFormatTarget_HEADER_GUARD_
00023 
00024 #include <xercesc/framework/XMLFormatter.hpp>
00025 
00026 XERCES_CPP_NAMESPACE_BEGIN
00027 
00028 
00029 
00030 
00031 
00032 
00033 
00034 
00035 
00036 
00037 
00038 
00039 
00040 
00041 
00042 
00043 
00044 class  MemBufFormatTarget : public XMLFormatTarget {
00045 public:
00046 
00049     MemBufFormatTarget
00050     (
00051           int                  initCapacity = 1023
00052         , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
00053     ) ;
00054     ~MemBufFormatTarget();
00056 
00057     
00058     
00059     
00060     virtual void writeChars(const XMLByte* const toWrite
00061                           , const unsigned int   count
00062                           , XMLFormatter* const  formatter);
00063 
00064     
00065     
00066     
00074     const XMLByte* getRawBuffer() const;
00075 
00083     unsigned int getLen() const
00084     {
00085         return fIndex;
00086     }
00087 
00094     void reset();
00096 
00097 private:
00098     
00099     
00100     
00101     MemBufFormatTarget(const MemBufFormatTarget&);
00102     MemBufFormatTarget& operator=(const MemBufFormatTarget&);
00103 
00104     
00105     
00106     
00107     void insureCapacity(const unsigned int extraNeeded);
00108 
00109     
00110     
00111     
00112     
00113     
00114     
00115     
00116     
00117     
00118     
00119     
00120     
00121     
00122     
00123     
00124     
00125     MemoryManager*  fMemoryManager;
00126     XMLByte*        fDataBuf;
00127     unsigned int    fIndex;
00128     unsigned int    fCapacity;
00129 
00130 };
00131 
00132 XERCES_CPP_NAMESPACE_END
00133 
00134 #endif
00135