#include <PSDL_Stream.h>
Public Member Functions | |
TAO_PSDL_Stream (void) | |
~TAO_PSDL_Stream (void) | |
int | open (const char *fname) |
Open the file name to be able to write to it. | |
FILE * | file (void) |
Return the underlying lowlevel file pointer. | |
int | incr_indent (unsigned short flag=1) |
int | decr_indent (unsigned short flag=1) |
int | reset (void) |
reset indentation level to 0 | |
int | indent (void) |
indent starting next line | |
int | nl (void) |
put a newline and indent on the next line | |
int | print (const char *format,...) |
"printf" style variable argument print | |
TAO_PSDL_Stream & | operator<< (const char *str) |
TAO_PSDL_Stream & | operator<< (ACE_CString str) |
TAO_PSDL_Stream & | operator<< (const unsigned long num) |
TAO_PSDL_Stream & | operator<< (const long num) |
Private Attributes | |
FILE * | fp_ |
int | indent_level_ |
|
Definition at line 8 of file PSDL_Stream.cpp.
00009 { 00010 } |
|
Definition at line 12 of file PSDL_Stream.cpp.
00013 { 00014 } |
|
decrease the indentation level and by default actually indent the output accordingly Definition at line 65 of file PSDL_Stream.cpp. References indent(), and indent_level_. Referenced by TAO_PSDL_Type_Dcl_Visitor::gen_code_for_si(), TAO_PSDL_Struct_Visitor::gen_code_for_si(), TAO_PSDL_Struct_Visitor::gen_code_for_sinline(), TAO_PSDL_Interface_Visitor::print_class_for_interface(), TAO_PSDL_Struct_Visitor::print_class_for_structure(), TAO_PSDL_Interface_Visitor::print_for_forward_dcl(), TAO_PSDL_Type_Dcl_Visitor::print_for_sequence_typedefs(), and TAO_PSDL_Module_Visitor::visit_module().
00066 { 00067 this->indent_level_--; 00068 // Just in case somebody gets "unindent happy". 00069 if (this->indent_level_ < 0) 00070 { 00071 // ACE_DEBUG ((LM_DEBUG, "negative indentation?\n")); 00072 this->indent_level_ = 0; 00073 } 00074 00075 if (flag != 0) 00076 { 00077 return this->indent (); 00078 } 00079 else 00080 { 00081 // Do not indent output. 00082 return 0; 00083 } 00084 } |
|
Return the underlying lowlevel file pointer.
Definition at line 42 of file PSDL_Stream.cpp. References fp_.
00043 { 00044 return this->fp_; 00045 } |
|
increment the indentation level and by default actually indent the output accordingly Definition at line 48 of file PSDL_Stream.cpp. References indent(), and indent_level_. Referenced by TAO_PSDL_Type_Dcl_Visitor::gen_code_for_si(), TAO_PSDL_Struct_Visitor::gen_code_for_si(), TAO_PSDL_Struct_Visitor::gen_code_for_sinline(), TAO_PSDL_Interface_Visitor::print_class_for_interface(), TAO_PSDL_Struct_Visitor::print_class_for_structure(), TAO_PSDL_Interface_Visitor::print_for_forward_dcl(), TAO_PSDL_Type_Dcl_Visitor::print_for_sequence_typedefs(), and TAO_PSDL_Module_Visitor::visit_module().
00049 { 00050 indent_level_++; 00051 00052 if (flag != 0) 00053 { 00054 return this->indent (); 00055 } 00056 else 00057 { 00058 // Do not indent output. 00059 return 0; 00060 } 00061 } |
|
indent starting next line
Definition at line 95 of file PSDL_Stream.cpp. References ACE_OS::fflush(), ACE_OS::fprintf(), and indent_level_. Referenced by decr_indent(), TAO_PSDL_Type_Dcl_Visitor::gen_code_for_si(), TAO_PSDL_Struct_Visitor::gen_code_for_si(), incr_indent(), nl(), TAO_PSDL_Typecode_Defn::visit_type_declarator(), and TAO_PSDL_Struct_Visitor::visit_type_spec().
00096 { 00097 // Based on the current indentation level, leave appropriate number of blank 00098 // spaces in the output. 00099 if (this->indent_level_ > 0) 00100 { 00101 for (int i = 0; i < this->indent_level_; i++) 00102 { 00103 ACE_OS::fprintf (this->fp_, " "); 00104 ACE_OS::fflush (this->fp_); 00105 } 00106 } 00107 00108 return 0; 00109 } |
|
|
Open the file name to be able to write to it.
Definition at line 17 of file PSDL_Stream.cpp. References ACE_OS::fopen(), and fp_. Referenced by TAO_PSDL_Scope::get_sh(), TAO_PSDL_Scope::get_si(), and TAO_PSDL_Scope::get_sinline().
00018 { 00019 if (fname != 0) 00020 { 00021 // File name exists, open an I/O file handle. 00022 this->fp_ = ACE_OS::fopen (fname, "w"); 00023 00024 if (this->fp_ != 0) 00025 { 00026 return 0; 00027 } 00028 else 00029 { 00030 return -1; 00031 } 00032 } 00033 else 00034 { 00035 return -1; 00036 } 00037 } |
|
Definition at line 150 of file PSDL_Stream.cpp. References ACE_OS::fflush(), and ACE_OS::fprintf().
00151 { 00152 ACE_OS::fprintf (this->fp_, 00153 "%ld", 00154 num); 00155 00156 ACE_OS::fflush (this->fp_); 00157 return *this; 00158 } |
|
Definition at line 138 of file PSDL_Stream.cpp. References ACE_OS::fflush(), and ACE_OS::fprintf().
00139 { 00140 ACE_OS::fprintf (this->fp_, 00141 "%lu", 00142 num); 00143 00144 ACE_OS::fflush (this->fp_); 00145 00146 return *this; 00147 } |
|
Definition at line 129 of file PSDL_Stream.cpp. References ACE_OS::fflush(), and ACE_OS::fprintf().
00130 { 00131 ACE_OS::fprintf (this->fp_, "%s", str.c_str ()); 00132 ACE_OS::fflush (this->fp_); 00133 00134 return *this; 00135 } |
|
Definition at line 120 of file PSDL_Stream.cpp. References ACE_OS::fflush(), and ACE_OS::fprintf().
00121 { 00122 ACE_OS::fprintf (this->fp_, "%s", str); 00123 ACE_OS::fflush (this->fp_); 00124 00125 return *this; 00126 } |
|
"printf" style variable argument print
|
|
reset indentation level to 0
Definition at line 87 of file PSDL_Stream.cpp. References indent_level_. Referenced by TAO_PSDL_Type_Dcl_Visitor::gen_code_for_si(), TAO_PSDL_Struct_Visitor::gen_code_for_si(), TAO_PSDL_Struct_Visitor::gen_code_for_sinline(), TAO_PSDL_Scope::header_initialization(), TAO_PSDL_Interface_Visitor::print_for_forward_dcl(), TAO_PSDL_Type_Dcl_Visitor::print_for_simple_typedefs(), TAO_PSDL_Scope::stub_initialization(), TAO_PSDL_Interface_Visitor::visit_forward_dcl(), and TAO_PSDL_Struct_Visitor::visit_predefined_type().
00088 { 00089 this->indent_level_ = 0; 00090 return 0; 00091 } |
|
Definition at line 81 of file PSDL_Stream.h. |
|
Definition at line 84 of file PSDL_Stream.h. Referenced by decr_indent(), incr_indent(), indent(), and reset(). |