#include <archive.h>
Protected Member Functions | |
CCArchive (const CCArchive &Src) | |
Copy Constuctor. Since the coping of Archives is not permitted, this just fails with an ERROR3. | |
void | operator= (const CCArchive &Src) |
Stops Archives from being copied as this is not permitted. Always fails with an Error3. DO NOT CALL THIS FUNCTION. | |
Protected Attributes | |
CCLexFile * | pFile |
BOOL | IsLoadArchive |
BOOL | IsArchiveOK |
Private Types | |
enum | { Load = 1, Save = 2 } |
Private Member Functions | |
CC_DECLARE_MEMDUMP (CCArchive) | |
CCArchive (CCLexFile *pNewFile, UINT32 Mode) | |
Constructs a new CCArchive object. The Archive class assumes the following things about the size of objects. | |
~CCArchive () | |
Destructor. | |
void | Close () |
Flushes and closes the CCArchive. After this has been done, you can not write any more data to it. | |
CCArchive & | operator>> (INT32 &) |
CCArchive & | operator>> (BYTE &) |
Loads a primitive item out of the archive into the variable. This function will throw an ArchiveExeption if there is an error. | |
CCArchive & | operator>> (WORD &) |
CCArchive & | operator>> (INT32 &) |
CCArchive & | operator>> (DWORD &) |
CCArchive & | operator>> (float &) |
CCArchive & | operator>> (double &) |
CCArchive & | operator<< (INT32) |
CCArchive & | operator<< (BYTE) |
saves a primitive item out of the archive from the variable. This function will throw an ArchiveExeption if there is an error | |
CCArchive & | operator<< (WORD) |
CCArchive & | operator<< (INT32) |
CCArchive & | operator<< (DWORD) |
CCArchive & | operator<< (float) |
CCArchive & | operator<< (double) |
BOOL | IsReady () |
Tests to see if the Archive is ready to save or load data items. This tests that all the files are OK and everything is set up as it should be. You should call this function before starting to use the Loading and Saving operators of this class, though it does only need to be called once at the begining. Individual objects should NOT need to call this function before saving/loading their components as it should have been done before all the Serialise functions are called. | |
BOOL | IsLoading () const |
Determines if this Archive is a loading or saving archive and responds appropriatly. | |
BOOL | IsSaving () const |
Determines if this Archive is a loading or saving archive and responds appropriatly. |
Definition at line 116 of file archive.h.
|
Definition at line 122 of file archive.h.
|
|
Constructs a new CCArchive object. The Archive class assumes the following things about the size of objects.
Definition at line 131 of file archive.cpp. 00132 : pFile(pNewFile), 00133 IsLoadArchive(FALSE), 00134 IsArchiveOK(TRUE) 00135 { 00136 // Find out what sort of Archive we are going to be 00137 if (Mode & CCArchive::Load) 00138 { 00139 // We are loading 00140 IsLoadArchive = TRUE; 00141 } 00142 else if (Mode & CCArchive::Save) 00143 { 00144 // We are saving 00145 IsLoadArchive = FALSE; 00146 } 00147 else 00148 { 00149 // Something is wrong. Mode should be Save or Load 00150 IsArchiveOK = FALSE; 00151 } 00152 }
|
|
Destructor.
Definition at line 165 of file archive.cpp.
|
|
Copy Constuctor. Since the coping of Archives is not permitted, this just fails with an ERROR3.
Definition at line 504 of file archive.cpp. 00505 { 00506 ERROR3("CCArchive classes can not be copied\n"); 00507 }
|
|
|
|
Flushes and closes the CCArchive. After this has been done, you can not write any more data to it.
Definition at line 183 of file archive.cpp. 00184 { 00185 // Close the file associated with the Archive. This should flush the file as well... 00186 pFile->close(); 00187 }
|
|
Determines if this Archive is a loading or saving archive and responds appropriatly.
Definition at line 465 of file archive.cpp. 00466 { 00467 return IsLoadArchive; 00468 }
|
|
Tests to see if the Archive is ready to save or load data items. This tests that all the files are OK and everything is set up as it should be. You should call this function before starting to use the Loading and Saving operators of this class, though it does only need to be called once at the begining. Individual objects should NOT need to call this function before saving/loading their components as it should have been done before all the Serialise functions are called.
Definition at line 437 of file archive.cpp. 00438 { 00439 // Make sure that we have a pointer to a file 00440 if (pFile==NULL) 00441 return FALSE; 00442 00443 // make sure that it is open 00444 if (!pFile->isOpen()) 00445 return FALSE; 00446 00447 // all seemed to be ok. 00448 return TRUE; 00449 }
|
|
Determines if this Archive is a loading or saving archive and responds appropriatly.
Definition at line 483 of file archive.cpp. 00484 { 00485 return !IsLoadArchive; 00486 }
|
|
Definition at line 404 of file archive.cpp. 00405 { 00406 ERROR3IF(sizeof(double)!=8, "double is no longer 8 bytes!\n"); 00407 00408 // Get the double into Intel form 00409 double SaveMe; 00410 DOUBLE_TO_INTEL(Var, SaveMe); 00411 00412 // Save out the Fixed up word 00413 pFile->write(&SaveMe, sizeof(double)); 00414 return *this; 00415 }
|
|
Definition at line 390 of file archive.cpp. 00391 { 00392 ERROR3IF(sizeof(float)!=4, "float is no longer 4 bytes!\n"); 00393 00394 // Get the float into Intel form 00395 float SaveMe; 00396 FLOAT_TO_INTEL(Var, SaveMe); 00397 00398 // Save out the Fixed up word 00399 pFile->write(&SaveMe, sizeof(float)); 00400 return *this; 00401 }
|
|
Definition at line 376 of file archive.cpp. 00377 { 00378 ERROR3IF(sizeof(DWORD)!=4, "DWORD is no longer 4 bytes!\n"); 00379 00380 // Get the DWORD into Intel form 00381 DWORD SaveMe; 00382 DWORD_TO_INTEL(Var, SaveMe); 00383 00384 // Save out the Fixed up word 00385 pFile->write(&SaveMe, sizeof(DWORD)); 00386 return *this; 00387 }
|
|
|
|
Definition at line 347 of file archive.cpp. 00348 { 00349 ERROR3IF(sizeof(WORD)!=2, "WORD is no longer 2 bytes!\n"); 00350 00351 // Get the Word into Intel form 00352 WORD SaveMe; 00353 WORD_TO_INTEL(Var, SaveMe); 00354 00355 // Save out the Fixed up word 00356 pFile->write(&SaveMe, sizeof(WORD)); 00357 return *this; 00358 }
|
|
saves a primitive item out of the archive from the variable. This function will throw an ArchiveExeption if there is an error
Definition at line 324 of file archive.cpp.
|
|
Definition at line 332 of file archive.cpp. 00333 { 00334 ERROR3IF(sizeof(INT32)!=4, "INT32 is no longer 4 bytes!\n"); 00335 00336 // Get the Word into Intel form 00337 INT32 SaveMe; 00338 INT_TO_INTEL(Var, SaveMe); 00339 00340 // Save out the Fixed up word 00341 pFile->write(&SaveMe, sizeof(INT32)); 00342 return *this; 00343 }
|
|
Stops Archives from being copied as this is not permitted. Always fails with an Error3. DO NOT CALL THIS FUNCTION.
Definition at line 524 of file archive.cpp. 00525 { 00526 ERROR3("CCArchive classes can not be assigned to each other\n"); 00527 }
|
|
Definition at line 290 of file archive.cpp. 00291 { 00292 ERROR3IF(sizeof(double)!=8, "double is no longer 8 bytes!\n"); 00293 00294 // Get a float out the Archive 00295 double LoadMe; 00296 pFile->read(&LoadMe, sizeof(double)); 00297 00298 // Fix the float up from Intel format 00299 DOUBLE_FROM_INTEL(LoadMe, Var); 00300 return *this; 00301 }
|
|
Definition at line 276 of file archive.cpp. 00277 { 00278 ERROR3IF(sizeof(float)!=4, "float is no longer 4 bytes!\n"); 00279 00280 // Get a float out the Archive 00281 float LoadMe; 00282 pFile->read(&LoadMe, sizeof(float)); 00283 00284 // Fix the float up from Intel format 00285 FLOAT_FROM_INTEL(LoadMe, Var); 00286 return *this; 00287 }
|
|
Definition at line 262 of file archive.cpp. 00263 { 00264 ERROR3IF(sizeof(DWORD)!=4, "DWORD is no longer 4 bytes!\n"); 00265 00266 // Get a DWORD out the Archive 00267 DWORD LoadMe; 00268 pFile->read(&LoadMe, sizeof(DWORD)); 00269 00270 // Fix the DWORD up from Intel format 00271 DWORD_FROM_INTEL(LoadMe, Var); 00272 return *this; 00273 }
|
|
|
|
Definition at line 234 of file archive.cpp. 00235 { 00236 ERROR3IF(sizeof(WORD)!=2, "WORD is no longer 2 bytes!\n"); 00237 00238 // Get a Word out the Archive 00239 WORD LoadMe; 00240 pFile->read(&LoadMe, sizeof(WORD)); 00241 00242 // Fix the word up from Intel format 00243 WORD_FROM_INTEL(LoadMe, Var); 00244 return *this; 00245 }
|
|
Loads a primitive item out of the archive into the variable. This function will throw an ArchiveExeption if there is an error.
Definition at line 212 of file archive.cpp. 00213 { 00214 // Read an INT32 out of the file 00215 pFile->read(&Var, sizeof(BYTE)); 00216 return *this; 00217 }
|
|
Definition at line 220 of file archive.cpp. 00221 { 00222 ERROR3IF(sizeof(INT32)!=4, "INT32 is no longer 4 bytes!\n"); 00223 00224 // Get a Word out the Archive 00225 INT32 LoadMe; 00226 pFile->read(&LoadMe, sizeof(INT32)); 00227 00228 // Fix the word up from Intel format 00229 INT_FROM_INTEL(LoadMe, Var); 00230 return *this; 00231 }
|
|
|
|
|
|
|