#include <oilfiles.h>
Inheritance diagram for CCResTextFile:
Public Member Functions | |
CCResTextFile () | |
CCResTextFile (UINT32 ResourceId, UINT32 ResourceType, FileAccess fProt=CCMemRead) | |
Constructs an instance of CCResTextFile and Opens it. | |
~CCResTextFile () | |
Default destructor. | |
BOOL | open (UINT32 ResourceId, UINT32 ResourceType, FileAccess fProt=CCMemRead) |
Opens an instance of a CCResTextFile. | |
BOOL | open (UINT32) |
CCFile & | read (TCHAR &buf) |
Reads a single character from the Memory file. | |
CCFile & | read (StringBase *buf) |
Read in a string from the file. The read operation stops at the first newline, or when the string is full. The newline is removed from the input stream. | |
BOOL | eof () const |
Determines whether an instance of CCResTextFile is open. | |
void | close () |
Closes an instance of a CCResTextFile. |
Definition at line 147 of file oilfiles.h.
|
Definition at line 150 of file oilfiles.h.
|
|
Constructs an instance of CCResTextFile and Opens it.
Definition at line 389 of file oilfiles.cpp. 00390 : CCResourceFile(ResourceId, ResourceType, fProt) 00391 { 00392 }
|
|
Default destructor.
Definition at line 404 of file oilfiles.cpp.
|
|
Closes an instance of a CCResTextFile.
Reimplemented from CCMemFile. Definition at line 583 of file oilfiles.cpp. 00584 { 00585 CCResourceFile::close(); 00586 }
|
|
Determines whether an instance of CCResTextFile is open.
Reimplemented from CCMemFile. Definition at line 560 of file oilfiles.cpp. 00561 { 00562 char* tempResFile = (char*) MemFile; // Cast MemFile to a char pointer 00563 00564 // Changed the '==' to '>=' in the following check on CurrentPos (MarkN 9/5/94) 00565 00566 if ((CurrentPos >= (FileSize - 1)) || (tempResFile[CurrentPos] == END_OF_FILE)) 00567 return TRUE; 00568 else 00569 return FALSE; 00570 }
|
|
Reimplemented from CCResourceFile. Definition at line 427 of file oilfiles.cpp. 00428 { 00429 return CCResourceFile::open( ResourceID ); 00430 }
|
|
Opens an instance of a CCResTextFile.
Definition at line 422 of file oilfiles.cpp. 00423 { 00424 return CCResourceFile::open(ResourceId, ResourceType, fProt); 00425 }
|
|
Read in a string from the file. The read operation stops at the first newline, or when the string is full. The newline is removed from the input stream.
Reimplemented from CCMemFile. Definition at line 496 of file oilfiles.cpp. 00497 { 00498 // Make sure the file is open before it is read! 00499 if (!isOpen()) 00500 { 00501 GotError(_R(IDE_NOTOPEN_ERROR)); 00502 return (CCFile&) *this; 00503 } 00504 00505 // if file is write protected then exit 00506 if (FileProt != CCMemRead) 00507 { 00508 GotError(_R(IDE_WRITE_ONLY)); 00509 return (CCFile&) *this; 00510 } 00511 00512 char* tempResFile = (char*) MemFile; // Cast MemFile to a TCHAR pointer 00513 TCHAR* pString = *buf; // Cast input string to a TCHAR pointer 00514 UINT32 i = 0; 00515 00516 UINT32 Len = buf->MaxLength(); 00517 00518 // Added check for '\n' on 26/4/94 by MarkN 00519 00520 while ((i <= Len) && (!eof()) && (tempResFile[CurrentPos] != '\n') && (tempResFile[CurrentPos] != '\r')) 00521 { 00522 #if FALSE != wxUSE_UNICODE 00523 mbtowc( pString, tempResFile + CurrentPos, 1 ); 00524 ++CurrentPos; 00525 #else 00526 *pString = tempResFile[CurrentPos++]; 00527 #endif 00528 pString++; 00529 i++; 00530 } 00531 00532 if ((tempResFile[CurrentPos] == '\n') || (tempResFile[CurrentPos] == '\r')) 00533 { 00534 CurrentPos++; 00535 00536 // It is possible for the CR to be made up of a \r\n pair , so we have to look for this 00537 if ((!eof()) && ((tempResFile[CurrentPos] == '\n') || (tempResFile[CurrentPos] == '\r'))) 00538 { 00539 CurrentPos++; 00540 } 00541 } 00542 00543 *pString = 0; // Added 26/4/94 by MarkN 00544 00545 return (CCFile&) *this; 00546 }
|
|
Reads a single character from the Memory file.
Reimplemented from CCMemFile. Definition at line 444 of file oilfiles.cpp. 00445 { 00446 // Make sure the file is open before it is read! 00447 if (!isOpen()) 00448 { 00449 GotError(_R(IDE_NOTOPEN_ERROR)); 00450 return (CCFile&) *this; 00451 } 00452 00453 // if file is write protected then exit 00454 if (FileProt != CCMemRead) 00455 { 00456 GotError(_R(IDE_WRITE_ONLY)); 00457 return (CCFile&) *this; 00458 } 00459 00460 char* tempResFile = (char*)MemFile; // Cast MemFile to a TCHAR pointer 00461 00462 if (!eof()) 00463 { 00464 #if FALSE != wxUSE_UNICODE 00465 mbtowc( &buf, tempResFile + CurrentPos, 1 ); 00466 #else 00467 buf = tempResFile[CurrentPos]; 00468 #endif 00469 ++CurrentPos; 00470 } 00471 else 00472 { 00473 GotError(_R(IDE_EOF_ERROR)); 00474 } 00475 00476 return (CCFile&) *this; 00477 }
|