opennurbs_textlog.h
Go to the documentation of this file.
00001 /* $NoKeywords: $ */
00002 /*
00003 //
00004 // Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved.
00005 // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert
00006 // McNeel & Associates.
00007 //
00008 // THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY.
00009 // ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR PURPOSE AND OF
00010 // MERCHANTABILITY ARE HEREBY DISCLAIMED.
00011 //                              
00012 // For complete openNURBS copyright information see <http://www.opennurbs.org>.
00013 //
00015 */
00016 
00017 #if !defined(ON_TEXTLOG_INC_)
00018 #define ON_TEXTLOG_INC_
00019 
00020 #include <pcl/pcl_exports.h>
00021 
00022 class PCL_EXPORTS ON_CLASS ON_TextLog
00023 {
00024 public:
00025   /*
00026   Description:
00027     Create a text log that dumps to the virtual function
00028     void ON_TextLog::AppendText().
00029   */
00030   ON_TextLog();
00031 
00032   /*
00033   Description:
00034     Create a text log that dumps to an ASCII file.
00035   Parameters:
00036     fp - [in] Pointer to an open ASCII text file.  The file
00037               pointer must remain valid as long as the text
00038               log is in use.
00039   */
00040   ON_TextLog( FILE* fp); // dump to open ASCII text file
00041 
00042   /*
00043   Description:
00044     Create a text log that dumps to a string.
00045   Parameters:
00046     s - [in] String that must exist as long as
00047              the text log is in use.
00048   */
00049   ON_TextLog( ON_wString& s );
00050 
00051   virtual ~ON_TextLog();
00052 
00053   void SetDoubleFormat( const char* ); // default is %g
00054   void GetDoubleFormat( ON_String& ) const;
00055 
00056   void SetFloatFormat( const char* ); // default is %g
00057   void GetFloatFormat( ON_String& ) const;
00058 
00059   void PushIndent();
00060   void PopIndent();
00061   int IndentSize() const; //  0: one tab per indent
00062                           // >0: number of spaces per indent
00063   void SetIndentSize(int);
00064   
00065   void PrintWrappedText( const char*, int = 60 );    // last arg is maximum line length
00066   void PrintWrappedText( const wchar_t*, int = 60 ); // last arg is maximum line length
00067 
00068   /*
00069   Description:
00070     Print a formatted ASCII string of up to 2000 characters.
00071   Parameters:
00072     format - [in] NULL terminated format control string 
00073   Remarks:
00074     To print strings longer than 2000 characters, you must
00075     use ON_TextLog::PrintString.
00076   See Also:
00077     ON_TextLog::PrintString
00078   */
00079   void Print( const char* format, ... );
00080 
00081   /*
00082   Description:
00083     Print a formatted INICODE string of up to 2000 characters.
00084   Parameters:
00085     format - [in] NULL terminated format control string 
00086   Remarks:
00087     To print strings longer than 2000 characters, you must
00088     use ON_TextLog::PrintString.
00089   See Also:
00090     ON_TextLog::PrintString
00091   */
00092   void Print( const wchar_t* format, ... );
00093 
00094   void Print( float );
00095   void Print( double );
00096   void Print( const ON_2dPoint& );
00097   void Print( const ON_3dPoint& );
00098   void Print( const ON_4dPoint& );
00099   void Print( const ON_2dVector& );
00100   void Print( const ON_3dVector& );
00101   void Print( const ON_Xform& );
00102   void Print( const ON_UUID& );
00103   void Print( const ON_COMPONENT_INDEX& );
00104 
00105   /*
00106   Description:
00107     Print an unformatted UNICODE string of any length.
00108   Parameters:
00109     string - [in]
00110   */
00111   void Print( const ON_wString& string );
00112 
00113   /*
00114   Description:
00115     Print an unformatted ASCII string of any length.
00116   Parameters:
00117     string - [in]
00118   */
00119   void Print( const ON_String& string );
00120 
00121   void Print( const ON_3dPointArray&, const char* = NULL );
00122   void Print( 
00123          const ON_Matrix&, 
00124          const char* = NULL, // optional preamble
00125          int = 0             // optional number precision
00126     );
00127 
00128   // printing utilities
00129   /*
00130   Description:
00131     Same as calling Print("\n");
00132   */
00133   void PrintNewLine();
00134 
00135   /*
00136   Description:
00137     Print an unformatted ASCII string of any length.
00138   Parameters:
00139     s - [in] NULL terminated ASCII string.
00140   */
00141   void PrintString( const char* s );
00142 
00143   /*
00144   Description:
00145     Print an unformatted UNICODE string of any length.
00146   Parameters:
00147     s - [in] NULL terminated UNICODE string.
00148   */
00149   void PrintString( const wchar_t* s );
00150 
00151   void PrintRGB( const ON_Color& );
00152 
00153   void PrintTime( const struct tm& );
00154 
00155   void PrintPointList( 
00156     int,               // dim
00157     ON_BOOL32,              // true for rational points
00158     int,               // count
00159     int,               // stride
00160     const double*,     // point[] array
00161     const char* = NULL // optional preabmle
00162     );
00163 
00164   void PrintPointGrid( 
00165     int,               // dim
00166     ON_BOOL32,              // true for rational points
00167     int, int,          // point_count0, point_count1
00168     int, int,          // point_stride0, point_stride1
00169     const double*,     // point[] array
00170     const char* = NULL // optional preabmle
00171     );
00172     
00173   void PrintKnotVector( 
00174     int,             // order
00175     int,             // cv_count
00176     const double*    // knot[] array
00177     );
00178 
00179   ON_TextLog& operator<<( const char* );
00180   ON_TextLog& operator<<( char );
00181   ON_TextLog& operator<<( short );
00182   ON_TextLog& operator<<( int );
00183   ON_TextLog& operator<<( float );
00184   ON_TextLog& operator<<( double );
00185   ON_TextLog& operator<<( const ON_2dPoint& );
00186   ON_TextLog& operator<<( const ON_3dPoint& );
00187   ON_TextLog& operator<<( const ON_4dPoint& );
00188   ON_TextLog& operator<<( const ON_2dVector& );
00189   ON_TextLog& operator<<( const ON_3dVector& );
00190   ON_TextLog& operator<<( const ON_Xform& );
00191 
00192 protected:
00193   FILE* m_pFile;
00194   ON_wString* m_pString;
00195 
00196   
00197   /*
00198   Description:
00199     If the ON_TextLog(ON_wString& wstr) constructor was used, the
00200     default appends s to wstr.  If the ON_TextLog(FILE* fp) 
00201     constructor was used, the default calls fputs( fp, s).
00202     In all other cases, the default calls printf("%s",s).
00203   Parameters:
00204     s - [in];
00205   */
00206   virtual
00207   void AppendText(
00208         const char* s
00209         );
00210 
00211   /*
00212   Description:
00213     If the ON_TextLog(ON_wString& wstr) constructor was used, the
00214     default appends s to wstr.  In all other cases, the default 
00215     converts the string to an ON_String and calls the ASCII
00216     version AppendText(const char*).
00217   Parameters:
00218     s - [in];
00219   */
00220   virtual
00221   void AppendText(
00222         const wchar_t* s
00223         );
00224                   
00225 private:
00226   ON_String m_indent;
00227   ON_String m_double_format;
00228   ON_String m_double2_format;
00229   ON_String m_double3_format;
00230   ON_String m_double4_format;
00231   ON_String m_float_format;
00232   ON_String m_float2_format;
00233   ON_String m_float3_format;
00234   ON_String m_float4_format;
00235 
00236   ON_String m_line;
00237 
00238   int m_beginning_of_line; // 0
00239   int m_indent_size;       // 0 use tabs, > 0 = number of spaces per indent level
00240 
00241 private:
00242   // no implementation
00243   ON_TextLog( const ON_TextLog& );
00244   ON_TextLog& operator=( const ON_TextLog& );
00245 
00246 };
00247 
00248 
00249 #endif


pcl
Author(s): Open Perception
autogenerated on Wed Aug 26 2015 15:27:03