Program: bbtk
Module: $RCSfile: bbtkUtilities.h,v $
Language: C++
- Date: $Date: 2008/01/29 14:01:31 $
- Version: $Revision: 1.8 $
+ Date: $Date: 2008/03/10 06:24:13 $
+ Version: $Revision: 1.13 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See doc/license.txt or
#include <sys/types.h>
#endif
+#include <cctype> // std::toupper
//#include "bbtkMessageManager.h"
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){
// WIN 32 mechanism
// shared lib name = <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());
}
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);
+ }
+
+ }
+ //=======================================================================
+
// ===================================================================================
//========================================================================
static inline void replace( std::string& str,
- const std::string& from,
- const std::string& to )
+ const std::string& what,
+ const std::string& with )
{
- using std::string;
- string::size_type pos = str.find( from );
- while ( pos != string::npos )
+ std::string::size_type pos = str.find( what );
+ while ( pos != std::string::npos )
{
- str.replace( pos, from.size(), to );
- pos = str.find( from, pos+from.size()-1 );
+ str.replace( pos, what.size(), with );
+ pos = str.find( what, pos+what.size()-1 );
}
}
//========================================================================
replace( str, "<", "<" );
replace( str, ">", ">" );
}
+
+
+ //========================================================================
+ // Usefull functions OPTIONS string
//========================================================================
+
+ static bool loosematch(std::string stdLine,std::string stdOptions);
+
+
+
+
};
+
} // namespace bbtk
#endif //#ifndef __bbtkUtilities_h_INCLUDED__