Changeset 118 for trunk/lib/utility.h


Ignore:
Timestamp:
Jul 3, 2006, 9:44:49 AM (15 years ago)
Author:
Peter Johansson
Message:

fixes #46 #45 #26 #40

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/utility.h

    r115 r118  
    6161
    6262  ///
     63  /// stupid function needed for systems calls to be correct for
     64  /// filenames containing spaces.
     65  /// @note this function will be removed.
     66  ///
     67  /// @return passed string with ' ' changed to '\ '
     68  ///
     69  std::string mod_str(const std::string&);
     70
     71  ///
    6372  /// @return the current working directory.
    6473  ///
     
    6978  ///
    7079  void print_css(std::ostream& s);
     80
     81  inline bool match_begin(std::string::iterator first,
     82                          std::string::iterator last,
     83                          const std::string& str)
     84  { return (std::distance(first, last)>=static_cast<int>(str.size()) &&
     85            std::equal(str.begin(), str.end(), first));
     86  }
     87
     88  inline bool match_end(std::string::iterator first,
     89                        std::string::iterator last,
     90                        const std::string& str)
     91  { return (std::distance(first,last)>=static_cast<int>(str.size()) &&
     92            std::equal(str.rbegin(), str.rend(), first));
     93  }
     94
     95  inline std::string::iterator search(std::string::iterator& first,
     96                                      std::string::iterator& last,
     97                                      const std::string& str)
     98  { return std::search(first, last, str.begin(), str.end()); }
    7199
    72100  ///
Note: See TracChangeset for help on using the changeset viewer.