X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=kernel%2Fsrc%2FbbtkUtilities.h;h=bfad45561227dad6df11949bc2577822be9ce438;hb=56e4ad989e702cfecc9166812f8a365aca6a2b31;hp=da5bba8df4ccb44e2e518f5a64980d349d738ee8;hpb=cadbc7f9439327013dfbefa9415ad7c8680fb351;p=bbtk.git diff --git a/kernel/src/bbtkUtilities.h b/kernel/src/bbtkUtilities.h index da5bba8..bfad455 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 10:12:45 $ - Version: $Revision: 1.6 $ + Date: $Date: 2008/02/18 10:41:02 $ + Version: $Revision: 1.12 $ 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){ @@ -127,7 +128,8 @@ namespace bbtk // WIN 32 mechanism // shared lib name = .dll - // remove {bb} if any +// EED Problem loading package call bbtkTools +// // remove {bb} if any if (memcmp (pkgname.c_str(), "bb", 2) == 0) { pkgname = pkgname.substr(2, pkgname.length()); } @@ -179,9 +181,9 @@ 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[0] == '\\' ) + if ( name[0] == '/' || name[1] == ':' ) // Linux or Windows absolute name { return(libname); } @@ -363,6 +365,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 +536,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__