TAO_PSDL_Stream Class Reference

#include <PSDL_Stream.h>

List of all members.

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_Streamoperator<< (const char *str)
TAO_PSDL_Streamoperator<< (ACE_CString str)
TAO_PSDL_Streamoperator<< (const unsigned long num)
TAO_PSDL_Streamoperator<< (const long num)

Private Attributes

FILE * fp_
int indent_level_


Constructor & Destructor Documentation

TAO_PSDL_Stream::TAO_PSDL_Stream void   ) 
 

Definition at line 8 of file PSDL_Stream.cpp.

00009 {
00010 }

TAO_PSDL_Stream::~TAO_PSDL_Stream void   ) 
 

Definition at line 12 of file PSDL_Stream.cpp.

00013 {
00014 }


Member Function Documentation

int TAO_PSDL_Stream::decr_indent unsigned short  flag = 1  ) 
 

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 }

FILE * TAO_PSDL_Stream::file void   ) 
 

Return the underlying lowlevel file pointer.

Definition at line 42 of file PSDL_Stream.cpp.

References fp_.

00043 {
00044   return this->fp_;
00045 }

int TAO_PSDL_Stream::incr_indent unsigned short  flag = 1  ) 
 

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 }

int TAO_PSDL_Stream::indent void   ) 
 

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 }

int TAO_PSDL_Stream::nl void   ) 
 

put a newline and indent on the next line

Definition at line 112 of file PSDL_Stream.cpp.

References ACE_OS::fprintf(), and indent().

Referenced by TAO_PSDL_Specification::accept(), 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_Enum_Type_Visitor::print_class_for_enum_type(), TAO_PSDL_Exception_Visitor::print_class_for_exception(), TAO_PSDL_Interface_Visitor::print_class_for_interface(), TAO_PSDL_Struct_Visitor::print_class_for_structure(), TAO_PSDL_Interface_Visitor::print_end_for_interface(), TAO_PSDL_Interface_Visitor::print_for_forward_dcl(), TAO_PSDL_Type_Dcl_Visitor::print_for_sequence_typedefs(), TAO_PSDL_Type_Dcl_Visitor::print_for_simple_typedefs(), TAO_PSDL_Scope::stub_initialization(), TAO_PSDL_Interface_Visitor::visit_forward_dcl(), TAO_PSDL_Module_Visitor::visit_module(), and TAO_PSDL_Struct_Visitor::visit_predefined_type().

00113 {
00114   ACE_OS::fprintf (this->fp_, "\n");
00115   this->indent ();
00116   return 0;
00117 }

int TAO_PSDL_Stream::open const char *  fname  ) 
 

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 }

TAO_PSDL_Stream & TAO_PSDL_Stream::operator<< const long  num  ) 
 

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 }

TAO_PSDL_Stream & TAO_PSDL_Stream::operator<< const unsigned long  num  ) 
 

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 }

TAO_PSDL_Stream & TAO_PSDL_Stream::operator<< ACE_CString  str  ) 
 

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 }

TAO_PSDL_Stream & TAO_PSDL_Stream::operator<< const char *  str  ) 
 

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 }

int TAO_PSDL_Stream::print const char *  format,
... 
 

"printf" style variable argument print

int TAO_PSDL_Stream::reset void   ) 
 

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 }


Member Data Documentation

FILE* TAO_PSDL_Stream::fp_ [private]
 

Definition at line 81 of file PSDL_Stream.h.

Referenced by file(), and open().

int TAO_PSDL_Stream::indent_level_ [private]
 

Definition at line 84 of file PSDL_Stream.h.

Referenced by decr_indent(), incr_indent(), indent(), and reset().


The documentation for this class was generated from the following files:
Generated on Thu Nov 9 14:10:29 2006 for TAO_PSS by doxygen 1.3.6