/[usata]/usata2/src/config.cpp
ViewVC logotype

Diff of /usata2/src/config.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.19 by skunix, Sun Jan 2 02:48:32 2005 UTC revision 1.20 by skunix, Thu Jan 20 20:20:30 2005 UTC
# Line 363  ConfigSection::ConfigSection(const std:: Line 363  ConfigSection::ConfigSection(const std::
363          }          }
364  }  }
365    
366    
367    const char * TrueBoolStrings[] = { "yes", "true","enable", 0};
368    
369    
370    bool
371    ConfigSection::get_as_bool(const std::string&key)
372    {
373            std::string v = get(key);
374            
375            const char ** ptr = TrueBoolStrings;    
376            
377            while (*ptr != 0)
378            {
379                    if (v == *ptr)return true;
380                    ++ptr;
381            }      
382    
383            return false;  
384    }
385  std::string  std::string
386  ConfigSection::get(const std::string&key)const  ConfigSection::get(const std::string&key)const
387  {  {
# Line 386  ConfigSection::get(const std::string& ke Line 405  ConfigSection::get(const std::string& ke
405    
406  }  }
407    
408    bool
409    ConfigSection::get_b(const std::string& key, bool d)
410    {
411            try
412            {
413                    return get_as_bool(key);
414            }
415            catch(ConfigMissingKey&x)
416            {
417                    return d;
418            }
419    }
420    
421    
422  void  void
423  ConfigSection::set(const std::string& key, const std::string& value)  ConfigSection::set(const std::string& key, const std::string& value)
424  {  {

Legend:
Removed from v.1.19  
changed lines
  Added in v.1.20

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26