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/04 13:02:58 $
+ Version: $Revision: 1.10 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See doc/license.txt or
{
pkgname = name;
}
-
+
// remove {.so | dll} if any
std::string::size_type dot_position = pkgname.find_last_of('.');
if (dot_position != std::string::npos){
// 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);
}
right = "";
}
}
+ //=======================================================================
+ static inline void SplitString ( const std::string& str,
+ const std::string& delimiters,
+ std::vector<std::string>& 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);
+ }
+
+ }
+ //=======================================================================
+
// ===================================================================================