RVNGRawGeneratorBase.h
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
2 /* librevenge
3  * Version: MPL 2.0 / LGPLv2.1+
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  * Major Contributor(s):
10  * Copyright (C) 2002 William Lachance (wrlach@gmail.com)
11  * Copyright (C) 2002-2004 Marc Maurer (uwog@uwog.net)
12  *
13  * For minor contributions see the git repository.
14  *
15  * Alternatively, the contents of this file may be used under the terms
16  * of the GNU Lesser General Public License Version 2.1 or later
17  * (LGPLv2.1+), in which case the provisions of the LGPLv2.1+ are
18  * applicable instead of those above.
19  */
20 
21 #ifndef RVNGRAWGENERATORBASE_H
22 #define RVNGRAWGENERATORBASE_H
23 
24 #include <stack>
25 #include <librevenge/librevenge.h>
26 
27 #ifdef RVNG_CALLGRAPH_ENTER
28 #warning who defined RVNG_CALLGRAPH_ENTER?
29 #undef RVNG_CALLGRAPH_ENTER
30 #endif
31 
32 #define RVNG_CALLGRAPH_ENTER(M, L) \
33  m_impl->m_atLeastOneCallback = true; \
34  if (!m_impl->m_printCallgraphScore) \
35  m_impl->iuprintf M; \
36  else \
37  m_impl->m_callStack.push(L);
38 
39 #ifdef RVNG_CALLGRAPH_LEAVE
40 #warning who defined RVNG_CALLGRAPH_LEAVE?
41 #undef RVNG_CALLGRAPH_LEAVE
42 #endif
43 
44 #define RVNG_CALLGRAPH_LEAVE(M, L) \
45  m_impl->m_atLeastOneCallback = true; \
46  if (!m_impl->m_printCallgraphScore) \
47  m_impl->idprintf M; \
48  else \
49  { \
50  const int lc = m_impl->m_callStack.top(); \
51  if (lc != L) \
52  m_impl->m_callbackMisses++; \
53  m_impl->m_callStack.pop(); \
54  }
55 
56 namespace librevenge
57 {
58 
59 namespace
60 {
61 
62 enum RVNGCallback
63 {
64  CALLBACK_OPEN_ANIMATION_GROUP,
65  CALLBACK_OPEN_ANIMATION_ITERATION,
66  CALLBACK_OPEN_ANIMATION_SEQUENCE,
67  CALLBACK_OPEN_CHART,
68  CALLBACK_OPEN_CHART_TEXTOBJECT,
69  CALLBACK_OPEN_CHART_PLOTAREA,
70  CALLBACK_OPEN_CHART_SERIE,
71  CALLBACK_OPEN_COMMENT,
72  CALLBACK_OPEN_ENDNOTE,
73  CALLBACK_OPEN_FOOTNOTE,
74  CALLBACK_OPEN_FRAME,
75  CALLBACK_OPEN_GRAPHIC,
76  CALLBACK_OPEN_GRAPHIC_LAYER,
77  CALLBACK_OPEN_GRAPHIC_PAGE,
78  CALLBACK_OPEN_GROUP,
79  CALLBACK_OPEN_HEADER_FOOTER,
80  CALLBACK_OPEN_LINK,
81  CALLBACK_OPEN_LIST_ELEMENT,
82  CALLBACK_OPEN_ORDERED_LIST_LEVEL,
83  CALLBACK_OPEN_PAGE_SPAN,
84  CALLBACK_OPEN_PARAGRAPH,
85  CALLBACK_OPEN_SECTION,
86  CALLBACK_OPEN_SHEET,
87  CALLBACK_OPEN_SHEET_CELL,
88  CALLBACK_OPEN_SHEET_ROW,
89  CALLBACK_OPEN_SPAN,
90  CALLBACK_OPEN_TABLE,
91  CALLBACK_OPEN_TABLE_CELL,
92  CALLBACK_OPEN_TABLE_ROW,
93  CALLBACK_OPEN_TEXT_BOX,
94  CALLBACK_OPEN_UNORDERED_LIST_LEVEL,
95  CALLBACK_START_COMMENT,
96  CALLBACK_START_DOCUMENT,
97  CALLBACK_START_EMBEDDED_GRAPHICS,
98  CALLBACK_START_LAYER,
99  CALLBACK_START_NOTES,
100  CALLBACK_START_PAGE,
101  CALLBACK_START_MASTER_PAGE,
102  CALLBACK_START_SLIDE,
103  CALLBACK_START_MASTER_SLIDE,
104  CALLBACK_START_TEXT_OBJECT
105 };
106 
107 } // anonymous namespace
108 
110 {
111  explicit RVNGRawGeneratorBase(bool printCallgraphScore);
112  virtual ~RVNGRawGeneratorBase();
113 
114  int m_indent;
118  std::stack<int> m_callStack;
119 
120  void indentUp()
121  {
122  m_indent++;
123  }
124  void indentDown()
125  {
126  if (m_indent > 0) m_indent--;
127  }
128 
129  void iprintf(const char *format, ...);
130  void iuprintf(const char *format, ...);
131  void idprintf(const char *format, ...);
132 };
133 
134 } // namespace librevenge
135 
136 #endif // RVNGRAWGENERATORBASE_H
137 
138 /* vim:set shiftwidth=4 softtabstop=4 noexpandtab: */
void iuprintf(const char *format,...)
Definition: RVNGRawGeneratorBase.cpp:57
void indentDown()
Definition: RVNGRawGeneratorBase.h:124
int m_callbackMisses
Definition: RVNGRawGeneratorBase.h:115
bool m_printCallgraphScore
Definition: RVNGRawGeneratorBase.h:117
virtual ~RVNGRawGeneratorBase()
Definition: RVNGRawGeneratorBase.cpp:40
void iprintf(const char *format,...)
Definition: RVNGRawGeneratorBase.cpp:44
void indentUp()
Definition: RVNGRawGeneratorBase.h:120
bool m_atLeastOneCallback
Definition: RVNGRawGeneratorBase.h:116
Definition: RVNGRawGeneratorBase.h:109
void idprintf(const char *format,...)
Definition: RVNGRawGeneratorBase.cpp:69
std::stack< int > m_callStack
Definition: RVNGRawGeneratorBase.h:118
RVNGRawGeneratorBase(bool printCallgraphScore)
Definition: RVNGRawGeneratorBase.cpp:31
int m_indent
Definition: RVNGRawGeneratorBase.h:114

Generated for librevenge by doxygen 1.8.5