Changeset 7161 for code/branches/presentation3/src/libraries/util
- Timestamp:
- Jul 28, 2010, 8:29:32 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/presentation3/src/libraries/util/Serialise.h
r7127 r7161 53 53 template <class T> inline bool checkEquality( const T& variable, uint8_t* mem ); 54 54 55 56 // =========== char* 57 58 inline uint32_t returnSize( char*& variable ) 59 { 60 return strlen(variable)+1; 61 } 62 63 inline void saveAndIncrease( char*& variable, uint8_t*& mem ) 64 { 65 strcpy((char*)mem, variable); 66 mem += returnSize(variable); 67 } 68 69 inline void loadAndIncrease( char*& variable, uint8_t*& mem ) 70 { 71 if( variable ) 72 delete variable; 73 uint32_t len = strlen((char*)mem)+1; 74 variable = new char[len]; 75 strcpy((char*)variable, (char*)mem); 76 mem += len; 77 } 78 79 inline bool checkEquality( char*& variable, uint8_t* mem ) 80 { 81 return strcmp(variable, (char*)mem)==0; 82 } 83 55 84 // =================== Template specialisation stuff ============= 56 85 … … 394 423 return memcmp(&temp, mem, sizeof(uint64_t))==0; 395 424 } 396 425 397 426 // =========== string 398 427
Note: See TracChangeset
for help on using the changeset viewer.