226#ifndef INCLUDED_SimpleIni_h
227#define INCLUDED_SimpleIni_h
229#if defined(_MSC_VER) && (_MSC_VER >= 1020)
244#pragma warning(disable : 4127 4503 4702 4786)
257#ifdef SI_SUPPORT_IOSTREAMS
265#define SI_ASSERT(x) assert(x)
272constexpr int SI_OK = 0;
273constexpr int SI_UPDATED = 1;
274constexpr int SI_INSERTED = 2;
277constexpr int SI_FAIL = -1;
278constexpr int SI_NOMEM = -2;
279constexpr int SI_FILE = -3;
283constexpr size_t SI_MAX_FILE_SIZE = 1024ULL * 1024ULL * 1024ULL;
285#define SI_UTF8_SIGNATURE "\xEF\xBB\xBF"
288#define SI_NEWLINE_A "\r\n"
289#define SI_NEWLINE_W L"\r\n"
291#define SI_NEWLINE_A "\n"
292#define SI_NEWLINE_W L"\n"
295#if defined(SI_CONVERT_ICU)
296#include <unicode/ustring.h>
300#define SI_HAS_WIDE_FILE
301#define SI_WCHAR_T wchar_t
302#elif defined(SI_CONVERT_ICU)
303#define SI_HAS_WIDE_FILE
304#define SI_WCHAR_T UChar
330template <
class SI_CHAR,
class SI_STRLESS,
class SI_CONVERTER>
333 typedef SI_CHAR SI_CHAR_T;
337 const SI_CHAR *pItem;
338 const SI_CHAR *pComment;
341 Entry(
const SI_CHAR *a_pszItem = NULL,
int a_nOrder = 0)
342 : pItem(a_pszItem), pComment(NULL), nOrder(a_nOrder) {}
343 Entry(
const SI_CHAR *a_pszItem,
const SI_CHAR *a_pszComment,
int a_nOrder)
344 : pItem(a_pszItem), pComment(a_pszComment), nOrder(a_nOrder) {}
345 Entry(
const Entry &rhs) { operator=(rhs); }
346 Entry &operator=(
const Entry &rhs) {
348 pComment = rhs.pComment;
353#if defined(_MSC_VER) && _MSC_VER <= 1200
355 bool operator<(
const Entry &rhs)
const {
return LoadOrder()(*
this, rhs); }
356 bool operator>(
const Entry &rhs)
const {
return LoadOrder()(rhs, *
this); }
361 bool operator()(
const Entry &lhs,
const Entry &rhs)
const {
362 const static SI_STRLESS isLess = SI_STRLESS();
363 return isLess(lhs.pItem, rhs.pItem);
369 bool operator()(
const Entry &lhs,
const Entry &rhs)
const {
370 if (lhs.nOrder != rhs.nOrder) {
371 return lhs.nOrder < rhs.nOrder;
379 typedef std::multimap<Entry, const SI_CHAR *, typename Entry::KeyOrder>
383 typedef std::map<Entry, TKeyVal, typename Entry::KeyOrder>
TSection;
396 virtual ~OutputWriter() {}
397 virtual void Write(
const char *a_pBuf) = 0;
400 OutputWriter(
const OutputWriter &);
401 OutputWriter &operator=(
const OutputWriter &);
405 class FileWriter :
public OutputWriter {
409 FileWriter(FILE *a_file) : m_file(a_file) {}
410 void Write(
const char *a_pBuf) { fputs(a_pBuf, m_file); }
413 FileWriter(
const FileWriter &);
414 FileWriter &operator=(
const FileWriter &);
418 class StringWriter :
public OutputWriter {
419 std::string &m_string;
422 StringWriter(std::string &a_string) : m_string(a_string) {}
423 void Write(
const char *a_pBuf) { m_string.append(a_pBuf); }
426 StringWriter(
const StringWriter &);
427 StringWriter &operator=(
const StringWriter &);
430#ifdef SI_SUPPORT_IOSTREAMS
433 std::ostream &m_ostream;
436 StreamWriter(std::ostream &a_ostream) : m_ostream(a_ostream) {}
437 void Write(
const char *a_pBuf) { m_ostream << a_pBuf; }
440 StreamWriter(
const StreamWriter &);
441 StreamWriter &operator=(
const StreamWriter &);
448 class Converter :
private SI_CONVERTER {
450 Converter(
bool a_bStoreIsUtf8) : SI_CONVERTER(a_bStoreIsUtf8) {
451 m_scratch.resize(1024);
453 Converter(
const Converter &rhs)
454 : SI_CONVERTER(rhs), m_scratch(rhs.m_scratch) {}
455 Converter &operator=(
const Converter &rhs) {
456 SI_CONVERTER::operator=(rhs);
457 m_scratch = rhs.m_scratch;
460 bool ConvertToStore(
const SI_CHAR *a_pszString) {
461 size_t uLen = SI_CONVERTER::SizeToStore(a_pszString);
462 if (uLen == (
size_t)(-1)) {
465 while (uLen > m_scratch.size()) {
466 m_scratch.resize(m_scratch.size() * 2);
468 return SI_CONVERTER::ConvertToStore(
469 a_pszString,
const_cast<char *
>(m_scratch.data()), m_scratch.size());
471 const char *Data() {
return m_scratch.data(); }
474 std::string m_scratch;
487 bool a_bMultiLine =
false);
496 bool IsEmpty()
const {
return m_data.empty(); }
517 m_bStoreIsUtf8 = a_bIsUtf8;
542 m_bAllowMultiKey = a_bAllowMultiKey;
556 m_bAllowMultiLine = a_bAllowMultiLine;
568 void SetSpaces(
bool a_bSpaces =
true) { m_bSpaces = a_bSpaces; }
578 m_bParseQuotes = a_bParseQuotes;
593 m_bAllowKeyOnly = a_bAllowKeyOnly;
613#ifdef SI_HAS_WIDE_FILE
620 SI_Error
LoadFile(
const SI_WCHAR_T *a_pwszFile);
632#ifdef SI_SUPPORT_IOSTREAMS
643 SI_Error
LoadData(std::istream &a_istream);
653 return LoadData(a_strData.c_str(), a_strData.size());
663 SI_Error
LoadData(
const char *a_pData,
size_t a_uDataLen);
681 SI_Error
SaveFile(
const char *a_pszFile,
bool a_bAddSignature =
true)
const;
683#ifdef SI_HAS_WIDE_FILE
694 SI_Error
SaveFile(
const SI_WCHAR_T *a_pwszFile,
695 bool a_bAddSignature =
true)
const;
710 SI_Error
SaveFile(FILE *a_pFile,
bool a_bAddSignature =
false)
const;
743 SI_Error
Save(OutputWriter &a_oOutput,
bool a_bAddSignature =
false)
const;
745#ifdef SI_SUPPORT_IOSTREAMS
757 SI_Error
Save(std::ostream &a_ostream,
bool a_bAddSignature =
false)
const {
758 StreamWriter writer(a_ostream);
759 return Save(writer, a_bAddSignature);
774 SI_Error
Save(std::string &a_sBuffer,
bool a_bAddSignature =
false)
const {
775 StringWriter writer(a_sBuffer);
776 return Save(writer, a_bAddSignature);
870 const SI_CHAR *a_pKey)
const {
871 return GetValue(a_pSection, a_pKey) != NULL;
891 const SI_CHAR *
GetValue(
const SI_CHAR *a_pSection,
const SI_CHAR *a_pKey,
892 const SI_CHAR *a_pDefault = NULL,
893 bool *a_pHasMultiple = NULL)
const;
909 long a_nDefault = 0,
bool *a_pHasMultiple = NULL)
const;
925 double a_nDefault = 0,
926 bool *a_pHasMultiple = NULL)
const;
947 bool a_bDefault =
false,
bool *a_pHasMultiple = NULL)
const;
978 SI_Error
SetValue(
const SI_CHAR *a_pSection,
const SI_CHAR *a_pKey,
979 const SI_CHAR *a_pValue,
const SI_CHAR *a_pComment = NULL,
980 bool a_bForceReplace =
false) {
983 return AddEntry(a_pSection, a_pKey, a_pValue, a_pComment, a_bForceReplace,
1011 long a_nValue,
const SI_CHAR *a_pComment = NULL,
1012 bool a_bUseHex =
false,
bool a_bForceReplace =
false);
1035 double a_nValue,
const SI_CHAR *a_pComment = NULL,
1036 bool a_bForceReplace =
false);
1059 bool a_bValue,
const SI_CHAR *a_pComment = NULL,
1060 bool a_bForceReplace =
false);
1080 bool Delete(
const SI_CHAR *a_pSection,
const SI_CHAR *a_pKey,
1081 bool a_bRemoveEmpty =
false);
1104 const SI_CHAR *a_pValue,
bool a_bRemoveEmpty =
false);
1127 SI_Error FindFileComment(SI_CHAR *&a_pData,
bool a_bCopyStrings);
1133 bool FindEntry(SI_CHAR *&a_pData,
const SI_CHAR *&a_pSection,
1134 const SI_CHAR *&a_pKey,
const SI_CHAR *&a_pVal,
1135 const SI_CHAR *&a_pComment)
const;
1159 SI_Error AddEntry(
const SI_CHAR *a_pSection,
const SI_CHAR *a_pKey,
1160 const SI_CHAR *a_pValue,
const SI_CHAR *a_pComment,
1161 bool a_bForceReplace,
bool a_bCopyStrings);
1164 inline bool IsSpace(SI_CHAR ch)
const {
1165 return (ch ==
' ' || ch ==
'\t' || ch ==
'\r' || ch ==
'\n');
1169 inline bool IsComment(SI_CHAR ch)
const {
return (ch ==
';' || ch ==
'#'); }
1172 inline void SkipNewLine(SI_CHAR *&a_pData)
const {
1173 a_pData += (*a_pData ==
'\r' && *(a_pData + 1) ==
'\n') ? 2 : 1;
1177 SI_Error CopyString(
const SI_CHAR *&a_pString);
1185 void UndoIncrementalLoadData(
const TNamesDepend &a_oAddedSections,
1189 void DeleteString(
const SI_CHAR *a_pString);
1192 bool IsLess(
const SI_CHAR *a_pLeft,
const SI_CHAR *a_pRight)
const {
1193 const static SI_STRLESS isLess = SI_STRLESS();
1194 return isLess(a_pLeft, a_pRight);
1197 bool IsMultiLineTag(
const SI_CHAR *a_pData)
const;
1198 bool IsMultiLineData(
const SI_CHAR *a_pData)
const;
1199 bool IsSingleLineQuotedValue(
const SI_CHAR *a_pData)
const;
1200 bool MultiLineTextHasTag(
const SI_CHAR *a_pText,
const SI_CHAR *a_pTag)
const;
1201 bool LoadMultiLineText(SI_CHAR *&a_pData,
const SI_CHAR *&a_pVal,
1202 const SI_CHAR *a_pTagName,
1203 bool a_bAllowBlankLinesInComment =
false)
const;
1204 bool IsNewLineChar(SI_CHAR a_c)
const;
1207 const SI_CHAR *a_pText)
const;
1224 const SI_CHAR *m_pFileComment;
1227 const SI_CHAR m_cEmptyString;
1239 bool m_bStoreIsUtf8;
1242 bool m_bAllowMultiKey;
1245 bool m_bAllowMultiLine;
1251 bool m_bParseQuotes;
1254 bool m_bAllowKeyOnly;
1266template <
class SI_CHAR,
class SI_STRLESS,
class SI_CONVERTER>
1268 bool a_bIsUtf8,
bool a_bAllowMultiKey,
bool a_bAllowMultiLine)
1269 : m_pData(0), m_uDataLen(0), m_pFileComment(NULL), m_cEmptyString(0),
1270 m_bStoreIsUtf8(a_bIsUtf8), m_bAllowMultiKey(a_bAllowMultiKey),
1271 m_bAllowMultiLine(a_bAllowMultiLine), m_bSpaces(true),
1272 m_bParseQuotes(false), m_bAllowKeyOnly(false), m_nOrder(0) {}
1274template <
class SI_CHAR,
class SI_STRLESS,
class SI_CONVERTER>
1279template <
class SI_CHAR,
class SI_STRLESS,
class SI_CONVERTER>
1285 m_pFileComment = NULL;
1287 if (!m_data.empty()) {
1288 m_data.erase(m_data.begin(), m_data.end());
1292 if (!m_strings.empty()) {
1293 typename TNamesDepend::iterator i = m_strings.begin();
1294 for (; i != m_strings.end(); ++i) {
1295 delete[]
const_cast<SI_CHAR *
>(i->pItem);
1297 m_strings.erase(m_strings.begin(), m_strings.end());
1301namespace SI_Internal {
1302#ifdef SI_CONVERT_ICU
1304inline SI_Error UCharPathToUtf8(
const UChar *a_pPath,
char *&a_pUtf8Path) {
1306 UErrorCode status = U_ZERO_ERROR;
1308 u_strToUTF8(NULL, 0, &uLen, a_pPath, -1, &status);
1309 if (U_FAILURE(status) && status != U_BUFFER_OVERFLOW_ERROR) {
1315 char *pBuf =
new (std::nothrow)
char[
static_cast<size_t>(uLen) + 1];
1319 status = U_ZERO_ERROR;
1320 u_strToUTF8(pBuf, uLen + 1, NULL, a_pPath, -1, &status);
1321 if (U_FAILURE(status)) {
1331inline bool GetFileSize(FILE *a_fpFile,
size_t &a_uSize) {
1334#if defined(_WIN32) && !defined(_WIN32_WCE)
1335 if (_fseeki64(a_fpFile, 0, SEEK_END) != 0) {
1338 const __int64 nSize = _ftelli64(a_fpFile);
1342 if (
static_cast<unsigned long long>(nSize) >
1343 static_cast<unsigned long long>(SI_MAX_FILE_SIZE)) {
1346 if (
static_cast<unsigned long long>(nSize) >
1347 static_cast<unsigned long long>(std::numeric_limits<size_t>::max())) {
1350 a_uSize =
static_cast<size_t>(nSize);
1351 if (_fseeki64(a_fpFile, 0, SEEK_SET) != 0) {
1355#elif defined(_POSIX_VERSION) || defined(__unix__) || defined(__APPLE__)
1356 if (fseeko(a_fpFile, 0, SEEK_END) != 0) {
1359 const off_t nSize = ftello(a_fpFile);
1363 if (
static_cast<unsigned long long>(nSize) >
1364 static_cast<unsigned long long>(SI_MAX_FILE_SIZE)) {
1367 if (
static_cast<unsigned long long>(nSize) >
1368 static_cast<unsigned long long>(std::numeric_limits<size_t>::max())) {
1371 a_uSize =
static_cast<size_t>(nSize);
1372 if (fseeko(a_fpFile, 0, SEEK_SET) != 0) {
1377 if (fseek(a_fpFile, 0, SEEK_END) != 0) {
1380 const long nSize = ftell(a_fpFile);
1384 if (
static_cast<unsigned long long>(nSize) >
1385 static_cast<unsigned long long>(SI_MAX_FILE_SIZE)) {
1388 a_uSize =
static_cast<size_t>(nSize);
1389 if (fseek(a_fpFile, 0, SEEK_SET) != 0) {
1397template <
class SI_CHAR,
class SI_STRLESS,
class SI_CONVERTER>
1399 const char *a_pszFile) {
1401#if __STDC_WANT_SECURE_LIB__ && !_WIN32_WCE
1402 fopen_s(&fp, a_pszFile,
"rb");
1404 fp = fopen(a_pszFile,
"rb");
1414#ifdef SI_HAS_WIDE_FILE
1415template <
class SI_CHAR,
class SI_STRLESS,
class SI_CONVERTER>
1417 const SI_WCHAR_T *a_pwszFile) {
1420#if __STDC_WANT_SECURE_LIB__ && !_WIN32_WCE
1421 _wfopen_s(&fp, a_pwszFile, L
"rb");
1423 fp = _wfopen(a_pwszFile, L
"rb");
1427 SI_Error rc = LoadFile(fp);
1431 char *szFile = NULL;
1432 SI_Error rcPath = SI_Internal::UCharPathToUtf8(a_pwszFile, szFile);
1436 SI_Error rc = LoadFile(szFile);
1443template <
class SI_CHAR,
class SI_STRLESS,
class SI_CONVERTER>
1447 if (!SI_Internal::GetFileSize(a_fpFile, uSize)) {
1455 char *pData =
new (std::nothrow)
char[uSize + 1];
1462 size_t uRead = fread(pData,
sizeof(
char), uSize, a_fpFile);
1463 if (uRead != uSize) {
1469 SI_Error rc =
LoadData(pData, uRead);
1474template <
class SI_CHAR,
class SI_STRLESS,
class SI_CONVERTER>
1476 const char *a_pData,
size_t a_uDataLen) {
1484 if (a_uDataLen >= 3 && memcmp(a_pData, SI_UTF8_SIGNATURE, 3) == 0) {
1487 SI_ASSERT(m_bStoreIsUtf8 || !m_pData);
1491 if (a_uDataLen == 0) {
1496 SI_CONVERTER converter(m_bStoreIsUtf8);
1497 size_t uLen = converter.SizeFromStore(a_pData, a_uDataLen);
1498 if (uLen == (
size_t)(-1)) {
1503 if (uLen >= (SI_MAX_FILE_SIZE /
sizeof(SI_CHAR))) {
1509 SI_CHAR *pData =
new (std::nothrow) SI_CHAR[uLen + 1];
1513 memset(pData, 0,
sizeof(SI_CHAR) * (uLen + 1));
1516 if (!converter.ConvertFromStore(a_pData, a_uDataLen, pData, uLen)) {
1522 const static SI_CHAR empty = 0;
1523 SI_CHAR *pWork = pData;
1524 const SI_CHAR *pSection = ∅
1525 const SI_CHAR *pItem = NULL;
1526 const SI_CHAR *pVal = NULL;
1527 const SI_CHAR *pComment = NULL;
1531 bool bCopyStrings = (m_pData != NULL);
1533 size_t nStringsBefore = 0;
1534 const SI_CHAR *pFileCommentBefore = NULL;
1538 nStringsBefore = m_strings.size();
1539 pFileCommentBefore = m_pFileComment;
1544 SI_Error rc = FindFileComment(pWork, bCopyStrings);
1548 m_pFileComment = pFileCommentBefore;
1549 while (m_strings.size() > nStringsBefore) {
1550 delete[]
const_cast<SI_CHAR *
>(m_strings.back().pItem);
1551 m_strings.pop_back();
1554 m_pFileComment = NULL;
1560 while (FindEntry(pWork, pSection, pItem, pVal, pComment)) {
1562 bool bKeyExisted = pItem && bSectionExisted &&
KeyExists(pSection, pItem);
1564 rc = AddEntry(pSection, pItem, pVal, pComment,
false, bCopyStrings);
1567 m_pFileComment = pFileCommentBefore;
1568 UndoIncrementalLoadData(oAddedSections, oAddedKeys);
1569 while (m_strings.size() > nStringsBefore) {
1570 delete[]
const_cast<SI_CHAR *
>(m_strings.back().pItem);
1571 m_strings.pop_back();
1575 m_pFileComment = NULL;
1583 if (!bSectionExisted && *pSection) {
1584 oAddedSections.push_back(
Entry(pSection, NULL, 0));
1586 if (pItem && !bKeyExisted) {
1587 oAddedKeys.push_back(
Entry(pItem, pSection, 0));
1597 m_uDataLen = uLen + 1;
1603#ifdef SI_SUPPORT_IOSTREAMS
1604template <
class SI_CHAR,
class SI_STRLESS,
class SI_CONVERTER>
1606 std::istream &a_istream) {
1607 std::string strData;
1609 while (a_istream.read(buf,
sizeof(buf)) || a_istream.gcount() > 0) {
1610 const std::streamsize nRead = a_istream.gcount();
1611 for (std::streamsize i = 0; i < nRead; ++i) {
1612 if (buf[i] ==
'\0') {
1616 if (strData.size() +
static_cast<size_t>(nRead) > SI_MAX_FILE_SIZE) {
1619 strData.append(buf,
static_cast<size_t>(nRead));
1621 return LoadData(strData.data(), strData.size());
1625template <
class SI_CHAR,
class SI_STRLESS,
class SI_CONVERTER>
1626SI_Error CSimpleIniTempl<SI_CHAR, SI_STRLESS, SI_CONVERTER>::FindFileComment(
1627 SI_CHAR *&a_pData,
bool a_bCopyStrings) {
1629 if (m_pFileComment) {
1635 if (!LoadMultiLineText(a_pData, m_pFileComment, NULL,
false)) {
1640 if (a_bCopyStrings) {
1641 SI_Error rc = CopyString(m_pFileComment);
1649template <
class SI_CHAR,
class SI_STRLESS,
class SI_CONVERTER>
1650bool CSimpleIniTempl<SI_CHAR, SI_STRLESS, SI_CONVERTER>::FindEntry(
1651 SI_CHAR *&a_pData,
const SI_CHAR *&a_pSection,
const SI_CHAR *&a_pKey,
1652 const SI_CHAR *&a_pVal,
const SI_CHAR *&a_pComment)
const {
1656 bool bHaveValue =
false;
1657 SI_CHAR *pTrail = NULL;
1660 while (*a_pData && IsSpace(*a_pData)) {
1669 if (IsComment(*a_pData)) {
1670 LoadMultiLineText(a_pData, a_pComment, NULL,
true);
1675 if (*a_pData ==
'[') {
1678 while (*a_pData && IsSpace(*a_pData)) {
1684 a_pSection = a_pData;
1685 while (*a_pData && *a_pData !=
']' && !IsNewLineChar(*a_pData)) {
1690 if (*a_pData !=
']') {
1695 pTrail = a_pData - 1;
1696 while (pTrail >= a_pSection && IsSpace(*pTrail)) {
1704 while (*a_pData && !IsNewLineChar(*a_pData)) {
1715 while (*a_pData && *a_pData !=
'=' && !IsNewLineChar(*a_pData)) {
1721 bHaveValue = (*a_pData ==
'=');
1722 if (!bHaveValue && !m_bAllowKeyOnly) {
1727 if (bHaveValue && a_pKey == a_pData) {
1728 while (*a_pData && !IsNewLineChar(*a_pData)) {
1735 pTrail = a_pData - 1;
1736 while (pTrail >= a_pKey && IsSpace(*pTrail)) {
1747 while (*a_pData && !IsNewLineChar(*a_pData) && IsSpace(*a_pData)) {
1753 while (*a_pData && !IsNewLineChar(*a_pData)) {
1758 pTrail = a_pData - 1;
1760 SkipNewLine(a_pData);
1762 while (pTrail >= a_pVal && IsSpace(*pTrail)) {
1769 if (m_bAllowMultiLine && IsMultiLineTag(a_pVal)) {
1771 const SI_CHAR *pTagName = a_pVal + 3;
1772 return LoadMultiLineText(a_pData, a_pVal, pTagName);
1776 if (m_bParseQuotes) {
1778 if (pTrail > a_pVal && *a_pVal ==
'"' && *pTrail ==
'"') {
1786 SkipNewLine(a_pData);
1799template <
class SI_CHAR,
class SI_STRLESS,
class SI_CONVERTER>
1800bool CSimpleIniTempl<SI_CHAR, SI_STRLESS, SI_CONVERTER>::IsMultiLineTag(
1801 const SI_CHAR *a_pVal)
const {
1803 if (*a_pVal++ !=
'<')
1805 if (*a_pVal++ !=
'<')
1807 if (*a_pVal++ !=
'<')
1812template <
class SI_CHAR,
class SI_STRLESS,
class SI_CONVERTER>
1813bool CSimpleIniTempl<SI_CHAR, SI_STRLESS, SI_CONVERTER>::IsMultiLineData(
1814 const SI_CHAR *a_pData)
const {
1827 if (IsMultiLineTag(a_pData)) {
1832 if (IsSpace(*a_pData)) {
1837 const SI_CHAR *pStart = a_pData;
1839 if (IsNewLineChar(*a_pData)) {
1846 if (a_pData > pStart && IsSpace(*(a_pData - 1))) {
1853template <
class SI_CHAR,
class SI_STRLESS,
class SI_CONVERTER>
1854bool CSimpleIniTempl<SI_CHAR, SI_STRLESS, SI_CONVERTER>::MultiLineTextHasTag(
1855 const SI_CHAR *a_pText,
const SI_CHAR *a_pTag)
const {
1856 if (!a_pText || !a_pTag) {
1859 const SI_CHAR *p = a_pText;
1861 const SI_CHAR *pEndOfLine = p;
1862 while (*pEndOfLine && *pEndOfLine !=
'\n') {
1865 const std::basic_string<SI_CHAR> line(p,
1866 static_cast<size_t>(pEndOfLine - p));
1867 if (!IsLess(line.c_str(), a_pTag) && !IsLess(a_pTag, line.c_str())) {
1878template <
class SI_CHAR,
class SI_STRLESS,
class SI_CONVERTER>
1890 const SI_CHAR *pStart = a_pData;
1892 if (IsNewLineChar(*a_pData)) {
1899 if (IsSpace(*pStart)) {
1904 if (a_pData > pStart && IsSpace(*(a_pData - 1))) {
1909 if (a_pData > pStart + 1 && *pStart ==
'"' && *(a_pData - 1) ==
'"') {
1916template <
class SI_CHAR,
class SI_STRLESS,
class SI_CONVERTER>
1917bool CSimpleIniTempl<SI_CHAR, SI_STRLESS, SI_CONVERTER>::IsNewLineChar(
1918 SI_CHAR a_c)
const {
1919 return (a_c ==
'\n' || a_c ==
'\r');
1922template <
class SI_CHAR,
class SI_STRLESS,
class SI_CONVERTER>
1923bool CSimpleIniTempl<SI_CHAR, SI_STRLESS, SI_CONVERTER>::LoadMultiLineText(
1924 SI_CHAR *&a_pData,
const SI_CHAR *&a_pVal,
const SI_CHAR *a_pTagName,
1925 bool a_bAllowBlankLinesInComment)
const {
1934 SI_CHAR *pDataLine = a_pData;
1943 SI_CHAR cEndOfLineChar = *a_pData;
1947 if (!a_pTagName && !IsComment(*a_pData)) {
1949 if (!a_bAllowBlankLinesInComment) {
1956 SI_CHAR *pCurr = a_pData;
1958 while (IsSpace(*pCurr)) {
1959 if (IsNewLineChar(*pCurr)) {
1969 if (IsComment(*pCurr)) {
1970 for (; nNewLines > 0; --nNewLines)
1971 *pDataLine++ =
'\n';
1981 pCurrLine = a_pData;
1982 while (*a_pData && !IsNewLineChar(*a_pData))
1986 if (pDataLine < pCurrLine) {
1987 size_t nLen = (size_t)(a_pData - pCurrLine);
1988 memmove(pDataLine, pCurrLine, nLen *
sizeof(SI_CHAR));
1989 pDataLine[nLen] =
'\0';
1993 cEndOfLineChar = *a_pData;
2001 SI_CHAR *pc = a_pData - 1;
2002 while (pc > pDataLine && IsSpace(*pc))
2007 if (!IsLess(pDataLine, a_pTagName) && !IsLess(a_pTagName, pDataLine)) {
2016 if (!cEndOfLineChar) {
2022 pDataLine += (a_pData - pCurrLine);
2023 *a_pData = cEndOfLineChar;
2024 SkipNewLine(a_pData);
2025 *pDataLine++ =
'\n';
2029 if (a_pVal == a_pData) {
2038 *--pDataLine =
'\0';
2042 if (a_pTagName && cEndOfLineChar) {
2043 SI_ASSERT(IsNewLineChar(cEndOfLineChar));
2044 *a_pData = cEndOfLineChar;
2045 SkipNewLine(a_pData);
2051template <
class SI_CHAR,
class SI_STRLESS,
class SI_CONVERTER>
2052SI_Error CSimpleIniTempl<SI_CHAR, SI_STRLESS, SI_CONVERTER>::CopyString(
2053 const SI_CHAR *&a_pString) {
2055 if (
sizeof(SI_CHAR) ==
sizeof(
char)) {
2056 uLen = strlen((
const char *)a_pString);
2057 }
else if (
sizeof(SI_CHAR) ==
sizeof(
wchar_t)) {
2058 uLen = wcslen((
const wchar_t *)a_pString);
2060 for (; a_pString[uLen]; ++uLen)
2063 if (uLen >= (SI_MAX_FILE_SIZE /
sizeof(SI_CHAR))) {
2067 SI_CHAR *pCopy =
new (std::nothrow) SI_CHAR[uLen];
2071 memcpy(pCopy, a_pString,
sizeof(SI_CHAR) * uLen);
2072 m_strings.push_back(pCopy);
2077template <
class SI_CHAR,
class SI_STRLESS,
class SI_CONVERTER>
2080 const TNamesDepend &a_oAddedKeys) {
2081 typename TNamesDepend::const_iterator iAddedKey = a_oAddedKeys.begin();
2082 for (; iAddedKey != a_oAddedKeys.end(); ++iAddedKey) {
2083 Delete(iAddedKey->pComment, iAddedKey->pItem,
false);
2086 typename TNamesDepend::const_iterator iAddedSection =
2087 a_oAddedSections.begin();
2088 for (; iAddedSection != a_oAddedSections.end(); ++iAddedSection) {
2089 Delete(iAddedSection->pItem, NULL,
false);
2093template <
class SI_CHAR,
class SI_STRLESS,
class SI_CONVERTER>
2094SI_Error CSimpleIniTempl<SI_CHAR, SI_STRLESS, SI_CONVERTER>::AddEntry(
2095 const SI_CHAR *a_pSection,
const SI_CHAR *a_pKey,
const SI_CHAR *a_pValue,
2096 const SI_CHAR *a_pComment,
bool a_bForceReplace,
bool a_bCopyStrings) {
2098 bool bInserted =
false;
2099 bool bInsertedSection =
false;
2100 bool bCopiedComment =
false;
2101 bool bCopiedSection =
false;
2102 bool bCopiedKey =
false;
2104 SI_ASSERT(!a_pComment || IsComment(*a_pComment));
2108 if (a_bCopyStrings && a_pComment) {
2109 rc = CopyString(a_pComment);
2112 bCopiedComment =
true;
2116 typename TSection::iterator iSection = m_data.find(a_pSection);
2117 if (iSection == m_data.end()) {
2120 if (a_bCopyStrings) {
2121 rc = CopyString(a_pSection);
2123 if (bCopiedComment) {
2124 DeleteString(a_pComment);
2128 bCopiedSection =
true;
2132 Entry oSection(a_pSection, ++m_nOrder);
2133 if (a_pComment && !a_pKey) {
2134 oSection.pComment = a_pComment;
2137 typename TSection::value_type oEntry(oSection, TKeyVal());
2138 typedef typename TSection::iterator SectionIterator;
2139 std::pair<SectionIterator, bool> i = m_data.insert(oEntry);
2142 bInsertedSection =
true;
2146 return bInserted ? SI_INSERTED : SI_UPDATED;
2150 TKeyVal &keyval = iSection->second;
2151 typename TKeyVal::iterator iKey = keyval.find(a_pKey);
2152 bInserted = iKey == keyval.end();
2156 int nLoadOrder = ++m_nOrder;
2157 if (iKey != keyval.end() && m_bAllowMultiKey && a_bForceReplace) {
2158 const SI_CHAR *pComment = NULL;
2159 while (iKey != keyval.end() && !IsLess(a_pKey, iKey->first.pItem)) {
2160 if (iKey->first.nOrder < nLoadOrder) {
2161 nLoadOrder = iKey->first.nOrder;
2162 pComment = iKey->first.pComment;
2167 DeleteString(a_pComment);
2168 a_pComment = pComment;
2169 rc = CopyString(a_pComment);
2173 Delete(a_pSection, a_pKey);
2174 iKey = keyval.end();
2179 a_pValue = &m_cEmptyString;
2183 bool bForceCreateNewKey = m_bAllowMultiKey && !a_bForceReplace;
2184 if (a_bCopyStrings) {
2185 if (bForceCreateNewKey || iKey == keyval.end()) {
2189 rc = CopyString(a_pKey);
2191 if (bInsertedSection) {
2192 m_data.erase(iSection);
2194 if (bCopiedSection) {
2195 DeleteString(a_pSection);
2197 if (bCopiedComment) {
2198 DeleteString(a_pComment);
2206 rc = CopyString(a_pValue);
2209 DeleteString(a_pKey);
2211 if (bInsertedSection) {
2212 m_data.erase(iSection);
2214 if (bCopiedSection) {
2215 DeleteString(a_pSection);
2217 if (bCopiedComment) {
2218 DeleteString(a_pComment);
2225 if (iKey == keyval.end() || bForceCreateNewKey) {
2226 Entry oKey(a_pKey, nLoadOrder);
2228 oKey.pComment = a_pComment;
2230 typename TKeyVal::value_type oEntry(oKey,
2231 static_cast<const SI_CHAR *
>(NULL));
2232 iKey = keyval.insert(oEntry);
2234 DeleteString(iKey->second);
2237 iKey->second = a_pValue;
2238 return bInserted ? SI_INSERTED : SI_UPDATED;
2241template <
class SI_CHAR,
class SI_STRLESS,
class SI_CONVERTER>
2243 const SI_CHAR *a_pSection,
const SI_CHAR *a_pKey,
const SI_CHAR *a_pDefault,
2244 bool *a_pHasMultiple)
const {
2245 if (a_pHasMultiple) {
2246 *a_pHasMultiple =
false;
2248 if (!a_pSection || !a_pKey) {
2251 typename TSection::const_iterator iSection = m_data.find(a_pSection);
2252 if (iSection == m_data.end()) {
2255 typename TKeyVal::const_iterator iKeyVal = iSection->second.find(a_pKey);
2256 if (iKeyVal == iSection->second.end()) {
2261 if (m_bAllowMultiKey && a_pHasMultiple) {
2262 typename TKeyVal::const_iterator iTemp = iKeyVal;
2263 if (++iTemp != iSection->second.end()) {
2264 if (!IsLess(a_pKey, iTemp->first.pItem)) {
2265 *a_pHasMultiple =
true;
2270 return iKeyVal->second;
2273template <
class SI_CHAR,
class SI_STRLESS,
class SI_CONVERTER>
2275 const SI_CHAR *a_pSection,
const SI_CHAR *a_pKey,
long a_nDefault,
2276 bool *a_pHasMultiple)
const {
2278 const SI_CHAR *pszValue =
GetValue(a_pSection, a_pKey, NULL, a_pHasMultiple);
2279 if (!pszValue || !*pszValue)
2283 char szValue[64] = {0};
2284 SI_CONVERTER c(m_bStoreIsUtf8);
2285 if (!c.ConvertToStore(pszValue, szValue,
sizeof(szValue))) {
2290 long nValue = a_nDefault;
2291 char *pszSuffix = szValue;
2293 if (szValue[0] ==
'0' && (szValue[1] ==
'x' || szValue[1] ==
'X')) {
2296 nValue = strtol(&szValue[2], &pszSuffix, 16);
2298 nValue = strtol(szValue, &pszSuffix, 10);
2302 if (*pszSuffix || errno == ERANGE) {
2309template <
class SI_CHAR,
class SI_STRLESS,
class SI_CONVERTER>
2311 const SI_CHAR *a_pSection,
const SI_CHAR *a_pKey,
long a_nValue,
2312 const SI_CHAR *a_pComment,
bool a_bUseHex,
bool a_bForceReplace) {
2314 if (!a_pSection || !a_pKey)
2319#if __STDC_WANT_SECURE_LIB__ && !_WIN32_WCE
2320 sprintf_s(szInput, a_bUseHex ?
"0x%lx" :
"%ld", a_nValue);
2322 snprintf(szInput,
sizeof(szInput), a_bUseHex ?
"0x%lx" :
"%ld", a_nValue);
2326 SI_CHAR szOutput[64];
2327 SI_CONVERTER c(m_bStoreIsUtf8);
2328 if (!c.ConvertFromStore(szInput, strlen(szInput) + 1, szOutput,
2329 sizeof(szOutput) /
sizeof(SI_CHAR))) {
2334 return AddEntry(a_pSection, a_pKey, szOutput, a_pComment, a_bForceReplace,
2338template <
class SI_CHAR,
class SI_STRLESS,
class SI_CONVERTER>
2340 const SI_CHAR *a_pSection,
const SI_CHAR *a_pKey,
double a_nDefault,
2341 bool *a_pHasMultiple)
const {
2343 const SI_CHAR *pszValue =
GetValue(a_pSection, a_pKey, NULL, a_pHasMultiple);
2344 if (!pszValue || !*pszValue)
2348 char szValue[64] = {0};
2349 SI_CONVERTER c(m_bStoreIsUtf8);
2350 if (!c.ConvertToStore(pszValue, szValue,
sizeof(szValue))) {
2354 char *pszSuffix = szValue;
2355 double nValue = strtod(szValue, &pszSuffix);
2359 if (pszSuffix == szValue || *pszSuffix) {
2366template <
class SI_CHAR,
class SI_STRLESS,
class SI_CONVERTER>
2368 const SI_CHAR *a_pSection,
const SI_CHAR *a_pKey,
double a_nValue,
2369 const SI_CHAR *a_pComment,
bool a_bForceReplace) {
2371 if (!a_pSection || !a_pKey)
2376#if __STDC_WANT_SECURE_LIB__ && !_WIN32_WCE
2377 sprintf_s(szInput,
"%.17g", a_nValue);
2379 snprintf(szInput,
sizeof(szInput),
"%.17g", a_nValue);
2383 SI_CHAR szOutput[64];
2384 SI_CONVERTER c(m_bStoreIsUtf8);
2385 if (!c.ConvertFromStore(szInput, strlen(szInput) + 1, szOutput,
2386 sizeof(szOutput) /
sizeof(SI_CHAR))) {
2391 return AddEntry(a_pSection, a_pKey, szOutput, a_pComment, a_bForceReplace,
2395template <
class SI_CHAR,
class SI_STRLESS,
class SI_CONVERTER>
2397 const SI_CHAR *a_pSection,
const SI_CHAR *a_pKey,
bool a_bDefault,
2398 bool *a_pHasMultiple)
const {
2400 const SI_CHAR *pszValue =
GetValue(a_pSection, a_pKey, NULL, a_pHasMultiple);
2401 if (!pszValue || !*pszValue)
2405 switch (pszValue[0]) {
2422 if (pszValue[1] ==
'n' || pszValue[1] ==
'N')
2424 if (pszValue[1] ==
'f' || pszValue[1] ==
'F')
2433template <
class SI_CHAR,
class SI_STRLESS,
class SI_CONVERTER>
2435 const SI_CHAR *a_pSection,
const SI_CHAR *a_pKey,
bool a_bValue,
2436 const SI_CHAR *a_pComment,
bool a_bForceReplace) {
2438 if (!a_pSection || !a_pKey)
2442 const char *pszInput = a_bValue ?
"true" :
"false";
2445 SI_CHAR szOutput[64];
2446 SI_CONVERTER c(m_bStoreIsUtf8);
2447 if (!c.ConvertFromStore(pszInput, strlen(pszInput) + 1, szOutput,
2448 sizeof(szOutput) /
sizeof(SI_CHAR))) {
2453 return AddEntry(a_pSection, a_pKey, szOutput, a_pComment, a_bForceReplace,
2457template <
class SI_CHAR,
class SI_STRLESS,
class SI_CONVERTER>
2459 const SI_CHAR *a_pSection,
const SI_CHAR *a_pKey,
2463 if (!a_pSection || !a_pKey) {
2466 typename TSection::const_iterator iSection = m_data.find(a_pSection);
2467 if (iSection == m_data.end()) {
2470 typename TKeyVal::const_iterator iKeyVal = iSection->second.find(a_pKey);
2471 if (iKeyVal == iSection->second.end()) {
2477 Entry(iKeyVal->second, iKeyVal->first.pComment, iKeyVal->first.nOrder));
2478 if (m_bAllowMultiKey) {
2480 while (iKeyVal != iSection->second.end() &&
2481 !IsLess(a_pKey, iKeyVal->first.pItem)) {
2482 a_values.push_back(
Entry(iKeyVal->second, iKeyVal->first.pComment,
2483 iKeyVal->first.nOrder));
2491template <
class SI_CHAR,
class SI_STRLESS,
class SI_CONVERTER>
2493 const SI_CHAR *a_pSection)
const {
2498 typename TSection::const_iterator iSection = m_data.find(a_pSection);
2499 if (iSection == m_data.end()) {
2502 const TKeyVal §ion = iSection->second;
2506 if (!m_bAllowMultiKey || section.empty()) {
2507 return (
int)section.size();
2512 const SI_CHAR *pLastKey = NULL;
2513 typename TKeyVal::const_iterator iKeyVal = section.begin();
2514 for (; iKeyVal != section.end(); ++iKeyVal) {
2515 if (!pLastKey || IsLess(pLastKey, iKeyVal->first.pItem)) {
2517 pLastKey = iKeyVal->first.pItem;
2523template <
class SI_CHAR,
class SI_STRLESS,
class SI_CONVERTER>
2526 const SI_CHAR *a_pSection)
const {
2528 typename TSection::const_iterator i = m_data.find(a_pSection);
2529 if (i != m_data.end()) {
2530 return &(i->second);
2536template <
class SI_CHAR,
class SI_STRLESS,
class SI_CONVERTER>
2540 typename TSection::const_iterator i = m_data.begin();
2541 for (; i != m_data.end(); ++i) {
2542 a_names.push_back(i->first);
2546template <
class SI_CHAR,
class SI_STRLESS,
class SI_CONVERTER>
2548 const SI_CHAR *a_pSection,
TNamesDepend &a_names)
const {
2555 typename TSection::const_iterator iSection = m_data.find(a_pSection);
2556 if (iSection == m_data.end()) {
2560 const TKeyVal §ion = iSection->second;
2561 const SI_CHAR *pLastKey = NULL;
2562 typename TKeyVal::const_iterator iKeyVal = section.begin();
2563 for (; iKeyVal != section.end(); ++iKeyVal) {
2564 if (!pLastKey || IsLess(pLastKey, iKeyVal->first.pItem)) {
2565 a_names.push_back(iKeyVal->first);
2566 pLastKey = iKeyVal->first.pItem;
2573template <
class SI_CHAR,
class SI_STRLESS,
class SI_CONVERTER>
2575 const char *a_pszFile,
bool a_bAddSignature)
const {
2577#if __STDC_WANT_SECURE_LIB__ && !_WIN32_WCE
2578 fopen_s(&fp, a_pszFile,
"wb");
2580 fp = fopen(a_pszFile,
"wb");
2584 SI_Error rc =
SaveFile(fp, a_bAddSignature);
2589#ifdef SI_HAS_WIDE_FILE
2590template <
class SI_CHAR,
class SI_STRLESS,
class SI_CONVERTER>
2592 const SI_WCHAR_T *a_pwszFile,
bool a_bAddSignature)
const {
2595#if __STDC_WANT_SECURE_LIB__ && !_WIN32_WCE
2596 _wfopen_s(&fp, a_pwszFile, L
"wb");
2598 fp = _wfopen(a_pwszFile, L
"wb");
2602 SI_Error rc = SaveFile(fp, a_bAddSignature);
2606 char *szFile = NULL;
2607 SI_Error rcPath = SI_Internal::UCharPathToUtf8(a_pwszFile, szFile);
2611 SI_Error rc = SaveFile(szFile, a_bAddSignature);
2618template <
class SI_CHAR,
class SI_STRLESS,
class SI_CONVERTER>
2620 FILE *a_pFile,
bool a_bAddSignature)
const {
2622 return Save(writer, a_bAddSignature);
2625template <
class SI_CHAR,
class SI_STRLESS,
class SI_CONVERTER>
2631 if (m_bStoreIsUtf8 && a_bAddSignature) {
2632 a_oOutput.Write(SI_UTF8_SIGNATURE);
2638#if defined(_MSC_VER) && _MSC_VER <= 1200
2640#elif defined(__BORLANDC__)
2648 typename TNamesDepend::iterator is = oSections.begin();
2649 for (; is != oSections.end(); ++is) {
2652 if (is != oSections.begin()) {
2653 oSections.splice(oSections.begin(), oSections, is, std::next(is));
2660 bool bNeedNewLine =
false;
2661 if (m_pFileComment) {
2662 if (!OutputMultiLineText(a_oOutput, convert, m_pFileComment)) {
2665 bNeedNewLine =
true;
2669 typename TNamesDepend::const_iterator iSection = oSections.begin();
2670 for (; iSection != oSections.end(); ++iSection) {
2672 if (iSection->pComment) {
2674 a_oOutput.Write(SI_NEWLINE_A);
2675 a_oOutput.Write(SI_NEWLINE_A);
2677 if (!OutputMultiLineText(a_oOutput, convert, iSection->pComment)) {
2680 bNeedNewLine =
false;
2684 a_oOutput.Write(SI_NEWLINE_A);
2685 a_oOutput.Write(SI_NEWLINE_A);
2686 bNeedNewLine =
false;
2690 if (*iSection->pItem) {
2691 if (!convert.ConvertToStore(iSection->pItem)) {
2694 a_oOutput.Write(
"[");
2695 a_oOutput.Write(convert.Data());
2696 a_oOutput.Write(
"]");
2697 a_oOutput.Write(SI_NEWLINE_A);
2703#if defined(_MSC_VER) && _MSC_VER <= 1200
2705#elif defined(__BORLANDC__)
2712 typename TNamesDepend::const_iterator iKey = oKeys.begin();
2713 for (; iKey != oKeys.end(); ++iKey) {
2718 typename TNamesDepend::const_iterator iValue = oValues.begin();
2719 for (; iValue != oValues.end(); ++iValue) {
2721 if (iValue->pComment) {
2722 a_oOutput.Write(SI_NEWLINE_A);
2723 if (!OutputMultiLineText(a_oOutput, convert, iValue->pComment)) {
2729 if (!convert.ConvertToStore(iKey->pItem)) {
2732 a_oOutput.Write(convert.Data());
2735 if (*iValue->pItem || !m_bAllowKeyOnly) {
2736 if (!convert.ConvertToStore(iValue->pItem)) {
2739 a_oOutput.Write(m_bSpaces ?
" = " :
"=");
2740 if (m_bParseQuotes && IsSingleLineQuotedValue(iValue->pItem)) {
2743 a_oOutput.Write(
"\"");
2744 a_oOutput.Write(convert.Data());
2745 a_oOutput.Write(
"\"");
2746 }
else if (m_bAllowMultiLine && IsMultiLineData(iValue->pItem)) {
2750 SI_CHAR szTagSi[64];
2754#if __STDC_WANT_SECURE_LIB__ && !_WIN32_WCE
2755 sprintf_s(szTag,
"END_OF_TEXT");
2757 snprintf(szTag,
sizeof(szTag),
"END_OF_TEXT");
2760#if __STDC_WANT_SECURE_LIB__ && !_WIN32_WCE
2761 sprintf_s(szTag,
"END_OF_TEXT_%d", nSuffix);
2763 snprintf(szTag,
sizeof(szTag),
"END_OF_TEXT_%d", nSuffix);
2767 for (; szTag[u] && u + 1 <
sizeof(szTagSi) /
sizeof(szTagSi[0]);
2769 szTagSi[u] =
static_cast<SI_CHAR
>(szTag[u]);
2772 if (!MultiLineTextHasTag(iValue->pItem, szTagSi)) {
2777 a_oOutput.Write(
"<<<");
2778 a_oOutput.Write(szTag);
2779 a_oOutput.Write(SI_NEWLINE_A);
2780 if (!OutputMultiLineText(a_oOutput, convert, iValue->pItem)) {
2783 a_oOutput.Write(szTag);
2785 a_oOutput.Write(convert.Data());
2788 a_oOutput.Write(SI_NEWLINE_A);
2792 bNeedNewLine =
true;
2798template <
class SI_CHAR,
class SI_STRLESS,
class SI_CONVERTER>
2799bool CSimpleIniTempl<SI_CHAR, SI_STRLESS, SI_CONVERTER>::OutputMultiLineText(
2800 OutputWriter &a_oOutput, Converter &a_oConverter,
2801 const SI_CHAR *a_pText)
const {
2802 const SI_CHAR *pEndOfLine;
2803 SI_CHAR cEndOfLineChar = *a_pText;
2804 while (cEndOfLineChar) {
2806 pEndOfLine = a_pText;
2807 for (; *pEndOfLine && *pEndOfLine !=
'\n'; ++pEndOfLine)
2809 cEndOfLineChar = *pEndOfLine;
2811 const std::basic_string<SI_CHAR> line(
2812 a_pText,
static_cast<size_t>(pEndOfLine - a_pText));
2813 if (!a_oConverter.ConvertToStore(line.c_str())) {
2816 a_pText += (pEndOfLine - a_pText) + 1;
2817 a_oOutput.Write(a_oConverter.Data());
2818 a_oOutput.Write(SI_NEWLINE_A);
2823template <
class SI_CHAR,
class SI_STRLESS,
class SI_CONVERTER>
2825 const SI_CHAR *a_pSection,
const SI_CHAR *a_pKey,
bool a_bRemoveEmpty) {
2826 return DeleteValue(a_pSection, a_pKey, NULL, a_bRemoveEmpty);
2829template <
class SI_CHAR,
class SI_STRLESS,
class SI_CONVERTER>
2831 const SI_CHAR *a_pSection,
const SI_CHAR *a_pKey,
const SI_CHAR *a_pValue,
2832 bool a_bRemoveEmpty) {
2837 typename TSection::iterator iSection = m_data.find(a_pSection);
2838 if (iSection == m_data.end()) {
2844 typename TKeyVal::iterator iKeyVal = iSection->second.find(a_pKey);
2845 if (iKeyVal == iSection->second.end()) {
2849 const static SI_STRLESS isLess = SI_STRLESS();
2852 typename TKeyVal::iterator iDelete;
2853 bool bDeleted =
false;
2855 iDelete = iKeyVal++;
2857 if (a_pValue == NULL || (isLess(a_pValue, iDelete->second) ==
false &&
2858 isLess(iDelete->second, a_pValue) ==
false)) {
2859 DeleteString(iDelete->first.pItem);
2860 DeleteString(iDelete->first.pComment);
2861 DeleteString(iDelete->second);
2862 iSection->second.erase(iDelete);
2865 }
while (iKeyVal != iSection->second.end() &&
2866 !IsLess(a_pKey, iKeyVal->first.pItem));
2875 if (!a_bRemoveEmpty || !iSection->second.empty()) {
2881 typename TKeyVal::iterator iKeyVal = iSection->second.begin();
2882 for (; iKeyVal != iSection->second.end(); ++iKeyVal) {
2883 DeleteString(iKeyVal->first.pItem);
2884 DeleteString(iKeyVal->first.pComment);
2885 DeleteString(iKeyVal->second);
2890 DeleteString(iSection->first.pItem);
2891 DeleteString(iSection->first.pComment);
2892 m_data.erase(iSection);
2897template <
class SI_CHAR,
class SI_STRLESS,
class SI_CONVERTER>
2898void CSimpleIniTempl<SI_CHAR, SI_STRLESS, SI_CONVERTER>::DeleteString(
2899 const SI_CHAR *a_pString) {
2906 if (!m_pData || a_pString < m_pData || a_pString >= m_pData + m_uDataLen) {
2907 typename TNamesDepend::iterator i = m_strings.begin();
2908 for (; i != m_strings.end(); ++i) {
2909 if (a_pString == i->pItem) {
2910 delete[]
const_cast<SI_CHAR *
>(i->pItem);
2936#if !defined(SI_NO_CONVERSION) && !defined(SI_CONVERT_GENERIC) && \
2937 !defined(SI_CONVERT_WIN32) && !defined(SI_CONVERT_ICU)
2939#define SI_CONVERT_WIN32
2941#define SI_NO_CONVERSION
2951 bool operator()(
const SI_CHAR *pLeft,
const SI_CHAR *pRight)
const {
2953 for (; *pLeft && *pRight; ++pLeft, ++pRight) {
2954 cmp = (long)*pLeft - (
long)*pRight;
2959 return *pRight != 0;
2970 inline SI_CHAR locase(SI_CHAR ch)
const {
2971 return (ch <
'A' || ch >
'Z') ? ch : (ch -
'A' +
'a');
2973 bool operator()(
const SI_CHAR *pLeft,
const SI_CHAR *pRight)
const {
2975 for (; *pLeft && *pRight; ++pLeft, ++pRight) {
2976 cmp = (long)locase(*pLeft) - (long)locase(*pRight);
2981 return *pRight != 0;
2988template <
class SI_CHAR>
class SI_ConvertA {
2989 bool m_bStoreIsUtf8;
2995 SI_ConvertA(
bool a_bStoreIsUtf8) : m_bStoreIsUtf8(a_bStoreIsUtf8) {}
2998 SI_ConvertA(
const SI_ConvertA &rhs) { operator=(rhs); }
2999 SI_ConvertA &operator=(
const SI_ConvertA &rhs) {
3000 m_bStoreIsUtf8 = rhs.m_bStoreIsUtf8;
3019 SI_ASSERT(a_uInputDataLen != (
size_t)-1);
3022 return a_uInputDataLen;
3039 SI_CHAR *a_pOutputData,
size_t a_uOutputDataSize) {
3041 if (a_uInputDataLen > a_uOutputDataSize) {
3044 memcpy(a_pOutputData, a_pInputData, a_uInputDataLen);
3060 return strlen((
const char *)a_pInputData) + 1;
3077 size_t a_uOutputDataSize) {
3079 size_t uInputLen = strlen((
const char *)a_pInputData) + 1;
3080 if (uInputLen > a_uOutputDataSize) {
3085 memcpy(a_pOutputData, a_pInputData, uInputLen);
3093#ifdef SI_CONVERT_GENERIC
3095#define SI_Case SI_GenericCase
3096#define SI_NoCase SI_GenericNoCase
3102constexpr char32_t REPLACEMENT = 0xFFFD;
3105inline bool Decode(
const char *&a_src,
const char *a_end,
char32_t &a_cp) {
3106 if (a_src >= a_end) {
3109 const unsigned char c0 = (
unsigned char)*a_src++;
3123 }
else if (c0 < 0xF0) {
3126 }
else if (c0 < 0xF5) {
3132 if (a_src + extra > a_end) {
3137 for (
int i = 0; i < extra; ++i) {
3138 const unsigned char cx = (
unsigned char)*a_src++;
3139 if ((cx & 0xC0) != 0x80) {
3143 ch = (ch << 6) | (cx & 0x3F);
3146 if ((extra == 1 && ch < 0x80) || (extra == 2 && ch < 0x800) ||
3147 (extra == 3 && ch < 0x10000) || ch > 0x10FFFF ||
3148 (ch >= 0xD800 && ch <= 0xDFFF)) {
3149 a_src -= (extra + 1);
3160inline int Encode(
char32_t a_cp,
char *a_dst,
size_t a_cap) {
3161 if (a_cp >= 0x110000 || (a_cp >= 0xD800 && a_cp <= 0xDFFF)) {
3168 a_dst[0] = (char)a_cp;
3174 a_dst[0] = (char)(0xC0 | (a_cp >> 6));
3175 a_dst[1] = (char)(0x80 | (a_cp & 0x3F));
3178 if (a_cp < 0x10000) {
3181 a_dst[0] = (char)(0xE0 | (a_cp >> 12));
3182 a_dst[1] = (char)(0x80 | ((a_cp >> 6) & 0x3F));
3183 a_dst[2] = (char)(0x80 | (a_cp & 0x3F));
3188 a_dst[0] = (char)(0xF0 | (a_cp >> 18));
3189 a_dst[1] = (char)(0x80 | ((a_cp >> 12) & 0x3F));
3190 a_dst[2] = (char)(0x80 | ((a_cp >> 6) & 0x3F));
3191 a_dst[3] = (char)(0x80 | (a_cp & 0x3F));
3195template <
class SI_CHAR>
3196inline bool AppendCodePoint(
char32_t a_cp, SI_CHAR *&a_dst, SI_CHAR *a_dstEnd) {
3197 if (
sizeof(SI_CHAR) >=
sizeof(
char32_t)) {
3198 if (a_dst >= a_dstEnd)
3200 *a_dst++ = (SI_CHAR)a_cp;
3203 if (
sizeof(SI_CHAR) == 2) {
3204 if (a_cp < 0x10000) {
3205 if (a_dst >= a_dstEnd)
3207 *a_dst++ = (SI_CHAR)a_cp;
3210 if (a_dst + 1 >= a_dstEnd)
3213 *a_dst++ = (SI_CHAR)(0xD800 + (a_cp >> 10));
3214 *a_dst++ = (SI_CHAR)(0xDC00 + (a_cp & 0x3FF));
3220template <
class SI_CHAR>
3221inline bool ReadCodePoint(
const SI_CHAR *&a_src,
char32_t &a_cp) {
3222 if (
sizeof(SI_CHAR) >=
sizeof(
char32_t)) {
3223 a_cp = (char32_t)*a_src++;
3226 if (
sizeof(SI_CHAR) == 2) {
3227 const char32_t w = (char32_t)*a_src++;
3228 if (w >= 0xD800 && w <= 0xDBFF) {
3229 if (*a_src >= 0xDC00 && *a_src <= 0xDFFF) {
3230 a_cp = 0x10000 + ((w - 0xD800) << 10) + ((
char32_t)*a_src++ - 0xDC00);
3246template <
class SI_CHAR>
class SI_ConvertW {
3247 bool m_bStoreIsUtf8;
3253 SI_ConvertW(
bool a_bStoreIsUtf8) : m_bStoreIsUtf8(a_bStoreIsUtf8) {}
3256 SI_ConvertW(
const SI_ConvertW &rhs) { operator=(rhs); }
3257 SI_ConvertW &operator=(
const SI_ConvertW &rhs) {
3258 m_bStoreIsUtf8 = rhs.m_bStoreIsUtf8;
3275 size_t SizeFromStore(
const char *a_pInputData,
size_t a_uInputDataLen) {
3276 SI_ASSERT(a_uInputDataLen != (
size_t)-1);
3278 if (m_bStoreIsUtf8) {
3282 return a_uInputDataLen;
3286#if defined(_MSC_VER)
3288 errno_t e = mbstowcs_s(&uBufSiz, NULL, 0, a_pInputData, a_uInputDataLen);
3289 return (e == 0) ? uBufSiz : (size_t)-1;
3290#elif !defined(SI_NO_MBSTOWCS_NULL)
3294 return mbstowcs(NULL, a_pInputData, a_uInputDataLen);
3299 return a_uInputDataLen;
3316 bool ConvertFromStore(
const char *a_pInputData,
size_t a_uInputDataLen,
3317 SI_CHAR *a_pOutputData,
size_t a_uOutputDataSize) {
3318 if (m_bStoreIsUtf8) {
3319 const char *src = a_pInputData;
3320 const char *srcEnd = a_pInputData + a_uInputDataLen;
3321 SI_CHAR *dst = a_pOutputData;
3322 SI_CHAR *dstEnd = a_pOutputData + a_uOutputDataSize;
3323 if (
sizeof(SI_CHAR) != 2 &&
sizeof(SI_CHAR) <
sizeof(
char32_t)) {
3326 while (src < srcEnd) {
3328 if (!SI_UTF8::Decode(src, srcEnd, cp)) {
3331 if (!SI_UTF8::AppendCodePoint(cp, dst, dstEnd)) {
3339#if defined(_MSC_VER)
3341 errno_t e = mbstowcs_s(&uBufSiz, a_pOutputData, a_uOutputDataSize,
3342 a_pInputData, a_uInputDataLen);
3346 size_t retval = mbstowcs(a_pOutputData, a_pInputData, a_uOutputDataSize);
3347 return retval != (size_t)(-1);
3361 size_t SizeToStore(
const SI_CHAR *a_pInputData) {
3362 if (m_bStoreIsUtf8) {
3365 while (a_pInputData[uLen]) {
3368 return (6 * uLen) + 1;
3370#if defined(_MSC_VER)
3372 errno_t e = wcstombs_s(&uLen, NULL, 0, a_pInputData, 0);
3378 size_t uLen = wcstombs(NULL, a_pInputData, 0);
3379 if (uLen == (
size_t)(-1)) {
3400 bool ConvertToStore(
const SI_CHAR *a_pInputData,
char *a_pOutputData,
3401 size_t a_uOutputDataSize) {
3402 if (m_bStoreIsUtf8) {
3403 const SI_CHAR *src = a_pInputData;
3404 char *dst = a_pOutputData;
3405 char *dstEnd = a_pOutputData + a_uOutputDataSize;
3406 if (
sizeof(SI_CHAR) != 2 &&
sizeof(SI_CHAR) <
sizeof(
char32_t)) {
3411 if (!SI_UTF8::ReadCodePoint(src, cp)) {
3415 const int n = SI_UTF8::Encode(cp, buf,
sizeof(buf));
3416 if (n < 0 || (
size_t)(dstEnd - dst) < (
size_t)n) {
3419 memcpy(dst, buf, (
size_t)n);
3422 if (dst >= dstEnd) {
3428#if defined(_MSC_VER)
3429 size_t converted = 0;
3430 errno_t e = wcstombs_s(&converted, a_pOutputData, a_uOutputDataSize,
3434 size_t retval = wcstombs(a_pOutputData, a_pInputData, a_uOutputDataSize);
3435 return retval != (size_t)-1;
3446#ifdef SI_CONVERT_ICU
3448#define SI_Case SI_GenericCase
3449#define SI_NoCase SI_GenericNoCase
3451#include <unicode/ucnv.h>
3456template <
class SI_CHAR>
class SI_ConvertW {
3457 const char *m_pEncoding;
3458 UConverter *m_pConverter;
3461 SI_ConvertW() : m_pEncoding(NULL), m_pConverter(NULL) {}
3464 SI_ConvertW(
bool a_bStoreIsUtf8) : m_pConverter(NULL) {
3465 m_pEncoding = a_bStoreIsUtf8 ?
"UTF-8" : NULL;
3469 SI_ConvertW(
const SI_ConvertW &rhs) { operator=(rhs); }
3470 SI_ConvertW &operator=(
const SI_ConvertW &rhs) {
3471 m_pEncoding = rhs.m_pEncoding;
3472 m_pConverter = NULL;
3477 ucnv_close(m_pConverter);
3493 size_t SizeFromStore(
const char *a_pInputData,
size_t a_uInputDataLen) {
3494 SI_ASSERT(a_uInputDataLen != (
size_t)-1);
3498 if (!m_pConverter) {
3499 nError = U_ZERO_ERROR;
3500 m_pConverter = ucnv_open(m_pEncoding, &nError);
3501 if (U_FAILURE(nError)) {
3506 nError = U_ZERO_ERROR;
3507 int32_t nLen = ucnv_toUChars(m_pConverter, NULL, 0, a_pInputData,
3508 (int32_t)a_uInputDataLen, &nError);
3509 if (U_FAILURE(nError) && nError != U_BUFFER_OVERFLOW_ERROR) {
3513 return (
size_t)nLen;
3529 bool ConvertFromStore(
const char *a_pInputData,
size_t a_uInputDataLen,
3530 UChar *a_pOutputData,
size_t a_uOutputDataSize) {
3533 if (!m_pConverter) {
3534 nError = U_ZERO_ERROR;
3535 m_pConverter = ucnv_open(m_pEncoding, &nError);
3536 if (U_FAILURE(nError)) {
3541 nError = U_ZERO_ERROR;
3542 ucnv_toUChars(m_pConverter, a_pOutputData, (int32_t)a_uOutputDataSize,
3543 a_pInputData, (int32_t)a_uInputDataLen, &nError);
3544 if (U_FAILURE(nError)) {
3561 size_t SizeToStore(
const UChar *a_pInputData) {
3564 if (!m_pConverter) {
3565 nError = U_ZERO_ERROR;
3566 m_pConverter = ucnv_open(m_pEncoding, &nError);
3567 if (U_FAILURE(nError)) {
3572 nError = U_ZERO_ERROR;
3574 ucnv_fromUChars(m_pConverter, NULL, 0, a_pInputData, -1, &nError);
3575 if (U_FAILURE(nError) && nError != U_BUFFER_OVERFLOW_ERROR) {
3579 return (
size_t)nLen + 1;
3595 bool ConvertToStore(
const UChar *a_pInputData,
char *a_pOutputData,
3596 size_t a_uOutputDataSize) {
3599 if (!m_pConverter) {
3600 nError = U_ZERO_ERROR;
3601 m_pConverter = ucnv_open(m_pEncoding, &nError);
3602 if (U_FAILURE(nError)) {
3607 nError = U_ZERO_ERROR;
3608 ucnv_fromUChars(m_pConverter, a_pOutputData, (int32_t)a_uOutputDataSize,
3609 a_pInputData, -1, &nError);
3610 if (U_FAILURE(nError)) {
3623#ifdef SI_CONVERT_WIN32
3625#define SI_Case SI_GenericCase
3636#define SI_NoCase SI_GenericNoCase
3646#include <mbstring.h>
3647template <
class SI_CHAR>
struct SI_NoCase {
3648 bool operator()(
const SI_CHAR *pLeft,
const SI_CHAR *pRight)
const {
3649 if (
sizeof(SI_CHAR) ==
sizeof(
char)) {
3650 return _mbsicmp((
const unsigned char *)pLeft,
3651 (
const unsigned char *)pRight) < 0;
3653 if (
sizeof(SI_CHAR) ==
sizeof(
wchar_t)) {
3654 return _wcsicmp((
const wchar_t *)pLeft, (
const wchar_t *)pRight) < 0;
3656 return SI_GenericNoCase<SI_CHAR>()(pLeft, pRight);
3667template <
class SI_CHAR>
class SI_ConvertW {
3674 SI_ConvertW(
bool a_bStoreIsUtf8) {
3675 m_uCodePage = a_bStoreIsUtf8 ? CP_UTF8 : CP_ACP;
3679 SI_ConvertW(
const SI_ConvertW &rhs) { operator=(rhs); }
3680 SI_ConvertW &operator=(
const SI_ConvertW &rhs) {
3681 m_uCodePage = rhs.m_uCodePage;
3698 size_t SizeFromStore(
const char *a_pInputData,
size_t a_uInputDataLen) {
3699 SI_ASSERT(a_uInputDataLen != (
size_t)-1);
3701 int retval = MultiByteToWideChar(m_uCodePage, 0, a_pInputData,
3702 (
int)a_uInputDataLen, 0, 0);
3703 return (
size_t)(retval > 0 ? retval : -1);
3719 bool ConvertFromStore(
const char *a_pInputData,
size_t a_uInputDataLen,
3720 SI_CHAR *a_pOutputData,
size_t a_uOutputDataSize) {
3722 MultiByteToWideChar(m_uCodePage, 0, a_pInputData, (
int)a_uInputDataLen,
3723 (
wchar_t *)a_pOutputData, (
int)a_uOutputDataSize);
3737 size_t SizeToStore(
const SI_CHAR *a_pInputData) {
3738 int retval = WideCharToMultiByte(
3739 m_uCodePage, 0, (
const wchar_t *)a_pInputData, -1, 0, 0, 0, 0);
3740 return (
size_t)(retval > 0 ? retval : -1);
3756 bool ConvertToStore(
const SI_CHAR *a_pInputData,
char *a_pOutputData,
3757 size_t a_uOutputDataSize) {
3759 WideCharToMultiByte(m_uCodePage, 0, (
const wchar_t *)a_pInputData, -1,
3760 a_pOutputData, (
int)a_uOutputDataSize, 0, 0);
3770#ifdef SI_NO_CONVERSION
3772#define SI_Case SI_GenericCase
3773#define SI_NoCase SI_GenericNoCase
3784#if defined(SI_NO_CONVERSION)
3787#define CSimpleIni CSimpleIniA
3788#define CSimpleIniCase CSimpleIniCaseA
3789#define SI_NEWLINE SI_NEWLINE_A
3791#if defined(SI_CONVERT_ICU)
3804#define CSimpleIni CSimpleIniW
3805#define CSimpleIniCase CSimpleIniCaseW
3806#define SI_NEWLINE SI_NEWLINE_W
3808#define CSimpleIni CSimpleIniA
3809#define CSimpleIniCase CSimpleIniCaseA
3810#define SI_NEWLINE SI_NEWLINE_A
Definition SimpleIni.h:448
Definition SimpleIni.h:405
Definition SimpleIni.h:393
Definition SimpleIni.h:331
bool DeleteValue(const SI_CHAR *a_pSection, const SI_CHAR *a_pKey, const SI_CHAR *a_pValue, bool a_bRemoveEmpty=false)
Definition SimpleIni.h:2830
bool GetAllKeys(const SI_CHAR *a_pSection, TNamesDepend &a_names) const
Definition SimpleIni.h:2547
int GetSectionSize(const SI_CHAR *a_pSection) const
Definition SimpleIni.h:2492
void SetAllowKeyOnly(bool a_bAllowKeyOnly=true)
Definition SimpleIni.h:592
SI_Error LoadData(const std::string &a_strData)
Definition SimpleIni.h:652
bool UsingQuotes() const
Definition SimpleIni.h:582
std::map< Entry, TKeyVal, typename Entry::KeyOrder > TSection
Definition SimpleIni.h:383
std::list< Entry > TNamesDepend
Definition SimpleIni.h:388
SI_Error SaveFile(FILE *a_pFile, bool a_bAddSignature=false) const
Definition SimpleIni.h:2619
bool IsUnicode() const
Definition SimpleIni.h:521
SI_Error SetBoolValue(const SI_CHAR *a_pSection, const SI_CHAR *a_pKey, bool a_bValue, const SI_CHAR *a_pComment=NULL, bool a_bForceReplace=false)
Definition SimpleIni.h:2434
bool IsMultiKey() const
Definition SimpleIni.h:546
Converter GetConverter() const
Definition SimpleIni.h:1115
bool IsEmpty() const
Definition SimpleIni.h:496
std::multimap< Entry, const SI_CHAR *, typename Entry::KeyOrder > TKeyVal
Definition SimpleIni.h:380
const TKeyVal * GetSection(const SI_CHAR *a_pSection) const
Definition SimpleIni.h:2525
SI_Error Save(OutputWriter &a_oOutput, bool a_bAddSignature=false) const
Definition SimpleIni.h:2626
const SI_CHAR * GetValue(const SI_CHAR *a_pSection, const SI_CHAR *a_pKey, const SI_CHAR *a_pDefault=NULL, bool *a_pHasMultiple=NULL) const
Definition SimpleIni.h:2242
bool GetBoolValue(const SI_CHAR *a_pSection, const SI_CHAR *a_pKey, bool a_bDefault=false, bool *a_pHasMultiple=NULL) const
Definition SimpleIni.h:2396
SI_Error LoadFile(FILE *a_fpFile)
Definition SimpleIni.h:1445
long GetLongValue(const SI_CHAR *a_pSection, const SI_CHAR *a_pKey, long a_nDefault=0, bool *a_pHasMultiple=NULL) const
Definition SimpleIni.h:2274
void GetAllSections(TNamesDepend &a_names) const
Definition SimpleIni.h:2537
void Reset()
Definition SimpleIni.h:1280
~CSimpleIniTempl()
Definition SimpleIni.h:1275
bool UsingSpaces() const
Definition SimpleIni.h:571
SI_Error Save(std::string &a_sBuffer, bool a_bAddSignature=false) const
Definition SimpleIni.h:774
bool KeyExists(const SI_CHAR *a_pSection, const SI_CHAR *a_pKey) const
Definition SimpleIni.h:869
SI_Error SetValue(const SI_CHAR *a_pSection, const SI_CHAR *a_pKey, const SI_CHAR *a_pValue, const SI_CHAR *a_pComment=NULL, bool a_bForceReplace=false)
Definition SimpleIni.h:978
bool SectionExists(const SI_CHAR *a_pSection) const
Definition SimpleIni.h:864
bool Delete(const SI_CHAR *a_pSection, const SI_CHAR *a_pKey, bool a_bRemoveEmpty=false)
Definition SimpleIni.h:2824
void SetMultiLine(bool a_bAllowMultiLine=true)
Definition SimpleIni.h:555
SI_Error LoadData(const char *a_pData, size_t a_uDataLen)
Definition SimpleIni.h:1475
void SetQuotes(bool a_bParseQuotes=true)
Definition SimpleIni.h:577
void SetUnicode(bool a_bIsUtf8=true)
Definition SimpleIni.h:515
double GetDoubleValue(const SI_CHAR *a_pSection, const SI_CHAR *a_pKey, double a_nDefault=0, bool *a_pHasMultiple=NULL) const
Definition SimpleIni.h:2339
SI_Error SetLongValue(const SI_CHAR *a_pSection, const SI_CHAR *a_pKey, long a_nValue, const SI_CHAR *a_pComment=NULL, bool a_bUseHex=false, bool a_bForceReplace=false)
Definition SimpleIni.h:2310
void SetMultiKey(bool a_bAllowMultiKey=true)
Definition SimpleIni.h:541
bool GetAllValues(const SI_CHAR *a_pSection, const SI_CHAR *a_pKey, TNamesDepend &a_values) const
Definition SimpleIni.h:2458
void SetSpaces(bool a_bSpaces=true)
Definition SimpleIni.h:568
SI_Error LoadFile(const char *a_pszFile)
Definition SimpleIni.h:1398
bool GetAllowKeyOnly() const
Definition SimpleIni.h:597
SI_Error SaveFile(const char *a_pszFile, bool a_bAddSignature=true) const
Definition SimpleIni.h:2574
CSimpleIniTempl(bool a_bIsUtf8=false, bool a_bMultiKey=false, bool a_bMultiLine=false)
Definition SimpleIni.h:1267
SI_Error SetDoubleValue(const SI_CHAR *a_pSection, const SI_CHAR *a_pKey, double a_nValue, const SI_CHAR *a_pComment=NULL, bool a_bForceReplace=false)
Definition SimpleIni.h:2367
bool IsMultiLine() const
Definition SimpleIni.h:560
Definition SimpleIni.h:2988
bool ConvertToStore(const SI_CHAR *a_pInputData, char *a_pOutputData, size_t a_uOutputDataSize)
Definition SimpleIni.h:3076
size_t SizeFromStore(const char *a_pInputData, size_t a_uInputDataLen)
Definition SimpleIni.h:3017
size_t SizeToStore(const SI_CHAR *a_pInputData)
Definition SimpleIni.h:3058
bool ConvertFromStore(const char *a_pInputData, size_t a_uInputDataLen, SI_CHAR *a_pOutputData, size_t a_uOutputDataSize)
Definition SimpleIni.h:3038
Definition SimpleIni.h:360
Definition SimpleIni.h:368
Definition SimpleIni.h:336
Definition SimpleIni.h:2950
Definition SimpleIni.h:2969