mirror of
https://github.com/VCMP-SqMod/SqMod.git
synced 2024-11-08 08:47:17 +01:00
Add a method to the INI library to allow processing section keys through a custom functor.
This commit is contained in:
parent
b59710ddeb
commit
54531071c7
@ -752,6 +752,12 @@ public:
|
|||||||
/** @}
|
/** @}
|
||||||
@{ @name Accessing INI Data */
|
@{ @name Accessing INI Data */
|
||||||
|
|
||||||
|
template<class SI_CALLBACK>
|
||||||
|
bool ProcAllValues(
|
||||||
|
const SI_CHAR * a_pSection,
|
||||||
|
SI_CALLBACK callback
|
||||||
|
) const;
|
||||||
|
|
||||||
/** Retrieve all section names. The list is returned as an STL vector of
|
/** Retrieve all section names. The list is returned as an STL vector of
|
||||||
names and can be iterated or searched as necessary. Note that the
|
names and can be iterated or searched as necessary. Note that the
|
||||||
sort order of the returned strings is NOT DEFINED. You can sort
|
sort order of the returned strings is NOT DEFINED. You can sort
|
||||||
@ -2292,6 +2298,40 @@ CSimpleIniTempl<SI_CHAR,SI_STRLESS,SI_CONVERTER>::GetSection(
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*@@@*/
|
||||||
|
|
||||||
|
template<class SI_CHAR, class SI_STRLESS, class SI_CONVERTER>
|
||||||
|
template<class SI_CALLBACK>
|
||||||
|
bool
|
||||||
|
CSimpleIniTempl<SI_CHAR,SI_STRLESS,SI_CONVERTER>::ProcAllValues(
|
||||||
|
const SI_CHAR * a_pSection,
|
||||||
|
SI_CALLBACK callback
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
typedef typename CSimpleIniTempl<SI_CHAR,SI_STRLESS,SI_CONVERTER>::Entry::LoadOrder TKeyOrder;
|
||||||
|
typedef std::multimap<Entry,const SI_CHAR *,TKeyOrder> TKeyValOrd;
|
||||||
|
|
||||||
|
if (!a_pSection) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
typename TSection::const_iterator iSection = m_data.find(a_pSection);
|
||||||
|
if (iSection == m_data.end()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
TKeyValOrd section(iSection->second.begin(), iSection->second.end());
|
||||||
|
|
||||||
|
typename TKeyValOrd::const_iterator iKeyVal = section.begin();
|
||||||
|
for (;iKeyVal != section.end(); ++iKeyVal ) {
|
||||||
|
if (!callback(iKeyVal->first.pItem, iKeyVal->second)) {
|
||||||
|
return false; // premature stop
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
template<class SI_CHAR, class SI_STRLESS, class SI_CONVERTER>
|
template<class SI_CHAR, class SI_STRLESS, class SI_CONVERTER>
|
||||||
void
|
void
|
||||||
CSimpleIniTempl<SI_CHAR,SI_STRLESS,SI_CONVERTER>::GetAllSections(
|
CSimpleIniTempl<SI_CHAR,SI_STRLESS,SI_CONVERTER>::GetAllSections(
|
||||||
|
Loading…
Reference in New Issue
Block a user