libvisio_xml.h
Go to the documentation of this file.
00001 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
00002 /*
00003  * This file is part of the libvisio project.
00004  *
00005  * This Source Code Form is subject to the terms of the Mozilla Public
00006  * License, v. 2.0. If a copy of the MPL was not distributed with this
00007  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
00008  */
00009 
00010 #ifndef __LIBVISIO_XML_H__
00011 #define __LIBVISIO_XML_H__
00012 
00013 #include <boost/shared_ptr.hpp>
00014 
00015 #include <librevenge-stream/librevenge-stream.h>
00016 
00017 #include <libxml/xmlreader.h>
00018 
00019 namespace libvisio
00020 {
00021 
00022 struct Colour;
00023 
00024 class XMLErrorWatcher
00025 {
00026   // disable copying
00027   XMLErrorWatcher(const XMLErrorWatcher &);
00028   XMLErrorWatcher &operator=(const XMLErrorWatcher &);
00029 
00030 public:
00031   XMLErrorWatcher();
00032 
00033   bool isError() const;
00034   void setError();
00035 
00036 private:
00037   bool m_error;
00038 };
00039 
00040 // create an xmlTextReader pointer from a librevenge::RVNGInputStream pointer
00041 // needs to be freed using xmlTextReaderFree function.
00042 
00043 xmlTextReaderPtr xmlReaderForStream(librevenge::RVNGInputStream *input,
00044                                     const char *URL,
00045                                     const char *encoding,
00046                                     int options,
00047                                     XMLErrorWatcher *watcher = 0);
00048 
00049 Colour xmlStringToColour(const xmlChar *s);
00050 Colour xmlStringToColour(const boost::shared_ptr<xmlChar> &s);
00051 
00052 long xmlStringToLong(const xmlChar *s);
00053 long xmlStringToLong(const boost::shared_ptr<xmlChar> &s);
00054 
00055 double xmlStringToDouble(const xmlChar *s);
00056 double xmlStringToDouble(const boost::shared_ptr<xmlChar> &s);
00057 
00058 bool xmlStringToBool(const xmlChar *s);
00059 bool xmlStringToBool(const boost::shared_ptr<xmlChar> &s);
00060 
00061 } // namespace libvisio
00062 
00063 #endif // __LIBVISIO_XML_H__
00064 
00065 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */