QCAD
Open Source 2D CAD
Loading...
Searching...
No Matches
opennurbs_textlog.h
Go to the documentation of this file.
1/* $NoKeywords: $ */
2/*
3//
4// Copyright (c) 1993-2007 Robert McNeel & Associates. All rights reserved.
5// Rhinoceros is a registered trademark of Robert McNeel & Assoicates.
6//
7// THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY.
8// ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR PURPOSE AND OF
9// MERCHANTABILITY ARE HEREBY DISCLAIMED.
10//
11// For complete openNURBS copyright information see <http://www.opennurbs.org>.
12//
14*/
15
16#if !defined(ON_TEXTLOG_INC_)
17#define ON_TEXTLOG_INC_
18
20{
21public:
22 /*
23 Description:
24 Create a text log that dumps to the virtual function
25 void ON_TextLog::AppendText().
26 */
27 ON_TextLog();
28
29 /*
30 Description:
31 Create a text log that dumps to an ASCII file.
32 Parameters:
33 fp - [in] Pointer to an open ASCII text file. The file
34 pointer must remain valid as long as the text
35 log is in use.
36 */
37 ON_TextLog( FILE* fp); // dump to open ASCII text file
38
39 /*
40 Description:
41 Create a text log that dumps to a string.
42 Parameters:
43 s - [in] String that must exist as long as
44 the text log is in use.
45 */
47
48 virtual ~ON_TextLog();
49
50 void SetDoubleFormat( const char* ); // default is %g
51 void GetDoubleFormat( ON_String& ) const;
52
53 void SetFloatFormat( const char* ); // default is %g
54 void GetFloatFormat( ON_String& ) const;
55
56 void PushIndent();
57 void PopIndent();
58 int IndentSize() const; // 0: one tab per indent
59 // >0: number of spaces per indent
60 void SetIndentSize(int);
61
62 void PrintWrappedText( const char*, int = 60 ); // last arg is maximum line length
63 void PrintWrappedText( const wchar_t*, int = 60 ); // last arg is maximum line length
64
65 /*
66 Description:
67 Print a formatted ASCII string of up to 2000 characters.
68 Parameters:
69 format - [in] NULL terminated format control string
70 Remarks:
71 To print strings longer than 2000 characters, you must
72 use ON_TextLog::PrintString.
73 See Also:
74 ON_TextLog::PrintString
75 */
76 void Print( const char* format, ... );
77
78 /*
79 Description:
80 Print a formatted INICODE string of up to 2000 characters.
81 Parameters:
82 format - [in] NULL terminated format control string
83 Remarks:
84 To print strings longer than 2000 characters, you must
85 use ON_TextLog::PrintString.
86 See Also:
87 ON_TextLog::PrintString
88 */
89 void Print( const wchar_t* format, ... );
90
91 void Print( float );
92 void Print( double );
93 void Print( const ON_2dPoint& );
94 void Print( const ON_3dPoint& );
95 void Print( const ON_4dPoint& );
96 void Print( const ON_2dVector& );
97 void Print( const ON_3dVector& );
98 void Print( const ON_Xform& );
99 void Print( const ON_UUID& );
100 void Print( const ON_COMPONENT_INDEX& );
101
102 /*
103 Description:
104 Print an unformatted UNICODE string of any length.
105 Parameters:
106 string - [in]
107 */
108 void Print( const ON_wString& string );
109
110 /*
111 Description:
112 Print an unformatted ASCII string of any length.
113 Parameters:
114 string - [in]
115 */
116 void Print( const ON_String& string );
117
118 void Print( const ON_3dPointArray&, const char* = NULL );
119 void Print(
120 const ON_Matrix&,
121 const char* = NULL, // optional preamble
122 int = 0 // optional number precision
123 );
124
125 // printing utilities
126
127 /*
128 Description:
129 Print an unformatted ASCII string of any length.
130 Parameters:
131 s - [in] NULL terminated ASCII string.
132 */
133 void PrintString( const char* s );
134
135 /*
136 Description:
137 Print an unformatted UNICODE string of any length.
138 Parameters:
139 s - [in] NULL terminated UNICODE string.
140 */
141 void PrintString( const wchar_t* s );
142
143 void PrintRGB( const ON_Color& );
144
145 void PrintTime( const struct tm& );
146
147 void PrintPointList(
148 int, // dim
149 ON_BOOL32, // true for rational points
150 int, // count
151 int, // stride
152 const double*, // point[] array
153 const char* = NULL // optional preabmle
154 );
155
156 void PrintPointGrid(
157 int, // dim
158 ON_BOOL32, // true for rational points
159 int, int, // point_count0, point_count1
160 int, int, // point_stride0, point_stride1
161 const double*, // point[] array
162 const char* = NULL // optional preabmle
163 );
164
165 void PrintKnotVector(
166 int, // order
167 int, // cv_count
168 const double* // knot[] array
169 );
170
171 ON_TextLog& operator<<( const char* );
172 ON_TextLog& operator<<( char );
173 ON_TextLog& operator<<( short );
174 ON_TextLog& operator<<( int );
175 ON_TextLog& operator<<( float );
176 ON_TextLog& operator<<( double );
182 ON_TextLog& operator<<( const ON_Xform& );
183
184protected:
185 FILE* m_pFile;
187
188
189 /*
190 Description:
191 If the ON_TextLog(ON_wString& wstr) constructor was used, the
192 default appends s to wstr. If the ON_TextLog(FILE* fp)
193 constructor was used, the default calls fputs( fp, s).
194 In all other cases, the default calls printf("%s",s).
195 Parameters:
196 s - [in];
197 */
198 virtual
199 void AppendText(
200 const char* s
201 );
202
203 /*
204 Description:
205 If the ON_TextLog(ON_wString& wstr) constructor was used, the
206 default appends s to wstr. In all other cases, the default
207 converts the string to an ON_String and calls the ASCII
208 version AppendText(const char*).
209 Parameters:
210 s - [in];
211 */
212 virtual
213 void AppendText(
214 const wchar_t* s
215 );
216
217private:
227
229
231 int m_indent_size; // 0 use tabs, > 0 = number of spaces per indent level
232
233private:
234 // no implementation
237
238};
239
241int ON_CrashTest( int crash_type, ON_TextLog& text_log );
242
243#endif
QDebug operator<<(QDebug dbg, const RBox &b)
Stream operator for QDebug.
Definition RBox.cpp:640
Definition opennurbs_point.h:253
Definition opennurbs_point.h:655
Definition opennurbs_array.h:398
Definition opennurbs_point.h:403
Definition opennurbs_point.h:931
Definition opennurbs_point.h:555
Definition opennurbs_color.h:24
Definition opennurbs_matrix.h:22
Definition opennurbs_string.h:150
Definition opennurbs_textlog.h:20
ON_String m_float2_format
Definition opennurbs_textlog.h:224
ON_wString * m_pString
Definition opennurbs_textlog.h:186
ON_String m_double4_format
Definition opennurbs_textlog.h:222
ON_String m_line
Definition opennurbs_textlog.h:228
ON_String m_indent
Definition opennurbs_textlog.h:218
FILE * m_pFile
Definition opennurbs_textlog.h:185
ON_String m_double3_format
Definition opennurbs_textlog.h:221
ON_String m_float3_format
Definition opennurbs_textlog.h:225
ON_String m_double2_format
Definition opennurbs_textlog.h:220
ON_TextLog & operator=(const ON_TextLog &)
ON_String m_double_format
Definition opennurbs_textlog.h:219
ON_TextLog(const ON_TextLog &)
int m_indent_size
Definition opennurbs_textlog.h:231
ON_String m_float4_format
Definition opennurbs_textlog.h:226
int m_beginning_of_line
Definition opennurbs_textlog.h:230
ON_String m_float_format
Definition opennurbs_textlog.h:223
Definition opennurbs_uuid.h:31
Definition opennurbs_xform.h:28
Definition opennurbs_string.h:392
Used to print the given document with the settings stored inside the document or the default settings...
Definition Print.js:99
#define ON_DECL
Definition opennurbs_defines.h:92
#define ON_CLASS
Definition opennurbs_defines.h:91
char s
Definition opennurbs_string.cpp:32
#define NULL
Definition opennurbs_system.h:256
int ON_BOOL32
Definition opennurbs_system.h:362
ON_DECL int ON_CrashTest(int crash_type, ON_TextLog &text_log)