Ignore:
Timestamp:
Aug 7, 2010, 4:31:18 PM (13 years ago)
Author:
Peter Johansson
Message:

allow config file to override svn property (fixes #326). Adding two new files (split.h and split.cc) from yat.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/Configuration.h

    r1144 r1152  
    121121       \return NULL if there is no prop for \a filename in config
    122122     */
    123     const std::map<std::string, std::string>*
     123    const std::map<std::string, std::string>&
    124124    svn_properties(const std::string& filename) const;
    125125
     
    152152    bool equal_false(std::string) const;
    153153    bool equal_true(std::string) const;
     154
     155    /**
     156       find first element in range, [first, last) for which
     157       element->first matches filename.
     158
     159       Iterator->first must return string, i.e., [first, last) is
     160       often a range of pair<string, T>
     161
     162       If no match is found, last is returned.
     163     */
     164    template<typename Iterator>
     165    Iterator find_fn(Iterator first, Iterator last,
     166                     const std::string& filename) const;
     167
    154168    ///
    155169    /// @brief load deafult configuration
     
    190204    std::string trac_root_;
    191205
    192     std::vector<std::map<std::string, std::string> > svn_props_;
     206    typedef std::map<std::string, std::string> str_map;
     207    typedef std::pair<std::string, str_map> props;
     208    std::vector<props> svn_props_;
     209    const str_map empty_str_map_;
    193210  };
    194211
     
    226243  };
    227244
     245  // template implementation
     246
     247  template<typename Iterator>
     248  Iterator Configuration::find_fn(Iterator first, Iterator last,
     249                                  const std::string& filename) const
     250  {
     251    for( ; first!=last; ++first) {
     252      if (fnmatch(first->first.c_str(), filename.c_str()))
     253        return first;
     254    }
     255    return last;
     256  }
     257
     258
    228259}} // end of namespace svndigest and namespace theplu
    229260
Note: See TracChangeset for help on using the changeset viewer.