Lines Matching refs:to
10 * Unless required by applicable law or agreed to in writing, software
44 void ClassDecl::Write(CodeWriter* to) const {
45 to->Write("class %s ", name_.c_str());
48 to->Write(": public %s ", parent_.c_str());
50 to->Write("{\n");
53 to->Write("public:\n");
56 dec->Write(to);
59 to->Write("private:\n");
62 dec->Write(to);
64 to->Write("}; // class %s\n", name_.c_str());
84 void Enum::Write(CodeWriter* to) const {
86 to->Write("enum %s {\n", enum_name_.c_str());
88 to->Write("enum %s : %s {\n", enum_name_.c_str(), underlying_type_.c_str());
92 to->Write(" %s,\n", field.key.c_str());
94 to->Write(" %s = %s,\n", field.key.c_str(), field.value.c_str());
97 to->Write("};\n");
119 void ArgList::Write(CodeWriter* to) const {
120 to->Write("(");
123 if (!is_first) { to->Write(", "); }
125 s->Write(to);
127 to->Write(")");
143 void ConstructorDecl::Write(CodeWriter* to) const {
145 to->Write("virtual ");
148 to->Write("explicit ");
150 to->Write("%s", name_.c_str());
152 arguments_.Write(to);
155 to->Write(" = default");
157 to->Write(";\n");
177 void MethodDecl::Write(CodeWriter* to) const {
179 to->Write("virtual ");
181 to->Write("%s %s", return_type_.c_str(), name_.c_str());
183 arguments_.Write(to);
186 to->Write(" const");
189 to->Write(" override");
192 to->Write(" = 0");
194 to->Write(";\n");
215 void StatementBlock::Write(CodeWriter* to) const {
216 to->Write("{\n");
218 statement->Write(to);
220 to->Write("}\n");
230 void ConstructorImpl::Write(CodeWriter* to) const {
231 to->Write("%s::%s", class_name_.c_str(), class_name_.c_str());
232 arguments_.Write(to);
233 to->Write("\n");
238 to->Write(" : %s", i.c_str());
240 to->Write(",\n %s", i.c_str());
245 body_.Write(to);
266 void MethodImpl::Write(CodeWriter* to) const {
267 to->Write("%s %s", return_type_.c_str(), method_name_.c_str());
268 arguments_.Write(to);
269 to->Write("%s ", (is_const_method_) ? " const" : "");
270 statements_.Write(to);
288 void SwitchStatement::Write(CodeWriter* to) const {
289 to->Write("switch (%s) {\n", switch_expression_.c_str());
294 to->Write("default:\n");
296 to->Write("case %s:\n", case_value.c_str());
298 statements->Write(to);
299 to->Write("break;\n");
301 to->Write("}\n");
312 void Assignment::Write(CodeWriter* to) const {
313 to->Write("%s = ", lhs_.c_str());
314 rhs_->Write(to);
315 to->Write(";\n");
327 void MethodCall::Write(CodeWriter* to) const {
328 to->Write("%s", method_name_.c_str());
329 arguments_.Write(to);
336 void IfStatement::Write(CodeWriter* to) const {
337 to->Write("if (%s", (invert_expression_) ? "!(" : "");
338 expression_->Write(to);
339 to->Write(")%s ", (invert_expression_) ? ")" : "");
340 on_true_.Write(to);
343 to->Write("else ");
344 on_false_.Write(to);
356 void Statement::Write(CodeWriter* to) const {
357 expression_->Write(to);
358 to->Write(";\n");
366 void Comparison::Write(CodeWriter* to) const {
367 to->Write("((");
368 left_->Write(to);
369 to->Write(") %s (", operator_.c_str());
370 right_->Write(to);
371 to->Write("))");
377 void LiteralExpression::Write(CodeWriter* to) const {
378 to->Write("%s", expression_.c_str());
394 void CppNamespace::Write(CodeWriter* to) const {
395 to->Write("namespace %s {\n\n", name_.c_str());
398 dec->Write(to);
399 to->Write("\n");
402 to->Write("} // namespace %s\n", name_.c_str());
410 void Document::Write(CodeWriter* to) const {
412 to->Write("#include <%s>\n", include.c_str());
414 to->Write("\n");
416 namespace_->Write(to);
425 void CppHeader::Write(CodeWriter* to) const {
426 to->Write("#ifndef %s\n", include_guard_.c_str());
427 to->Write("#define %s\n\n", include_guard_.c_str());
429 Document::Write(to);
430 to->Write("\n");
432 to->Write("#endif // %s", include_guard_.c_str());