Browse Source

Additional getSection() function added to INIFile.

release/0.19
JustinAJ 10 years ago
parent
commit
c9da8dc226
  1. 13
      Jupiter/INIFile.cpp
  2. 12
      Jupiter/INIFile.h
  3. BIN
      Release/Jupiter.lib

13
Jupiter/INIFile.cpp

@ -378,12 +378,19 @@ Jupiter::INIFile::Section *Jupiter::INIFile::getSection(size_t index) const
return Jupiter::INIFile::data_->data.get(index); return Jupiter::INIFile::data_->data.get(index);
} }
Jupiter::INIFile::Section *Jupiter::INIFile::getSection(const Jupiter::ReadableString &section) const
{
for (size_t i = 0; i != Jupiter::INIFile::data_->data.size(); i++)
if (Jupiter::INIFile::data_->data.get(i)->getName().equalsi(section))
return Jupiter::INIFile::data_->data.get(i);
return nullptr;
}
size_t Jupiter::INIFile::getSectionIndex(const Jupiter::ReadableString &section) const size_t Jupiter::INIFile::getSectionIndex(const Jupiter::ReadableString &section) const
{ {
for (size_t i = 0; i != Jupiter::INIFile::data_->data.size(); i++) for (size_t i = 0; i != Jupiter::INIFile::data_->data.size(); i++)
{ if (Jupiter::INIFile::data_->data.get(i)->getName().equalsi(section))
if (Jupiter::INIFile::data_->data.get(i)->getName().equalsi(section)) return i; return i;
}
return Jupiter::INVALID_INDEX; return Jupiter::INVALID_INDEX;
} }

12
Jupiter/INIFile.h

@ -264,14 +264,22 @@ namespace Jupiter
* @brief Returns a section. * @brief Returns a section.
* *
* @param index Index of the section to get. * @param index Index of the section to get.
* @return String containing section if it exists, nullptr otherwise. * @return Section if it exists, nullptr otherwise.
*/ */
Jupiter::INIFile::Section *getSection(size_t index) const; Jupiter::INIFile::Section *getSection(size_t index) const;
/**
* @brief Returns a section.
*
* @param section Name of the section.
* @return Section if it exists, nullptr otherwise.
*/
Jupiter::INIFile::Section *getSection(const Jupiter::ReadableString &section) const;
/** /**
* @brief Returns the index of a section. * @brief Returns the index of a section.
* *
* @param section The name of the section. * @param section Name of the section.
* @return The index of section if it exists, INVALID_INDEX (-1) otherwise. * @return The index of section if it exists, INVALID_INDEX (-1) otherwise.
*/ */
size_t getSectionIndex(const Jupiter::ReadableString &section) const; size_t getSectionIndex(const Jupiter::ReadableString &section) const;

BIN
Release/Jupiter.lib

Binary file not shown.
Loading…
Cancel
Save