MCPcopy Create free account
hub / github.com/davisking/dlib / print

Method print

dlib/cpp_pretty_printer/cpp_pretty_printer_kernel_1.h:127–506  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

125 typename tok
126 >
127 void cpp_pretty_printer_kernel_1<stack,tok>::
128 print (
129 std::istream& in,
130 std::ostream& out,
131 const std::string& title
132 ) const
133 {
134 if (!out)
135 throw std::ios::failure("error occurred in cpp_pretty_printer_kernel_1::print");
136
137 t.set_stream(in);
138
139 out << "<html><!-- "
140 << "Created using the cpp_pretty_printer from the dlib C++ library. See http://dlib.net for updates."
141 << " --><head><title>" << title << "</title></head><body bgcolor='white'><pre>\n";
142 if (!out)
143 throw std::ios::failure("error occurred in cpp_pretty_printer_kernel_1::print");
144
145 unsigned long scope = 0; // counts the number of new scopes we have entered
146 // since we were at a scope where functions can be declared
147
148 bool recently_seen_class_keyword = false;
149 // true if we have seen the keywords class, struct, or enum and
150 // we have not seen any identifiers or { characters
151
152 bool recently_seen_include = false;
153 // true if we have seen the #include keyword and have not seen double
154 // quoted text or >
155
156 bool recently_seen_new_scope = false;
157 // true if we have seen the keywords class, namespace, or struct and
158 // we have not seen the characters {, ), or ; since then
159
160 bool recently_seen_paren = false;
161 // true if we have seen a ) and we have only seen white_space or comments since
162
163 bool in_initialization_list = false;
164 // true if we have seen a ) followed by any white space or comments and then
165 // followed by a : (in scope==0 with recently_seen_preprocessor==false) and we
166 // have not yet seen the character { or ;
167
168 bool recently_seen_preprocessor = false;
169 // true if we have seen the #pragma or #if or #define or #elif keywords and have
170 // not seen an end of line.
171
172 bool recently_seen_extern = false;
173 // true if we have seen the extern keyword and haven't seen a ; or { yet.
174
175 unsigned long paren_count = 0;
176 // this is the number of ( we have seen minus the number of ) we have
177 // seen.
178
179
180 int type;
181 stack scopes; // a stack to hold old scopes
182 std::string token, temp;
183 t.get_token(type,token);
184 while (type != tok::END_OF_FILE)

Callers

nothing calls this directly

Calls 7

htmlifyFunction · 0.85
clearMethod · 0.45
sizeMethod · 0.45
getMethod · 0.45
emptyMethod · 0.45
pushMethod · 0.45
popMethod · 0.45

Tested by

no test coverage detected