X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=kernel%2Fsrc%2FbbtkUtilities.h;h=8711393d233f267a2645ae01051ec1bddf8f92bb;hb=acec0f7b93efd8318c826ff6b006fde051993c5a;hp=e88bfd528a76ffd17a95597f5d3922f1a9a20e1f;hpb=5cb7ce127ae89bdacc5909946c75b9eb092516f9;p=bbtk.git diff --git a/kernel/src/bbtkUtilities.h b/kernel/src/bbtkUtilities.h index e88bfd5..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 12:05:05 $ - Version: $Revision: 1.7 $ + 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){ @@ -179,7 +180,7 @@ namespace bbtk // tooHigh : true is user supplies a library pathname with too many "../" bool tooHigh = false; -//std::cout << "------------------cwd [" << cwd << "]" << std::endl; +//std::cout << "------------------cwd [" << cwd << "] name [" << name << "]" << std::endl; if ( name[0] == '/' || name[1] == ':' ) // Linux or Windows absolute name { @@ -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__