[Saga-devel] saga SVN commit 3417: /trunk/saga/impl/engine/ini/
jpabecasis at cct.lsu.edu
jpabecasis at cct.lsu.edu
Sat Jan 31 15:31:37 CST 2009
User: jpabecasis
Date: 2009/01/31 03:31 PM
Modified:
/trunk/saga/impl/engine/ini/
ini.cpp
Log:
Might as well have a single implementation for get_entry...
File Changes:
Directory: /trunk/saga/impl/engine/ini/
=======================================
File [modified]: ini.cpp
Delta lines: +5 -28
===================================================================
--- trunk/saga/impl/engine/ini/ini.cpp 2009-01-31 21:29:57 UTC (rev 3416)
+++ trunk/saga/impl/engine/ini/ini.cpp 2009-01-31 21:31:05 UTC (rev 3417)
@@ -349,36 +349,13 @@
std::string saga::impl::ini::section::get_entry (std::string key) const
{
- std::string::size_type i = key.find (".", 0);
+ std::string result = get_entry(key, "");
- if ( i != std::string::npos )
- {
- std::string sub_sec = key.substr (0, i);
- std::string sub_key = key.substr (i+1, key.length () - i);
+ if (result.empty())
+ SAGA_THROW("No such key (" + key + ") in section " + get_name (),
+ saga::DoesNotExist);
- if ( has_section (sub_sec) )
- {
- section_map::const_iterator cit = sections.find(sub_sec);
- BOOST_ASSERT(cit != sections.end());
- return ((*cit).second.get_entry (sub_key));
- }
-
- SAGA_THROW("No such section (" + sub_sec + ") in section " + get_name (),
- saga::DoesNotExist);
- }
-
- entry_map::const_iterator cit = entries.find(key);
- if (cit != entries.end())
- {
- std::string result = expand_entry((*cit).second);
- if (!result.empty())
- return result;
- }
-
- SAGA_THROW("No such key (" + key + ") in section " + get_name (),
- saga::DoesNotExist);
-
- return std::string();
+ return result;
}
std::string saga::impl::ini::section::get_entry (std::string key,
More information about the saga-devel
mailing list