Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

DOMPrintFormatTarget.cpp

Go to the documentation of this file.
00001 
00005 /* --------------------------------------------------------------
00006 Copyright (C) 2001 LifeLine Networks BV <soap2corba@lifeline.nl>
00007 
00008 This program is free software; you can redistribute it and/or
00009 modify it under the terms of the GNU General Public License
00010 as published by the Free Software Foundation; either
00011 version 2 of the License, or (at your option) any later
00012 version.
00013 
00014 This program is distributed in the hope that it will be useful,
00015 but WITHOUT ANY WARRANTY; without even the implied warranty of
00016 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017 GNU General Public License for more details.
00018 
00019 You should have received a copy of the GNU General Public License
00020 along with this program; if not, write to the Free Software
00021 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00022 -------------------------------------------------------------- */
00023 
00024 #include "Parser.h"
00025 
00027 // Construction/Destruction
00029 
00030 DOMPrintFormatTarget::DOMPrintFormatTarget()
00031 {
00032     outSiz = 16384;
00033     outBuf = new unsigned char [outSiz];
00034     outPtr = 0;
00035 }
00036 
00037 DOMPrintFormatTarget::~DOMPrintFormatTarget()
00038 {
00039 }
00040 
00041 void DOMPrintFormatTarget::writeChars (const XMLByte* const toWrite,
00042     const unsigned int count, XMLFormatter* const formatter)
00043 {
00044     if (outPtr + count > outSiz) {
00045         outSiz <<= 1;
00046         unsigned char *tmpBuf = new unsigned char [outSiz];
00047         if (outPtr) {
00048             memcpy (tmpBuf, outBuf, outPtr);
00049         }
00050         delete outBuf;
00051         outBuf = tmpBuf;
00052     }
00053     if (outPtr + count > outSiz) {
00054         generalLog->error ("Absurdly large XML encountered!\n");
00055         throw ("Absurdly large XML encountered!\n");
00056     }
00057     memcpy (outBuf + outPtr, toWrite, count);
00058     outPtr += count;
00059 };
00060     
00061 
00068 ostream& operator<< (ostream& target, const DOMString& s)
00069 {
00070     char *p = s.transcode();
00071     target << p;
00072     delete [] p;
00073     return target;
00074 }
00075 
00076 

This documentation is part of the "SOAP to CORBA bridge" project
Copyright © 2000 by Lifeline Networks bv.
All rights are reserved.