objwriter.h

changeset 16
393359908179
parent 3
08cab2b67dce
child 26
54eaea6dc27c
equal deleted inserted replaced
15:284c2fc6c1cd 16:393359908179
48 class ObjWriter { 48 class ObjWriter {
49 public: 49 public:
50 // ==================================================================== 50 // ====================================================================
51 // MEMBERS 51 // MEMBERS
52 FILE* fp; 52 FILE* fp;
53 unsigned int numWrittenBytes;
53 54
54 // ==================================================================== 55 // ====================================================================
55 // METHODS 56 // METHODS
56 ObjWriter (str path); 57 ObjWriter (str path);
57 ~ObjWriter (); 58 ~ObjWriter ();
59 void WriteString (const char* s); 60 void WriteString (const char* s);
60 void WriteString (str s); 61 void WriteString (str s);
61 62
62 template <class T> void Write (T stuff) { 63 template <class T> void Write (T stuff) {
63 fwrite (&stuff, sizeof (T), 1, fp); 64 fwrite (&stuff, sizeof (T), 1, fp);
65 numWrittenBytes += sizeof (T);
64 } 66 }
65 67
66 // Cannot use default arguments in function templates.. 68 // Cannot use default arguments in function templates..
67 void Write (qbyte stuff) {Write<qbyte> (stuff);} 69 void Write (qbyte stuff) {Write<qbyte> (stuff);}
68 }; 70 };

mercurial