MWAWPropertyHandler.hxx
Go to the documentation of this file.
1 /* -*- Mode: C++; c-default-style: "k&r"; indent-tabs-mode: nil; tab-width: 2; c-basic-offset: 2 -*- */
2 
3 /* libmwaw
4 * Version: MPL 2.0 / LGPLv2+
5 *
6 * The contents of this file are subject to the Mozilla Public License Version
7 * 2.0 (the "License"); you may not use this file except in compliance with
8 * the License or as specified alternatively below. You may obtain a copy of
9 * the License at http://www.mozilla.org/MPL/
10 *
11 * Software distributed under the License is distributed on an "AS IS" basis,
12 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
13 * for the specific language governing rights and limitations under the
14 * License.
15 *
16 * Major Contributor(s):
17 * Copyright (C) 2002 William Lachance (wrlach@gmail.com)
18 * Copyright (C) 2002,2004 Marc Maurer (uwog@uwog.net)
19 * Copyright (C) 2004-2006 Fridrich Strba (fridrich.strba@bluewin.ch)
20 * Copyright (C) 2006, 2007 Andrew Ziem
21 * Copyright (C) 2011, 2012 Alonso Laurent (alonso@loria.fr)
22 *
23 *
24 * All Rights Reserved.
25 *
26 * For minor contributions see the git repository.
27 *
28 * Alternatively, the contents of this file may be used under the terms of
29 * the GNU Lesser General Public License Version 2 or later (the "LGPLv2+"),
30 * in which case the provisions of the LGPLv2+ are applicable
31 * instead of those above.
32 */
33 
34 #ifndef MWAW_PROPERTY_HANDLER
35 # define MWAW_PROPERTY_HANDLER
36 
37 # include <assert.h>
38 # include <ostream>
39 # include <sstream>
40 # include <string>
41 
42 class WPXBinaryData;
43 class WPXProperty;
44 class WPXPropertyList;
45 class WPXString;
46 
49 {
50 public:
54  virtual ~MWAWPropertyHandler() {}
55 
57  virtual void startElement(const char *psName, const WPXPropertyList &xPropList) = 0;
59  virtual void endElement(const char *psName) = 0;
61  virtual void characters(WPXString const &sCharacters) = 0;
62 
64  bool checkData(WPXBinaryData const &encoded);
66  bool readData(WPXBinaryData const &encoded);
67 };
68 
83 {
84 public:
87 
89  void startElement(const char *psName, const WPXPropertyList &xPropList);
91  void endElement(const char *psName);
93  void characters(std::string const &sCharacters);
95  bool getData(WPXBinaryData &data);
96 
97 protected:
99  void writeString(const char *name);
100 
102  void writeInteger(int val);
103 
105  std::stringstream m_f;
106 };
107 
108 #endif
109 // vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab:
void startElement(const char *psName, const WPXPropertyList &xPropList)
starts an element
Definition: MWAWPropertyHandler.cxx:57
virtual void startElement(const char *psName, const WPXPropertyList &xPropList)=0
starts an element
void characters(std::string const &sCharacters)
writes a list of characters
Definition: MWAWPropertyHandler.cxx:76
virtual ~MWAWPropertyHandler()
destructor
Definition: MWAWPropertyHandler.hxx:54
write in WPXBinaryData a list of tags/and properties
Definition: MWAWPropertyHandler.hxx:82
bool checkData(WPXBinaryData const &encoded)
checks a encoded WPXBinaryData created by MWAWPropertyHandlerEncoder
Definition: MWAWPropertyHandler.cxx:284
void writeInteger(int val)
adds an integer value in f
Definition: MWAWPropertyHandler.cxx:93
MWAWPropertyHandlerEncoder()
constructor
Definition: MWAWPropertyHandler.cxx:51
bool getData(WPXBinaryData &data)
retrieves the data
Definition: MWAWPropertyHandler.cxx:100
virtual void endElement(const char *psName)=0
ends an element
MWAWPropertyHandler()
constructor
Definition: MWAWPropertyHandler.hxx:52
virtual void characters(WPXString const &sCharacters)=0
writes a list of characters
void writeString(const char *name)
adds a string : size and string
Definition: MWAWPropertyHandler.cxx:86
std::stringstream m_f
the streamfile
Definition: MWAWPropertyHandler.hxx:105
bool readData(WPXBinaryData const &encoded)
reads a encoded WPXBinaryData created by MWAWPropertyHandlerEncoder
Definition: MWAWPropertyHandler.cxx:290
void endElement(const char *psName)
ends an element
Definition: MWAWPropertyHandler.cxx:70
a generic property handler
Definition: MWAWPropertyHandler.hxx:48

Generated on Fri May 2 2014 15:21:32 for libmwaw by doxygen 1.8.5