#include <LocalMacroSpaceManager.hpp>
Public Member Functions | |
MacroSpaceFile (const char *name) | |
~MacroSpaceFile () | |
void | close () |
size_t | openForLoading () |
void | nextMacro (char *name, ManagedRxstring &image, size_t &order) |
void | nextMacro (NameTable names, char *name, ManagedRxstring &image, size_t &order) |
void | setFilePosition (size_t p) |
void | create (size_t count) |
void | writeMacroDescriptor (const char *name, size_t size, size_t order) |
void | read (void *data, size_t length) |
void | read (ManagedRxstring &data, size_t length) |
void | write (const void *data, size_t length) |
void | write (const char *str) |
void | write (size_t i) |
void | write (RXSTRING &data) |
Protected Attributes | |
bool | creating |
const char * | fileName |
SysFile * | fileInst |
size_t | descriptorBase |
size_t | imageBase |
Definition at line 122 of file LocalMacroSpaceManager.hpp.
|
inline |
Definition at line 125 of file LocalMacroSpaceManager.hpp.
MacroSpaceFile::~MacroSpaceFile | ( | ) |
Destructor to force the macro space file to close.
Definition at line 51 of file LocalMacroSpaceManager.cpp.
References SysFile::close(), creating, fileInst, and fileName.
void MacroSpaceFile::close | ( | ) |
Explicitly close the macro space file.
Definition at line 71 of file LocalMacroSpaceManager.cpp.
References SysFile::close(), and fileInst.
Referenced by LocalMacroSpaceManager::loadMacroSpace(), and LocalMacroSpaceManager::saveMacroSpace().
void MacroSpaceFile::create | ( | size_t | count | ) |
Create a macro space file with an initial header table for the indicated number of macros.
count | The number of macros to store in the file. |
Definition at line 195 of file LocalMacroSpaceManager.cpp.
References creating, FILE_CREATION_ERROR, fileInst, fileName, SysFile::open(), RX_O_CREAT, RX_O_TRUNC, RX_O_WRONLY, RX_S_IREAD, RX_S_IWRITE, RX_SH_DENYRW, and write().
Referenced by LocalMacroSpaceManager::saveMacroSpace().
void MacroSpaceFile::nextMacro | ( | char * | name, |
ManagedRxstring & | image, | ||
size_t & | order | ||
) |
Retrieve the next macro from the macrospace file.
name | The returned macro name. |
image | The macro image information. |
order | The macro ordering information. |
Definition at line 124 of file LocalMacroSpaceManager.cpp.
References descriptorBase, imageBase, MacroSpaceDescriptor::imageSize, MacroSpaceDescriptor::name, MacroSpaceDescriptor::position, read(), and setFilePosition().
Referenced by LocalMacroSpaceManager::loadMacroSpace().
void MacroSpaceFile::nextMacro | ( | NameTable | names, |
char * | name, | ||
ManagedRxstring & | image, | ||
size_t & | order | ||
) |
Step to the next macro, reading the information if it is in the target list.
names | The table of names. |
name | The returned name, if read. |
image | The macro image (if read). |
order | The macro order information. |
Definition at line 148 of file LocalMacroSpaceManager.cpp.
References descriptorBase, imageBase, MacroSpaceDescriptor::imageSize, NameTable::inTable(), MacroSpaceDescriptor::name, MacroSpaceDescriptor::position, read(), and setFilePosition().
size_t MacroSpaceFile::openForLoading | ( | ) |
Open a macrospace file for loading.
Definition at line 84 of file LocalMacroSpaceManager.cpp.
References MacroSpaceFileHeader::count, creating, descriptorBase, FILE_CREATION_ERROR, fileInst, fileName, imageBase, MACROSPACE_SIGNATURE_ERROR, MACROSPACE_VERSION_ERROR, MacroSpaceFileHeader::magicNumber, SysFile::open(), read(), RX_O_RDONLY, RX_SH_DENYRW, RXVERSION, RXVERSIZE, SIGNATURE, and MacroSpaceFileHeader::version.
Referenced by LocalMacroSpaceManager::loadMacroSpace().
void MacroSpaceFile::read | ( | ManagedRxstring & | data, |
size_t | length | ||
) |
Read a buffer of data into a managed RXSTRING structure.
data | The target RXSTRING |
length | The length to read. |
Definition at line 267 of file LocalMacroSpaceManager.cpp.
References ManagedRxstring::ensureCapacity(), read(), Rxstring::strlength, and Rxstring::strptr.
void MacroSpaceFile::read | ( | void * | data, |
size_t | length | ||
) |
Read a buffer of data from the macrospace file.
data | The target data buffer. |
length | The size to read. |
Definition at line 250 of file LocalMacroSpaceManager.cpp.
References FILE_READ_ERROR, fileInst, and SysFile::read().
Referenced by nextMacro(), openForLoading(), and read().
void MacroSpaceFile::setFilePosition | ( | size_t | p | ) |
Explicitly set the file postion.
p | The new file position. |
Definition at line 179 of file LocalMacroSpaceManager.cpp.
References FILE_READ_ERROR, fileInst, and SysFile::seek().
Referenced by nextMacro().
|
inline |
Definition at line 139 of file LocalMacroSpaceManager.hpp.
References write().
void MacroSpaceFile::write | ( | const void * | data, |
size_t | length | ||
) |
Write a buffer of data to the macro file.
data | The data buffer pointer. |
length | The length to write. |
Definition at line 233 of file LocalMacroSpaceManager.cpp.
References FILE_WRITE_ERROR, fileInst, and SysFile::write().
Referenced by create(), LocalMacroSpaceManager::saveMacroSpace(), write(), and writeMacroDescriptor().
|
inline |
Definition at line 149 of file LocalMacroSpaceManager.hpp.
References _RXSTRING::strlength, _RXSTRING::strptr, and write().
|
inline |
Definition at line 144 of file LocalMacroSpaceManager.hpp.
References write().
void MacroSpaceFile::writeMacroDescriptor | ( | const char * | name, |
size_t | size, | ||
size_t | order | ||
) |
Write a macro descriptor out to the file.
name | The name of the macro to write. |
size | The size of the macro being written. |
order | The macro order information. |
Definition at line 219 of file LocalMacroSpaceManager.cpp.
References write().
Referenced by LocalMacroSpaceManager::saveMacroSpace().
|
protected |
Definition at line 155 of file LocalMacroSpaceManager.hpp.
Referenced by create(), openForLoading(), and ~MacroSpaceFile().
|
protected |
Definition at line 158 of file LocalMacroSpaceManager.hpp.
Referenced by nextMacro(), and openForLoading().
|
protected |
Definition at line 157 of file LocalMacroSpaceManager.hpp.
Referenced by close(), create(), openForLoading(), read(), setFilePosition(), write(), and ~MacroSpaceFile().
|
protected |
Definition at line 156 of file LocalMacroSpaceManager.hpp.
Referenced by create(), openForLoading(), and ~MacroSpaceFile().
|
protected |
Definition at line 159 of file LocalMacroSpaceManager.hpp.
Referenced by nextMacro(), and openForLoading().