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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
|
#include <IceUtil/OutputUtil.h>
#ifndef CONFLUENCE_OUTPUT
#define CONFLUENCE_OUTPUT
namespace Confluence
{
// ----------------------------------------------------------------------
// ConfluenceOutput
// ----------------------------------------------------------------------
class ICE_UTIL_API ConfluenceOutput : public IceUtilInternal::OutputBase
{
public:
ConfluenceOutput();
ConfluenceOutput(std::ostream&);
ConfluenceOutput(const char*);
virtual ~ConfluenceOutput(){};
virtual void print(const char*); // Print a string.
virtual void newline(); // Print newline.
void startElement(const std::string&); // Start an element.
void endElement(); // End an element.
void attr(const std::string&, const std::string&); // Add an attribute to an element.
std::string convertCommentHTML(std::string comment);
std::string escapeComment(std::string comment);
std::string getAnchorMarkup(const std::string&, const std::string& = "");
std::string getLinkMarkup(const std::string&, const std::string& = "", const std::string& = "", const std::string& = "");
std::string getImageMarkup(const std::string&, const std::string& = "");
std::string getNavMarkup(const std::string&, const std::string&);
void startEscapes();
void endEscapes();
std::string currentElement() const;
private:
std::string escape(const ::std::string&) const;
std::stack<std::string> _elementStack;
bool _se;
bool _text;
bool _escape;
std::string _listMarkers;
std::string _commentListMarkers;
};
template<typename T>
inline ConfluenceOutput&
operator<<(ConfluenceOutput& out, const T& val)
{
std::ostringstream s;
s << val;
out.print(s.str().c_str());
return out;
}
template<>
inline ConfluenceOutput&
operator<<(ConfluenceOutput& o, const IceUtilInternal::NextLine&)
{
o.newline();
return o;
}
template<>
inline ConfluenceOutput&
operator<<(ConfluenceOutput& o, const IceUtilInternal::Separator&)
{
o.separator();
return o;
}
class ICE_UTIL_API EndElement
{
};
extern ICE_UTIL_API EndElement ee;
template<>
inline ConfluenceOutput&
operator<<(ConfluenceOutput& o, const EndElement&)
{
o.endElement();
return o;
}
class ICE_UTIL_API StartElement
{
public:
StartElement(const std::string&);
const std::string& getName() const;
private:
const std::string _name;
};
typedef StartElement se;
template<>
inline ConfluenceOutput&
operator<<(ConfluenceOutput& o, const StartElement& e)
{
o.startElement(e.getName());
return o;
}
class ICE_UTIL_API Attribute
{
public:
Attribute(const ::std::string&, const ::std::string&);
const ::std::string& getName() const;
const ::std::string& getValue() const;
private:
const ::std::string _name;
const ::std::string _value;
};
typedef Attribute attr;
template<>
inline ConfluenceOutput&
operator<<(ConfluenceOutput& o, const Attribute& e)
{
o.attr(e.getName(), e.getValue());
return o;
}
class ICE_UTIL_API StartEscapes
{
};
extern ICE_UTIL_API StartEscapes startEscapes;
class ICE_UTIL_API EndEscapes
{
};
extern ICE_UTIL_API EndEscapes endEscapes;
template<>
inline ConfluenceOutput&
operator<<(ConfluenceOutput& o, const StartEscapes&)
{
o.startEscapes();
return o;
}
template<>
inline ConfluenceOutput&
operator<<(ConfluenceOutput& o, const EndEscapes&)
{
o.endEscapes();
return o;
}
ICE_UTIL_API ConfluenceOutput& operator<<(ConfluenceOutput&, std::ios_base& (*)(std::ios_base&));
}
#endif
|