mirror of
https://github.com/electronicarts/CNC_TS_and_RA2_Mission_Editor.git
synced 2025-07-17 19:56:38 -04:00
Implemented IniMeta helpers to fetch combination of ini files .
This commit is contained in:
parent
d1a32df54b
commit
90fa8eb408
10 changed files with 308 additions and 4 deletions
39
MissionEditor/INIMeta.cpp
Normal file
39
MissionEditor/INIMeta.cpp
Normal file
|
@ -0,0 +1,39 @@
|
|||
#include "StdAfx.h"
|
||||
#include "INIMeta.h"
|
||||
#include <set>
|
||||
|
||||
void IniFileGroup::Append(const CIniFile& INI)
|
||||
{
|
||||
m_group.push_back(&INI);
|
||||
}
|
||||
|
||||
|
||||
const CIniFile* IniFileGroup::Nth(int idx) const
|
||||
{
|
||||
return m_group.at(idx);
|
||||
}
|
||||
|
||||
const CString& IniFileGroup::GetString(const CString & section, const CString & key) const
|
||||
{
|
||||
for (auto it = m_group.rbegin(); it != m_group.rend(); ++it) {
|
||||
auto const& got = (*it)->GetString(section, key);
|
||||
if (!got.IsEmpty()) {
|
||||
return got;
|
||||
}
|
||||
}
|
||||
return CIniFileSection::EmptyValue;
|
||||
}
|
||||
|
||||
CString IniFileGroup::GetStringOr(const CString & section, const CString & key, const CString& def) const
|
||||
{
|
||||
auto const& got = this->GetString(section, key);
|
||||
if (!got.IsEmpty()) {
|
||||
return got;
|
||||
}
|
||||
return def;
|
||||
}
|
||||
|
||||
IniSectionGroup IniFileGroup::GetSection(const CString& section) const
|
||||
{
|
||||
return IniSectionGroup(*this, section);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue