/[svn]/libgig/trunk/src/helper.h
ViewVC logotype

Diff of /libgig/trunk/src/helper.h

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

revision 3483 by schoenebeck, Sat Feb 23 15:40:22 2019 UTC revision 3484 by schoenebeck, Sat Feb 23 16:12:08 2019 UTC
# Line 317  inline void __divide_progress(RIFF::prog Line 317  inline void __divide_progress(RIFF::prog
317      }      }
318  }  }
319    
320    
321    /*****************************************************************************
322     * Any problems with any of the following helper functions?                  *
323     *                                                                           *
324     * Then please first have a look at their current TEST CASES at              *
325     * src/testcases/HelperTest.cpp as basis for your modifications!             *
326     *****************************************************************************/
327    
328    
329  /// Removes one or more consecutive occurences of @a needle from the end of @a haystack.  /// Removes one or more consecutive occurences of @a needle from the end of @a haystack.
330  inline std::string strip2ndFromEndOf1st(const std::string haystack, char needle) {  inline std::string strip2ndFromEndOf1st(const std::string haystack, char needle) {
331      if (haystack.empty()) return haystack;      if (haystack.empty()) return haystack;
# Line 342  inline std::string strip2ndFromEndOf1st( Line 351  inline std::string strip2ndFromEndOf1st(
351  inline std::string parentPath(const std::string path) {  inline std::string parentPath(const std::string path) {
352      if (path.empty()) return path;      if (path.empty()) return path;
353      std::string s = strip2ndFromEndOf1st(path, NATIVE_PATH_SEPARATOR);      std::string s = strip2ndFromEndOf1st(path, NATIVE_PATH_SEPARATOR);
     printf("\tstrip('%s')  =>  '%s'\n", path.c_str(), s.c_str());  
354      if (s.empty()) {      if (s.empty()) {
355          s.push_back(NATIVE_PATH_SEPARATOR); // i.e. return "/"          s.push_back(NATIVE_PATH_SEPARATOR); // i.e. return "/"
356          return s;          return s;

Legend:
Removed from v.3483  
changed lines
  Added in v.3484

  ViewVC Help
Powered by ViewVC