#include <Output.hpp>
Inheritance diagram for Output::
Public Methods | |
char OUTPUT_STATIC | CreateFile (char *filename, int mybufsize=65536) |
void OUTPUT_STATIC | CloseFile () |
void OUTPUT_STATIC | CloseAndDeleteFile () |
void OUTPUT_STATIC | Flush () |
char OUTPUT_STATIC * | GetBufPtr (int *len) |
void OUTPUT_STATIC | SaveBytes (int bytecount) |
int OUTPUT_STATIC | GetCurFileSize () |
void OUTPUT_STATIC | StoreData (char *ptr, int len) |
void OUTPUT_STATIC | StoreInt32 (int val) |
void OUTPUT_STATIC | StoreChar (char c) |
void OUTPUT_STATIC | StoreNewline () |
char OUTPUT_STATIC * | GetDataPtr (int len) |
|
Definition at line 129 of file Output.hpp. 00131 { 00132 Flush(); 00133 if(savefilename!=NULL) 00134 { 00135 if(output!=NULL) 00136 fclose(output); 00137 unlink(savefilename); 00138 } 00139 free(buf); 00140 return; 00141 } |
|
Definition at line 117 of file Output.hpp. 00119 { 00120 Flush(); 00121 if(savefilename!=NULL) 00122 { 00123 if(output!=NULL) 00124 fclose(output); 00125 } 00126 free(buf); 00127 } |
|
Definition at line 71 of file Output.hpp. 00074 { 00075 if(filename==NULL) 00076 { 00077 savefilename=NULL; 00078 output=stdout; 00079 00080 // We allocate the memory 00081 buf=(char *)malloc(mybufsize); 00082 if(buf==NULL) 00083 ExitNoMem(); 00084 00085 #ifdef WIN32 00086 _setmode(_fileno(stdout),_O_BINARY); 00087 #endif 00088 } 00089 else 00090 { 00091 // We allocate the output buffer memory and a little more for the filename 00092 buf=(char *)malloc(mybufsize+strlen(filename)+1); 00093 if(buf==NULL) 00094 ExitNoMem(); 00095 00096 savefilename=buf+mybufsize; 00097 strcpy(savefilename,filename); 00098 00099 // We only open the output file, if strlen(filename)>0. 00100 // Otherwise, no output is performed at all. 00101 // (This is the test-case) 00102 if(strlen(filename)!=0) 00103 { 00104 output=fopen(filename,"wb"); 00105 if(output==NULL) 00106 return 0; 00107 } 00108 else 00109 output=NULL; 00110 } 00111 bufsize=mybufsize; 00112 curpos=0; 00113 overallsize=0; 00114 return 1; 00115 } |
|
Definition at line 143 of file Output.hpp. 00145 { 00146 overallsize+=curpos; 00147 00148 if(output==NULL) 00149 { 00150 curpos=0; 00151 return; 00152 } 00153 00154 char *ptr=buf; 00155 int byteswritten; 00156 00157 // We write the output between '0' and 'curpos' 00158 // We only write at most 30000 bytes - to avoid some glitches 00159 // in the implementation of 'fwrite'. 00160 00161 while(curpos>0) 00162 { 00163 byteswritten=fwrite(ptr,1,(curpos<30000) ? curpos : 30000,output); 00164 if(byteswritten==0) 00165 { 00166 Error("Could not write output file!"); 00167 Exit(); 00168 } 00169 curpos-=byteswritten; 00170 ptr+=byteswritten; 00171 } 00172 } |
|
Definition at line 174 of file Output.hpp. 00176 { 00177 *len=bufsize-curpos; 00178 return buf+curpos; 00179 } |
|
Definition at line 188 of file Output.hpp. 00188 { return overallsize+curpos; } |
|
Definition at line 246 of file Output.hpp. Referenced by XMLOutput::attribWhitespaces(), XMLOutput::endElement(), XMLOutput::endEmptyElement(), and XMLOutput::startAttribute().
|
|
Definition at line 181 of file Output.hpp. 00184 { 00185 curpos+=bytecount; 00186 } |
|
Definition at line 218 of file Output.hpp. Referenced by XMLOutput::characters(), XMLOutput::endAttribute(), and XMLOutput::startElement().
00220 { 00221 if(bufsize-curpos<1) 00222 Flush(); 00223 00224 buf[curpos]=c; 00225 curpos++; 00226 } |
|
Definition at line 193 of file Output.hpp. Referenced by XMLOutput::characters(), and XMLOutput::startElement().
|
|
Definition at line 208 of file Output.hpp. 00210 { 00211 if(bufsize-curpos<4) 00212 Flush(); 00213 00214 *(int *)(buf+curpos)=val; 00215 curpos+=4; 00216 } |
|
Definition at line 228 of file Output.hpp. |