|
| 1 | +#ifndef MODAPI_DLL_EXPORT |
| 2 | + |
| 3 | +#include <Spore\IO\IniFile.h> |
| 4 | + |
| 5 | +namespace IO |
| 6 | +{ |
| 7 | + IniFile::IniFile(const wchar_t* pPath, int optionFlags) |
| 8 | + : mFileStream((char*)nullptr) |
| 9 | + , mpStream(nullptr) |
| 10 | + , mnEncodingSrc(8) |
| 11 | + , mbFileIsOpenForWriting(false) |
| 12 | + , mbReadEntryCacheReady(false) |
| 13 | + , mbLeaveFileOpenBetweenOperations(optionFlags & 1) |
| 14 | + , mSectionPositionMap() |
| 15 | + , mSectionNameMap() |
| 16 | + { |
| 17 | + *(void**)this = (void*)GetAddress(IniFile, _vftable); |
| 18 | + mPath[0] = L'\0'; |
| 19 | + IniFile::SetPath(pPath); |
| 20 | + } |
| 21 | + |
| 22 | + IniFile::IniFile(IStream* pStream) |
| 23 | + : mFileStream((char*)nullptr) |
| 24 | + , mnEncodingSrc(8) |
| 25 | + , mbFileIsOpenForWriting(false) |
| 26 | + , mbReadEntryCacheReady(false) |
| 27 | + , mbLeaveFileOpenBetweenOperations(true) |
| 28 | + , mSectionPositionMap() |
| 29 | + , mSectionNameMap() |
| 30 | + , mpStream(pStream) |
| 31 | + { |
| 32 | + *(void**)this = (void*)GetAddress(IniFile, _vftable); |
| 33 | + mPath[0] = L'\0'; |
| 34 | + } |
| 35 | + |
| 36 | + auto_METHOD_VIRTUAL_const(IniFile, IniFile, int, GetOption, Args(Options option), Args(option)); |
| 37 | + auto_METHOD_VIRTUAL_VOID(IniFile, IniFile, SetOption, Args(Options option, int value), Args(option, value)); |
| 38 | + auto_METHOD_VIRTUAL_const_(IniFile, IniFile, wchar_t const*, GetPath); |
| 39 | + auto_METHOD_VIRTUAL(IniFile, IniFile, bool, SetPath, Args(const wchar_t* pPath), Args(pPath)); |
| 40 | + auto_METHOD_VIRTUAL_const_(IniFile, IniFile, IStream*, GetStream); |
| 41 | + auto_METHOD_VIRTUAL(IniFile, IniFile, bool, SetStream, Args(IStream* pStream), Args(pStream)); |
| 42 | + auto_METHOD_VIRTUAL_(IniFile, IniFile, bool, Close); |
| 43 | + auto_METHOD_VIRTUAL(IniFile, IniFile, int, ReadEntry, Args(const wchar_t* pSection, const wchar_t* pKey, eastl::basic_string<wchar_t>& sValue), Args(pSection, pKey, sValue)); |
| 44 | + auto_METHOD_VIRTUAL(IniFile, IniFile, int, ReadEntryToBuffer, Args(const wchar_t* pSection, const wchar_t* pKey, wchar_t* pValue, uint32_t nValueLength), Args(pSection, pKey, pValue, nValueLength)); |
| 45 | + // Stub, do not detour. |
| 46 | + int __cdecl IniFile::ReadEntryFormatted(const wchar_t* pSection, const wchar_t* pKey, const wchar_t* pValueFormat, ...) { return 0; } |
| 47 | + auto_METHOD_VIRTUAL(IniFile, IniFile, bool, WriteEntry, Args(const wchar_t* pSection, const wchar_t* pKey, const wchar_t* pValue), Args(pSection, pKey, pValue)); |
| 48 | + // Stub, do not detour. |
| 49 | + bool __cdecl IniFile::WriteEntryFormatted(const wchar_t* pSection, const wchar_t* pKey, const wchar_t* kValueFormat, ...) { return 0; } |
| 50 | + auto_METHOD_VIRTUAL(IniFile, IniFile, int, ReadBinary, Args(const wchar_t* pSection, const wchar_t* pKey, void* pData, uint32_t nDataLength), Args(pSection, pKey, pData, nDataLength)); |
| 51 | + auto_METHOD_VIRTUAL(IniFile, IniFile, bool, WriteBinary, Args(const wchar_t* pSection, const wchar_t* pKey, const void* pData, uint32_t nDataLength), Args(pSection, pKey, pData, nDataLength)); |
| 52 | + auto_METHOD_VIRTUAL(IniFile, IniFile, int, EnumSections, Args(EnumCallback_t pCallback, void* pContext), Args(pCallback, pContext)); |
| 53 | + auto_METHOD_VIRTUAL(IniFile, IniFile, int, EnumEntries, Args(const wchar_t* pSection, EnumCallback_t pCallback, void* pContext), Args(pSection, pCallback, pContext)); |
| 54 | + auto_METHOD_VIRTUAL(IniFile, IniFile, bool, SectionExists, Args(const wchar_t* pSection), Args(pSection)); |
| 55 | + auto_METHOD_VIRTUAL(IniFile, IniFile, bool, Open, Args(int nAccessFlags), Args(nAccessFlags)); |
| 56 | + auto_METHOD_VIRTUAL_(IniFile, IniFile, int, GetEncoding); |
| 57 | + auto_METHOD_VIRTUAL(IniFile, IniFile, bool, LoadSectionNames, Args(int nAccessFlags), Args(nAccessFlags)); |
| 58 | + auto_METHOD_VIRTUAL(IniFile, IniFile, bool, GetFileLine8To8, Args(eastl::basic_string<char>& sLine), Args(sLine)); |
| 59 | + auto_METHOD_VIRTUAL(IniFile, IniFile, bool, GetFileLine16To16, Args(eastl::basic_string<wchar_t>& sLine), Args(sLine)); |
| 60 | + auto_METHOD_VIRTUAL(IniFile, IniFile, bool, GetFileLine, Args(eastl::basic_string<wchar_t>& sLine), Args(sLine)); |
| 61 | + auto_METHOD_VIRTUAL(IniFile, IniFile, bool, ConvertAndWriteStream, Args(const wchar_t* pchar, uint32_t count), Args(pchar, count)); |
| 62 | +} |
| 63 | + |
| 64 | +#endif |
0 commit comments