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 WPXPropertyListVector;
46 class WPXString;
47 
50 {
51 public:
55  virtual ~MWAWPropertyHandler() {}
56 
58  virtual void startElement(const char *psName, const WPXPropertyList &xPropList) = 0;
60  virtual void startElement(const char *psName, const WPXPropertyList &xPropList,
61  const WPXPropertyListVector &vect);
63  virtual void startElement(const char *psName, const WPXPropertyList &xPropList,
64  const WPXBinaryData &data);
66  virtual void endElement(const char *psName) = 0;
68  virtual void insertElement(const char *psName);
70  virtual void characters(WPXString const &sCharacters) = 0;
71 
73  bool checkData(WPXBinaryData const &encoded);
75  bool readData(WPXBinaryData const &encoded);
76 };
77 
100 {
101 public:
104 
106  void startElement(const char *psName, const WPXPropertyList &xPropList);
108  void startElement(const char *psName, const WPXPropertyList &xPropList,
109  const WPXPropertyListVector &vect);
111  void startElement(const char *psName, const WPXPropertyList &xPropList,
112  const WPXBinaryData &data);
114  void insertElement(const char *psName);
116  void endElement(const char *psName);
118  void characters(WPXString const &sCharacters);
120  bool getData(WPXBinaryData &data);
121 
122 protected:
124  void writeInteger(int val) {
125  writeLong(long(val));
126  }
128  void writeLong(long val);
130  void writeString(const char *name);
132  void writeProperty(const char *key, const WPXProperty &prop);
134  void writePropertyList(const WPXPropertyList &prop);
135 
137  std::stringstream m_f;
138 };
139 
140 #endif
141 // vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab:

Generated on Thu Apr 24 2014 14:47:42 for libmwaw by doxygen 1.8.3.1