bypass-core-1.0
Main Page
Namespaces
Data Structures
Files
File List
Globals
element.h
Go to the documentation of this file.
1
//
2
// Copyright 2013 Uncodin, Inc.
3
//
4
// Licensed under the Apache License, Version 2.0 (the "License");
5
// you may not use this file except in compliance with the License.
6
// You may obtain a copy of the License at
7
//
8
// http://www.apache.org/licenses/LICENSE-2.0
9
//
10
// Unless required by applicable law or agreed to in writing, software
11
// distributed under the License is distributed on an "AS IS" BASIS,
12
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
// See the License for the specific language governing permissions and
14
// limitations under the License.
15
//
16
17
#ifndef _BYPASS_ELEMENT_H_
18
#define _BYPASS_ELEMENT_H_
19
20
#include <string>
21
#include <vector>
22
#include <map>
23
#include <iostream>
24
#include <set>
25
26
namespace
Bypass {
27
28
enum
Type
{
29
30
// Block Element Types
31
32
BLOCK_CODE
= 0x000,
33
BLOCK_QUOTE
= 0x001,
34
BLOCK_HTML
= 0x002,
35
HEADER
= 0x003,
36
HRULE
= 0x004,
37
LIST
= 0x005,
38
LIST_ITEM
= 0x006,
39
PARAGRAPH
= 0x007,
40
TABLE
= 0x008,
41
TABLE_CELL
= 0x009,
42
TABLE_ROW
= 0x00A,
43
44
// Span Element Types
45
46
AUTOLINK
= 0x10B,
47
CODE_SPAN
= 0x10C,
48
DOUBLE_EMPHASIS
= 0x10D,
49
EMPHASIS
= 0x10E,
50
IMAGE
= 0x10F,
51
LINEBREAK
= 0x110,
52
LINK
= 0x111,
53
RAW_HTML_TAG
= 0x112,
54
TRIPLE_EMPHASIS
= 0x113,
55
TEXT
= 0x114,
56
STRIKETHROUGH
= 0x115
57
};
58
67
class
Element
{
68
public
:
69
74
typedef
std::map<std::string, std::string>
AttributeMap
;
75
79
Element
();
80
84
~Element
();
85
86
std::string
text
;
87
92
void
setText
(
const
std::string&
text
);
93
97
const
std::string&
getText
();
98
110
void
addAttribute
(
const
std::string& name,
const
std::string& value);
111
117
std::string
getAttribute
(
const
std::string& name);
118
122
AttributeMap::iterator
attrBegin
();
123
127
AttributeMap::iterator
attrEnd
();
128
132
size_t
attrSize
()
const
;
133
138
void
append
(
const
Element
& blockElement);
139
145
Element
getChild
(
size_t
i);
146
152
Element
operator[]
(
size_t
i);
153
158
void
setType
(
Type
type);
159
164
Type
getType
();
165
169
bool
isBlockElement
();
170
174
bool
isSpanElement
();
175
179
size_t
size
();
180
friend
std::ostream&
operator<<
(std::ostream& out,
const
Element
& element);
181
private
:
182
AttributeMap
attributes;
183
std::vector<Element> children;
184
Type
type;
185
};
186
187
}
188
189
#endif // _BYPASS_ELEMENT_H_
src
element.h
Generated on Fri Jul 26 2013 16:01:35 for bypass-core-1.0 by
1.8.2