summaryrefslogtreecommitdiff
path: root/src/lib/SW602SubDocument.h
blob: 44369eaf8da95a52da5c00a0e66c9268e239a842 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/*
 * This file is part of the libsw602 project.
 *
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 */

#ifndef INCLUDED_SW602_SUB_DOCUMENT_H
#define INCLUDED_SW602_SUB_DOCUMENT_H

#include <boost/shared_ptr.hpp>

#include <librevenge/librevenge.h>

#include "SW602Entry.h"
#include "SW602Types.h"

namespace libsw602
{

class SW602Parser;

/** abstract class used to store a subdocument (with a comparison function) */
class SW602SubDocument
{
public:
  //! constructor from parser, input stream and zone in the input
  SW602SubDocument(SW602Parser *pars, boost::shared_ptr<librevenge::RVNGInputStream> ip, SW602Entry const &z);
  //! copy constructor
  explicit SW602SubDocument(SW602SubDocument const &doc);
  //! copy operator
  SW602SubDocument &operator=(SW602SubDocument const &doc);
  //! virtual destructor
  virtual ~SW602SubDocument();

  //! comparison operator!=
  virtual bool operator!=(SW602SubDocument const &doc) const;
  //! comparison operator==
  bool operator==(SW602SubDocument const &doc) const
  {
    return !operator!=(doc);
  }
  //! comparison operator!=
  bool operator!=(boost::shared_ptr<SW602SubDocument> const &doc) const;
  //! comparison operator==
  bool operator==(boost::shared_ptr<SW602SubDocument> const &doc) const
  {
    return !operator!=(doc);
  }

  /** virtual parse function
   *
   * this function is called to parse the subdocument */
  virtual void parse(SW602ListenerPtr &listener, libsw602::SubDocumentType subDocumentType) = 0;

protected:
  //! the main zone parser
  SW602Parser *m_parser;
  //! the input
  boost::shared_ptr<librevenge::RVNGInputStream> m_input;
  //! if valid the zone to parse
  SW602Entry m_zone;
};

}

#endif

/* vim:set shiftwidth=2 softtabstop=2 expandtab: */