Difference for src/colvarparse.h from version 1.8 to 1.9

version 1.8version 1.9
Line 1
Line 1
 /// -*- c++ -*- // -*- c++ -*-
  
 #ifndef COLVARPARSE_H #ifndef COLVARPARSE_H
 #define COLVARPARSE_H #define COLVARPARSE_H
Line 53
Line 53
  
 public: public:
  
  
   inline colvarparse()   inline colvarparse()
     : save_delimiters(true)     : save_delimiters(true)
   {}   {
      init();
    }
  
   /// Constructor that stores the object's config string   /// Constructor that stores the object's config string
   inline colvarparse(const std::string& conf)   inline colvarparse(const std::string& conf)
     : save_delimiters(true), config_string(conf)     : save_delimiters(true)
   {}   {
      init(conf);
    }
  
    /// Set the object ready to parse a new configuration string
    inline void init()
    {
      config_string.clear();
      clear_keyword_registry();
    }
  
    /// Set a new config string for this object
    inline void init(const std::string& conf)
    {
      if (! config_string.size()) {
        init();
        config_string = conf;
      }
    }
  
   inline const std::string& get_config()   inline const std::string& get_config()
   {   {
Line 79
Line 100
     parse_silent     parse_silent
   };   };
  
    /// \brief Check that all the keywords within "conf" are in the list
    /// of allowed keywords; this will invoke strip_values() first and
    /// then loop over all words
    int check_keywords(std::string &conf, char const *key);
  
    /// \brief Use this after parsing a config string (note that check_keywords() calls it already)
    void clear_keyword_registry();
  
  public:
  
   /// \fn get_keyval bool const get_keyval (std::string const &conf,   /// \fn get_keyval bool const get_keyval (std::string const &conf,
   /// char const *key, _type_ &value, _type_ const &def_value,   /// char const *key, _type_ &value, _type_ const &def_value,
   /// Parse_Mode const parse_mode) \brief Helper function to parse   /// Parse_Mode const parse_mode) \brief Helper function to parse
Line 104
Line 135
   /// functions, or insert this type in the \link colvarvalue \endlink   /// functions, or insert this type in the \link colvarvalue \endlink
   /// wrapper class (colvarvalue.h).   /// wrapper class (colvarvalue.h).
  
 #define _get_keyval_scalar_proto_(_type_,_def_value_)           \   bool get_keyval(std::string const &conf,
   bool get_keyval(std::string const &conf,                      \                   char const *key,
                   char const *key,                              \                   int &value,
                   _type_ &value,                                \                   int const &def_value = (int)0,
                   _type_ const &def_value = _def_value_,        \                   Parse_Mode const parse_mode = parse_normal);
                   Parse_Mode const parse_mode = parse_normal)   bool get_keyval(std::string const &conf,
                    char const *key,
   _get_keyval_scalar_proto_(int, (int)0);                   size_t &value,
   _get_keyval_scalar_proto_(size_t, (size_t)0);                   size_t const &def_value = (size_t)0,
   _get_keyval_scalar_proto_(long, 0);                   Parse_Mode const parse_mode = parse_normal);
   _get_keyval_scalar_proto_(std::string, std::string(""));   bool get_keyval(std::string const &conf,
   _get_keyval_scalar_proto_(cvm::real, (cvm::real)0.0);                   char const *key,
   _get_keyval_scalar_proto_(cvm::rvector, cvm::rvector());                   long &value,
   _get_keyval_scalar_proto_(cvm::quaternion, cvm::quaternion());                   long const &def_value = 0,
   _get_keyval_scalar_proto_(colvarvalue, colvarvalue(colvarvalue::type_notset));                   Parse_Mode const parse_mode = parse_normal);
   _get_keyval_scalar_proto_(bool, false);   bool get_keyval(std::string const &conf,
                    char const *key,
 #define _get_keyval_vector_proto_(_type_,_def_value_)                   \                   std::string &value,
   bool get_keyval(std::string const &conf,                              \                   std::string const &def_value = std::string(""),
                   char const *key,                                      \                   Parse_Mode const parse_mode = parse_normal);
                   std::vector<_type_> &values,                          \   bool get_keyval(std::string const &conf,
                   std::vector<_type_> const &def_values =               \                   char const *key,
                   std::vector<_type_> (0, static_cast<_type_>(_def_value_)), \                   cvm::real &value,
                   Parse_Mode const parse_mode = parse_normal)                   cvm::real const &def_value = (cvm::real)0.0,
                    Parse_Mode const parse_mode = parse_normal);
   _get_keyval_vector_proto_(int, 0);   bool get_keyval(std::string const &conf,
   _get_keyval_vector_proto_(size_t, 0);                   char const *key,
   _get_keyval_vector_proto_(long, 0);                   cvm::rvector &value,
   _get_keyval_vector_proto_(std::string, std::string(""));                   cvm::rvector const &def_value = cvm::rvector(),
   _get_keyval_vector_proto_(cvm::real, 0.0);                   Parse_Mode const parse_mode = parse_normal);
   _get_keyval_vector_proto_(cvm::rvector, cvm::rvector());   bool get_keyval(std::string const &conf,
   _get_keyval_vector_proto_(cvm::quaternion, cvm::quaternion());                   char const *key,
   _get_keyval_vector_proto_(colvarvalue, colvarvalue(colvarvalue::type_notset));                   cvm::quaternion &value,
                    cvm::quaternion const &def_value = cvm::quaternion(),
                    Parse_Mode const parse_mode = parse_normal);
    bool get_keyval(std::string const &conf,
                    char const *key,
                    colvarvalue &value,
                    colvarvalue const &def_value = colvarvalue(colvarvalue::type_notset),
                    Parse_Mode const parse_mode = parse_normal);
    bool get_keyval(std::string const &conf,
                    char const *key,
                    bool &value,
                    bool const &def_value = false,
                    Parse_Mode const parse_mode = parse_normal);
    bool get_keyval(std::string const &conf,
                    char const *key,
                    std::vector<int> &values,
                    std::vector<int> const &def_values = std::vector<int>(0, (int)0),
                    Parse_Mode const parse_mode = parse_normal);
    bool get_keyval(std::string const &conf,
                    char const *key,
                    std::vector<size_t> &values,
                    std::vector<size_t> const &def_values = std::vector<size_t>(0, (size_t)0),
                    Parse_Mode const parse_mode = parse_normal);
    bool get_keyval(std::string const &conf,
                    char const *key,
                    std::vector<long> &values,
                    std::vector<long> const &def_values = std::vector<long>(0, (long)0),
                    Parse_Mode const parse_mode = parse_normal);
    bool get_keyval(std::string const &conf,
                    char const *key,
                    std::vector<std::string> &values,
                    std::vector<std::string> const &def_values = std::vector<std::string>(0, std::string("")),
                    Parse_Mode const parse_mode = parse_normal);
    bool get_keyval(std::string const &conf,
                    char const *key,
                    std::vector<cvm::real> &values,
                    std::vector<cvm::real> const &def_values = std::vector<cvm::real>(0, (cvm::real)0.0),
                    Parse_Mode const parse_mode = parse_normal);
    bool get_keyval(std::string const &conf,
                    char const *key,
                    std::vector<cvm::rvector> &values,
                    std::vector<cvm::rvector> const &def_values = std::vector<cvm::rvector>(0, cvm::rvector()),
                    Parse_Mode const parse_mode = parse_normal);
    bool get_keyval(std::string const &conf,
                    char const *key,
                    std::vector<cvm::quaternion> &values,
                    std::vector<cvm::quaternion> const &def_values = std::vector<cvm::quaternion>(0, cvm::quaternion()),
                    Parse_Mode const parse_mode = parse_normal);
    bool get_keyval(std::string const &conf,
                    char const *key,
                    std::vector<colvarvalue> &values,
                    std::vector<colvarvalue> const &def_values = std::vector<colvarvalue>(0, colvarvalue(colvarvalue::type_notset)),
                    Parse_Mode const parse_mode = parse_normal);
  
  protected:
  
   /// \brief Check that all the keywords within "conf" are in the list   // Templates
   /// of allowed keywords; this will invoke strip_values() first and   template<typename TYPE> bool _get_keyval_scalar_(std::string const &conf,
   /// then loop over all words                                                    char const *key,
   int check_keywords(std::string &conf, char const *key);                                                    TYPE &value,
                                                     TYPE const &def_value,
                                                     Parse_Mode const parse_mode);
    bool _get_keyval_scalar_string_(std::string const &conf,
                                    char const *key,
                                    std::string &value,
                                    std::string const &def_value,
                                    Parse_Mode const parse_mode);
  
   /// \brief Use this after parsing a config string (note that check_keywords() calls it already)   template<typename TYPE> bool _get_keyval_vector_(std::string const &conf,
   void clear_keyword_registry();                                                    char const *key,
                                                     std::vector<TYPE> &values,
                                                     std::vector<TYPE> const &def_values,
                                                     Parse_Mode const parse_mode);
  
  public:
  
   /// \brief Return a lowercased copy of the string   /// \brief Return a lowercased copy of the string
   static inline std::string to_lower_cppstr(std::string const &in)   static inline std::string to_lower_cppstr(std::string const &in)
Line 183
Line 278
   static std::string const white_space;   static std::string const white_space;
  
   /// \brief Low-level function for parsing configuration strings;   /// \brief Low-level function for parsing configuration strings;
   /// automatically adds the requested keywords to the list of valid   /// automatically adds the requested keyword to the list of valid
   /// ones.  \param conf the content of the configuration file or one   /// ones.  \param conf the content of the configuration file or one
   /// of its blocks \param key the keyword to search in "conf" \param   /// of its blocks \param key the keyword to search within "conf" \param
   /// data (optional) holds the string provided after "key", if any   /// data (optional) holds the string provided after "key", if any
   /// \param save_pos (optional) stores the position of the keyword   /// \param save_pos (optional) stores the position of the keyword
   /// within "conf", useful when doing multiple calls \param   /// within "conf", useful when doing multiple calls
   /// save_delimiters (optional) 
   bool key_lookup(std::string const &conf,   bool key_lookup(std::string const &conf,
                    char const *key,                    char const *key,
                    std::string &data = dummy_string,                    std::string &data = dummy_string,


Legend:
Removed in v.1.8 
changed lines
 Added in v.1.9



Made by using version 1.53 of cvs2html