|  |   
 INTRODUCTION
 Overview
 Download and Install
 Quick Start
 Documentation
 Publications
 
 NONFRAMEWORK CODE
 Driver Interfaces
 Drivers
 Libraries
 Utilities
 
 FRAMEWORK CODE
 Interfaces
 Components
 Libraries
 Utilities
 
 Full Software Listings
 
 DEVELOPER
 Tutorials
 Examples
 Dev Guide
 Dashboard
 
 PEOPLE
 Contributors
 Users
 
 
  Project
 Download
 Mailing lists
   |  |  | 
hydroutil::Properties Class ReferenceContainer for key-value pairs, useful for storing configuration properties.  
More... #include <properties.h>
 List of all members. 
| Classes |  | struct | Config |  |  | Configuration structure for Properties.  More... 
 |  | Public Member Functions |  |  | Properties (const Config &config=Config()) |  |  | Constructor. 
 |  |  | Properties (const std::map< std::string, std::string > &props, const std::string &removePrefix="", const Config &config=Config(), const std::string &previouslyStrippedPrefix="") |  | bool | isDefined (const ::std::string &key) |  | void | ensureDefined (const std::string &key) |  | int | getProperty (const ::std::string &key, std::string &value) const |  |  | Returns: 0 = property found (and set in value), non-zero = property not found. 
 |  | std::string | getPropertyWithDefault (const ::std::string &key, const std::string &defaultValue) const |  |  | Returns the default value if key is not found. 
 |  | int | getPropertyAsDouble (const ::std::string &key, double &value) const |  | double | getPropertyAsDoubleWithDefault (const ::std::string &key, const double defaultValue) const |  | int | getPropertyAsDoubleVector (const ::std::string &key, std::vector< double > &value) const |  | std::vector< double > | getPropertyAsDoubleVectorWithDefault (const ::std::string &key, const std::vector< double > &defaultValue) const |  | int | getPropertyAsInt (const ::std::string &key, int &value) const |  | int | getPropertyAsIntWithDefault (const ::std::string &key, const int defaultValue) const |  | int | getPropertyAsIntVector (const ::std::string &key, std::vector< int > &value) const |  | std::vector< int > | getPropertyAsIntVectorWithDefault (const ::std::string &key, const std::vector< int > &defaultValue) const |  | void | setProperty (const ::std::string &key, const ::std::string &value) |  |  | Sets property. 
 |  | Properties | propertiesWithStrippedPrefix (const std::string &prefixToStrip) const |  |  | Returns a version with the just those properties beginning with prefixToStrip, with that prefix stripped. 
 |  | size_t | size () const |  |  | Returns number of properties in the set. 
 |  | std::string | toString () const |  |  | Returns all properties in format "key=value" per line. 
 |  | std::string | missingPropertyWarning (const std::string &key, bool fatal=false) |  
 Detailed DescriptionContainer for key-value pairs, useful for storing configuration properties.  Not thread-safe.  
 Constructor & Destructor Documentation
      
        
          | hydroutil::Properties::Properties | ( | const std::map< std::string, std::string > & | props, |  
          |  |  | const std::string & | removePrefix = "", |  
          |  |  | const Config & | config = Config(), |  
          |  |  | const std::string & | previouslyStrippedPrefix = "" |  |  
          |  | ) |  |  |  |  
Copy constructor. If removePrefixis not empty, it is assumed that all keys inpropsstart with the same prefix and it is removed. This is a common situation whenpropsis the output of Ice::Properties::getPropertiesForPrefix() function. If a particular key does not have the specified prefix, it is quietly added unmodified. 
 Member Function Documentation
      
        
          | void Properties::ensureDefined | ( | const std::string & | key | ) |  |  
      
        
          | int hydroutil::Properties::getPropertyAsDouble | ( | const ::std::string & | key, |  
          |  |  | double & | value |  |  
          |  | ) |  |  | const |  
Returns: 0 = property found (and set in value), non-zero = property not found. Throws an gbxutilacfr::Exception if the key is found but the value cannot be converted to the desired type.  
      
        
          | int Properties::getPropertyAsDoubleVector | ( | const ::std::string & | key, |  
          |  |  | std::vector< double > & | value |  |  
          |  | ) |  |  | const |  
Parses the value into a vector of doubles assuming empty space delimeters. Elements will continue to be added to the end of the vector until the end of the line is reached. Returns: 0 = property found (and set in value), non-zero = property not found. Throws an gbxutilacfr::Exception if the key is found but the value cannot be converted to the desired type.  References getProperty(), and hydroutil::toDoubleVector(). Referenced by getPropertyAsDoubleVectorWithDefault(). 
      
        
          | std::vector< double > Properties::getPropertyAsDoubleVectorWithDefault | ( | const ::std::string & | key, |  
          |  |  | const std::vector< double > & | defaultValue |  |  
          |  | ) |  |  | const |  
Returns the default value if key is not found. Throws an gbxutilacfr::Exception if the key is found but the value cannot be converted to the desired type.  References getPropertyAsDoubleVector(). 
      
        
          | double hydroutil::Properties::getPropertyAsDoubleWithDefault | ( | const ::std::string & | key, |  
          |  |  | const double | defaultValue |  |  
          |  | ) |  |  | const |  
Returns the default value if key is not found. Throws an gbxutilacfr::Exception if the key is found but the value cannot be converted to the desired type.  
      
        
          | int hydroutil::Properties::getPropertyAsInt | ( | const ::std::string & | key, |  
          |  |  | int & | value |  |  
          |  | ) |  |  | const |  
Returns: 0 = property found (and set in value), non-zero = property not found. Throws an gbxutilacfr::Exception if the key is found but the value cannot be converted to the desired type.  
      
        
          | int Properties::getPropertyAsIntVector | ( | const ::std::string & | key, |  
          |  |  | std::vector< int > & | value |  |  
          |  | ) |  |  | const |  
Parses the value into a vector of ints assuming empty space delimeters. Elements will continue to be added to the end of the vector until the end of the line is reached. Returns: 0 = property found (and set in value), non-zero = property not found. Throws an gbxutilacfr::Exception if the key is found but the value cannot be converted to the desired type.  References getProperty(), and hydroutil::toIntVector(). Referenced by getPropertyAsIntVectorWithDefault(). 
      
        
          | std::vector< int > Properties::getPropertyAsIntVectorWithDefault | ( | const ::std::string & | key, |  
          |  |  | const std::vector< int > & | defaultValue |  |  
          |  | ) |  |  | const |  
Returns the default value if key is not found. Throws an gbxutilacfr::Exception if the key is found but the value cannot be converted to the desired type.  References getPropertyAsIntVector(). 
      
        
          | int hydroutil::Properties::getPropertyAsIntWithDefault | ( | const ::std::string & | key, |  
          |  |  | const int | defaultValue |  |  
          |  | ) |  |  | const |  
Returns the default value if key is not found. Throws an gbxutilacfr::Exception if the key is found but the value cannot be converted to the desired type.  Referenced by hydroiceutil::LocalHistory::LocalHistory(). 
      
        
          | bool Properties::isDefined | ( | const ::std::string & | key | ) |  |  
Returns TRUE if the property with keyis defined (even if it's empty) and FALSE if it is not defined. Referenced by ensureDefined(). 
      
        
          | std::string Properties::missingPropertyWarning | ( | const std::string & | key, |  
          |  |  | bool | fatal = false |  |  
          |  | ) |  |  |  |  
Returns standardized text which warns that a configuration property is not set. If fatalis TRUE, the message adds that "operation cannot continue". Referenced by ensureDefined(). 
 The documentation for this class was generated from the following files: |  |