68 Matrix (double vals[]); |
67 Matrix (double vals[]); |
69 |
68 |
70 double getDeterminant() const; |
69 double getDeterminant() const; |
71 Matrix mult (Matrix other) const; |
70 Matrix mult (Matrix other) const; |
72 void puts() const; |
71 void puts() const; |
73 str stringRep() const; |
72 QString stringRep() const; |
74 void zero(); |
73 void zero(); |
75 Matrix& operator= (Matrix other); |
74 Matrix& operator= (Matrix other); |
76 |
75 |
77 inline double& val (int idx) |
76 inline double& val (int idx) |
78 { |
77 { |
120 Vertex (double x, double y, double z); |
119 Vertex (double x, double y, double z); |
121 |
120 |
122 double distanceTo (const Vertex& other) const; |
121 double distanceTo (const Vertex& other) const; |
123 Vertex midpoint (const Vertex& other); |
122 Vertex midpoint (const Vertex& other); |
124 void move (const Vertex& other); |
123 void move (const Vertex& other); |
125 str stringRep (bool mangled) const; |
124 QString stringRep (bool mangled) const; |
126 void transform (Matrix matr, Vertex pos); |
125 void transform (Matrix matr, Vertex pos); |
127 |
126 |
128 Vertex& operator+= (const Vertex& other); |
127 Vertex& operator+= (const Vertex& other); |
129 Vertex operator+ (const Vertex& other) const; |
128 Vertex operator+ (const Vertex& other) const; |
130 Vertex operator/ (const double d) const; |
129 Vertex operator/ (const double d) const; |
191 // Used as the argument type to the formatting functions, hence its name. |
190 // Used as the argument type to the formatting functions, hence its name. |
192 // ============================================================================= |
191 // ============================================================================= |
193 class StringFormatArg |
192 class StringFormatArg |
194 { |
193 { |
195 public: |
194 public: |
196 StringFormatArg (const str& v); |
195 StringFormatArg (const QString& v); |
197 StringFormatArg (const char& v); |
196 StringFormatArg (const char& v); |
198 StringFormatArg (const uchar& v); |
197 StringFormatArg (const uchar& v); |
199 StringFormatArg (const QChar& v); |
198 StringFormatArg (const QChar& v); |
200 |
199 |
201 #define NUMERIC_FORMAT_ARG(T,C) \ |
200 #define NUMERIC_FORMAT_ARG(T,C) \ |
282 Write, |
281 Write, |
283 Append |
282 Append |
284 }; |
283 }; |
285 |
284 |
286 File(); |
285 File(); |
287 File (str path, File::OpenType rtype); |
286 File (QString path, File::OpenType rtype); |
288 File (FILE* fp, File::OpenType rtype); |
287 File (FILE* fp, File::OpenType rtype); |
289 ~File(); |
288 ~File(); |
290 |
289 |
291 bool atEnd() const; |
290 bool atEnd() const; |
292 iterator begin(); |
291 iterator begin(); |
293 void close(); |
292 void close(); |
294 iterator& end(); |
293 iterator& end(); |
295 bool flush(); |
294 bool flush(); |
296 bool isNull() const; |
295 bool isNull() const; |
297 bool readLine (str& line); |
296 bool readLine (QString& line); |
298 void rewind(); |
297 void rewind(); |
299 bool open (FILE* fp, OpenType rtype); |
298 bool open (FILE* fp, OpenType rtype); |
300 bool open (str path, OpenType rtype, FILE* fp = null); |
299 bool open (QString path, OpenType rtype, FILE* fp = null); |
301 void write (str msg); |
300 void write (QString msg); |
302 |
301 |
303 bool operator!() const; |
302 bool operator!() const; |
304 operator bool() const; |
303 operator bool() const; |
305 |
304 |
306 inline str getPath() const { return m_path; } |
305 inline QString getPath() const { return m_path; } |
307 |
306 |
308 private: |
307 private: |
309 QFile* m_file; |
308 QFile* m_file; |
310 QTextStream* m_textstream; |
309 QTextStream* m_textstream; |
311 iterator m_endIterator; |
310 iterator m_endIterator; |
312 str m_path; |
311 QString m_path; |
313 }; |
312 }; |
314 |
313 |
315 // ============================================================================= |
314 // ============================================================================= |
316 // LDBoundingBox |
315 // LDBoundingBox |
317 // |
316 // |
336 LDBoundingBox& operator<< (LDObject* obj); |
335 LDBoundingBox& operator<< (LDObject* obj); |
337 LDBoundingBox& operator<< (const Vertex& v); |
336 LDBoundingBox& operator<< (const Vertex& v); |
338 }; |
337 }; |
339 |
338 |
340 // Formatter function |
339 // Formatter function |
341 str DoFormat (QList<StringFormatArg> args); |
340 QString DoFormat (QList<StringFormatArg> args); |
342 |
341 |
343 // printf replacement |
342 // printf replacement |
344 void doPrint (File& f, initlist<StringFormatArg> args); |
343 void doPrint (File& f, initlist<StringFormatArg> args); |
345 void doPrint (FILE* f, initlist<StringFormatArg> args); // heh |
344 void doPrint (FILE* f, initlist<StringFormatArg> args); // heh |
346 |
345 |
352 # ifndef IN_IDE_PARSER |
351 # ifndef IN_IDE_PARSER |
353 #define fmt(...) DoFormat ({__VA_ARGS__}) |
352 #define fmt(...) DoFormat ({__VA_ARGS__}) |
354 # define fprint(F, ...) doPrint (F, {__VA_ARGS__}) |
353 # define fprint(F, ...) doPrint (F, {__VA_ARGS__}) |
355 # define log(...) DoLog({ __VA_ARGS__ }) |
354 # define log(...) DoLog({ __VA_ARGS__ }) |
356 #else |
355 #else |
357 str fmt (const char* fmtstr, ...); |
356 QString fmt (const char* fmtstr, ...); |
358 void fprint (File& f, const char* fmtstr, ...); |
357 void fprint (File& f, const char* fmtstr, ...); |
359 void log (const char* fmtstr, ...); |
358 void log (const char* fmtstr, ...); |
360 #endif |
359 #endif |
361 |
360 |
362 extern File g_file_stdout; |
361 extern File g_file_stdout; |