프로그래밍언어/C++
[C++ Builder] TIniFile 클래스
쏘니빔
2024. 5. 28. 14:36
#include <IniFiles.hpp>
1. TIniFile
Section, Key 관련 함수
- E : 섹션 삭제
- ReadSection : 섹션에 있는 모든 키 가져옴
- ReadSections : 모든 섹션 가져옴
- ReadSectionValues : 섹션에 있는 모든 키,값 가져옴
- SectionExists : 섹션 존재 여부 확인
-DeleteKey : 섹션 내 특정 키 삭제
Value 관련 함수
Readbool, ReadDate, ReadDateTime, ReadFloat, ReadInteger, ReadString, ReadTime : 해당하는 타입의 값 가져옴
Writebool, WriteDate, WriteDateTime, WriteFloat, WriteInteger, WriteString, WriteTime : 해당하는 타입의 값 입력
출처 : https://dlsenfl.tistory.com/entry/TIniFile
모든 섹션 vector에 들고 오는 함수
std::vector<String> IniSet::ReadSections()
{
TIniFile *iniFile = new TIniFile(IniPath);
std::vector<String> sections;
TStrings *sectionList = new TStringList;
try
{
iniFile->ReadSections(sectionList);
for (int i=0; i<sectionList->Count; ++i)
{
sections.push_back(sectionList->Strings[i].c_str());
}
}
__finally
{
delete sectionList;
delete iniFile;
}
return sections;
}