X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=kernel%2Fsrc%2FbbtkUtilities.h;h=8711393d233f267a2645ae01051ec1bddf8f92bb;hb=6acada1443d66ee0de5825c90b92449a64320870;hp=7895935aaaa530fc382ddf0724d7f91ea2fcfecd;hpb=f507b7d79a0ff0d3b0c09b12b15dd754319f0123;p=bbtk.git diff --git a/kernel/src/bbtkUtilities.h b/kernel/src/bbtkUtilities.h index 7895935..8711393 100644 --- a/kernel/src/bbtkUtilities.h +++ b/kernel/src/bbtkUtilities.h @@ -3,8 +3,8 @@ Program: bbtk Module: $RCSfile: bbtkUtilities.h,v $ Language: C++ - Date: $Date: 2008/01/29 14:01:31 $ - Version: $Revision: 1.8 $ + Date: $Date: 2008/02/08 14:58:31 $ + Version: $Revision: 1.11 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See doc/license.txt or @@ -47,6 +47,7 @@ #include #endif +#include // std::toupper //#include "bbtkMessageManager.h" namespace bbtk @@ -103,7 +104,7 @@ namespace bbtk { pkgname = name; } - + // remove {.so | dll} if any std::string::size_type dot_position = pkgname.find_last_of('.'); if (dot_position != std::string::npos){ @@ -363,6 +364,29 @@ static bool IsDirectory(std::string const &dirName) right = ""; } } + //======================================================================= + static inline void SplitString ( const std::string& str, + const std::string& delimiters, + std::vector& tokens) + { + // Skip delimiters at beginning. + std::string::size_type lastPos = str.find_first_not_of(delimiters, 0); + // Find first delimiter. + std::string::size_type pos = str.find_first_of(delimiters, lastPos); + + while (std::string::npos != pos || std::string::npos != lastPos) + { + // Found a token, add it to the vector. + tokens.push_back(str.substr(lastPos, pos - lastPos)); + // Skip delimiters. Note the "not_of" + lastPos = str.find_first_not_of(delimiters, pos); + // Find next delimiter + pos = str.find_first_of(delimiters, lastPos); + } + + } + //======================================================================= + // =================================================================================== @@ -511,10 +535,21 @@ static int Explore(std::string const &dirpath, bool recursive, std::vector", ">" ); } + + + //======================================================================== + // Usefull functions OPTIONS string //======================================================================== + + static bool loosematch(std::string stdLine,std::string stdOptions); + + + + }; + } // namespace bbtk #endif //#ifndef __bbtkUtilities_h_INCLUDED__