libdap  Updated for version 3.17.0
XMLWriter.h
00001 
00002 // This file is part of libdap, A C++ implementation of the OPeNDAP Data
00003 // Access Protocol.
00004 
00005 // Copyright (c) 2010 OPeNDAP, Inc.
00006 // Author: James Gallagher <jgallagher@opendap.org>
00007 //
00008 // This library is free software; you can redistribute it and/or
00009 // modify it under the terms of the GNU Lesser General Public
00010 // License as published by the Free Software Foundation; either
00011 // version 2.1 of the License, or (at your option) any later version.
00012 //
00013 // This library is distributed in the hope that it will be useful,
00014 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00015 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00016 // Lesser General Public License for more details.
00017 //
00018 // You should have received a copy of the GNU Lesser General Public
00019 // License along with this library; if not, write to the Free Software
00020 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
00021 //
00022 // You can contact OPeNDAP, Inc. at PO Box 112, Saunderstown, RI. 02874-0112.
00023 /*
00024  * XMLWriter.h
00025  *
00026  *  Created on: Jul 28, 2010
00027  *      Author: jimg
00028  */
00029 
00030 #ifndef XMLWRITER_H_
00031 #define XMLWRITER_H_
00032 
00033 #include <libxml/xmlwriter.h>
00034 
00035 #include <string>
00036 
00037 namespace libdap {
00038 
00039 class XMLWriter {
00040 private:
00041     // Various xml writer stuff
00042     xmlTextWriterPtr d_writer;
00043     xmlBufferPtr d_doc_buf;
00044     bool d_started;
00045     bool d_ended;
00046 
00047     std::string d_doc;
00048 
00049     void m_cleanup() ;
00050 
00051 public:
00052     XMLWriter(const std::string &pad = "    ");
00053     virtual ~XMLWriter();
00054 
00055     xmlTextWriterPtr get_writer() const { return d_writer; }
00056     const char *get_doc();
00057     unsigned int get_doc_size();
00058 };
00059 
00060 } // namespace libdap
00061 
00062 #endif /* XMLWRITER_H_ */