/src/libetonyek/src/lib/KEY1ParserState.h
Line | Count | Source |
1 | | /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
2 | | /* |
3 | | * This file is part of the libetonyek project. |
4 | | * |
5 | | * This Source Code Form is subject to the terms of the Mozilla Public |
6 | | * License, v. 2.0. If a copy of the MPL was not distributed with this |
7 | | * file, You can obtain one at http://mozilla.org/MPL/2.0/. |
8 | | */ |
9 | | |
10 | | #ifndef KEY1PARSERSTATE_H_INCLUDED |
11 | | #define KEY1PARSERSTATE_H_INCLUDED |
12 | | |
13 | | #include "IWORKXMLParserState.h" |
14 | | |
15 | | namespace libetonyek |
16 | | { |
17 | | |
18 | | class KEY1Parser; |
19 | | class KEYCollector; |
20 | | struct KEY1Dictionary; |
21 | | |
22 | | enum KEY1BulletType |
23 | | { |
24 | | KEY1_BULLETTYPE_CHARACTER, |
25 | | KEY1_BULLETTYPE_IMAGE, |
26 | | KEY1_BULLETTYPE_INHERITED, |
27 | | KEY1_BULLETTYPE_SEQUENCE, |
28 | | KEY1_BULLETTYPE_NONE |
29 | | }; |
30 | | |
31 | | struct KEY1Bullet |
32 | | { |
33 | | KEY1Bullet() |
34 | 0 | : m_type(KEY1_BULLETTYPE_NONE) |
35 | 0 | , m_level() |
36 | 0 | , m_spacing() |
37 | 0 | { |
38 | 0 | } |
39 | | KEY1BulletType m_type; |
40 | | boost::optional<int> m_level; |
41 | | boost::optional<double> m_spacing; |
42 | | }; |
43 | | |
44 | | class KEY1ParserState : public IWORKXMLParserState |
45 | | { |
46 | | // not copyable |
47 | | KEY1ParserState(const KEY1ParserState &); |
48 | | KEY1ParserState &operator=(const KEY1ParserState &); |
49 | | |
50 | | public: |
51 | | KEY1ParserState(KEY1Parser &parser, KEYCollector &collector, KEY1Dictionary &dict); |
52 | | |
53 | | KEY1Dictionary &getDictionary(); |
54 | | KEYCollector &getCollector(); |
55 | | |
56 | | void pushIsPrototype(bool isPrototype); |
57 | | void popIsPrototype(); |
58 | | void pushIsMasterSlide(bool isMasterSlide); |
59 | | void popIsMasterSlide(); |
60 | | |
61 | | void openBullets(); |
62 | | void openBullet(KEY1Bullet const &bullet); |
63 | | void closeBullet(); |
64 | | void closeBullets(); |
65 | | bool m_isPrototype; |
66 | | bool m_isMasterSlide; |
67 | | |
68 | | private: |
69 | | void storeCurrentPlaceholder(); |
70 | | |
71 | | KEY1Dictionary &m_dict; |
72 | | KEYCollector &m_collector; |
73 | | |
74 | | std::deque<bool> m_prototypes; |
75 | | std::deque<bool> m_masterSlides; |
76 | | |
77 | | bool m_isBulletOpened; |
78 | | bool m_isBulletsOpened; |
79 | | |
80 | | bool m_isBodyContentOpened; |
81 | | bool m_isTitleContentOpened; |
82 | | bool m_bodyContentFound; |
83 | | bool m_titleContentFound; |
84 | | }; |
85 | | |
86 | | } |
87 | | |
88 | | #endif // KEY1PARSERSTATE_H_INCLUDED |
89 | | |
90 | | /* vim:set shiftwidth=2 softtabstop=2 expandtab: */ |