MIL << " - " << (*it2).first << " | " << (*it2).second << endl;
}
}
+
+ BOOST_CHECK( dict.hasSection("addons") );
+ BOOST_CHECK( !dict.hasSection("uhlala") );
+ BOOST_CHECK( dict.hasEntry("contrib", "name") );
+ BOOST_CHECK( !dict.hasEntry("foo", "bar") );
}
void ini_read_test2(const string &dir)
_dict.erase(section);
}
+ bool IniDict::hasSection( const std::string §ion ) const
+ {
+ SectionSet::const_iterator secit = _dict.find(section);
+ if ( secit == _dict.end() )
+ return false;
+ return true;
+ }
+
+ bool IniDict::hasEntry( const std::string §ion,
+ const std::string &entry ) const
+ {
+ SectionSet::const_iterator secit = _dict.find(section);
+ if ( secit == _dict.end() )
+ return false;
+
+ EntrySet::const_iterator entryit = (secit->second).find(entry);
+ if ( entryit == (secit->second).end() )
+ return false;
+
+ return true;
+ }
+
/******************************************************************
**
** FUNCTION NAME : operator<<
*/
void deleteSection( const std::string §ion );
+ /**
+ * \short True if there is a section with that name
+ * \param section Section Name
+ */
+ bool hasSection( const std::string §ion ) const;
+
+ /**
+ * \short True if an entry exists in the section
+ * \param section Section name
+ * \param entry entry name
+ *
+ * \note If the given section does not exist, this will
+ * of course return false.
+ */
+ bool hasEntry( const std::string §ion,
+ const std::string &entry ) const;
public:
/** Called when a section is found. */