Update of /cvsroot/objecthandler/ObjectHandler/oh
In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv15915/oh
Modified Files:
utilities.cpp utilities.hpp
Log Message:
1) boost::split based implementation for ohSplit
2) uppercase not used anymore (use boost instead)
Index: utilities.cpp
===================================================================
RCS file: /cvsroot/objecthandler/ObjectHandler/oh/utilities.cpp,v
retrieving revision 1.16
retrieving revision 1.17
diff -C2 -d -r1.16 -r1.17
*** utilities.cpp 3 Dec 2006 21:08:46 -0000 1.16
--- utilities.cpp 2 Jan 2007 11:07:43 -0000 1.17
***************
*** 1,4 ****
--- 1,5 ----
/*
+ Copyright (C) 2007 Ferdinando Ametrano
Copyright (C) 2004, 2005, 2006 Eric Ehlers
Copyright (C) 2006 Plamen Neykov
***************
*** 24,46 ****
#include <oh/objecthandler.hpp>
#include <oh/exception.hpp>
#include <sstream>
! #include <boost/regex.hpp>
namespace ObjHandler {
! std::string version() {
return OBJHANDLER_VERSION;
}
! std::string setLogFile(
! const std::string &logFileName,
! const int &logLevel) {
Logger::instance().setLogFile(logFileName, logLevel);
return logFileName;
}
! DLL_API void logMessage(
! const std::string &message,
! const int &level) {
Logger::instance().logMessage(message, level);
}
--- 25,52 ----
#include <oh/objecthandler.hpp>
#include <oh/exception.hpp>
+ #include <boost/algorithm/string/classification.hpp>
+ #include <boost/algorithm/string/split.hpp>
#include <sstream>
!
! using std::string;
! using boost::algorithm::token_compress_off;
! using boost::algorithm::token_compress_on;
! using boost::algorithm::is_any_of;
!
namespace ObjHandler {
! string version() {
return OBJHANDLER_VERSION;
}
! string setLogFile(const string &logFileName,
! const int &logLevel) {
Logger::instance().setLogFile(logFileName, logLevel);
return logFileName;
}
! DLL_API void logMessage(const string &message,
! const int &level) {
Logger::instance().logMessage(message, level);
}
***************
*** 50,60 ****
}
! void setConsole(
! const int &console,
! const int &logLevel) {
Logger::instance().setConsole(console, logLevel);
}
! void logObject(const std::string &objectID) {
std::ostringstream msg;
boost::shared_ptr<Object> object =
--- 56,65 ----
}
! void setConsole(const int &console,
! const int &logLevel) {
Logger::instance().setConsole(console, logLevel);
}
! void logObject(const string &objectID) {
std::ostringstream msg;
boost::shared_ptr<Object> object =
***************
*** 77,100 ****
// parse a whitespace-delimited list of symbols
// into a vector of strings
! std::vector<std::string> split(
! const std::string &line,
! const std::string &delim) {
! std::vector<std::string> ret;
! std::string::const_iterator start = line.begin();
! std::string::const_iterator end = line.end();
! boost::match_results<std::string::const_iterator> m;
! boost::regex r("[^" + delim + "]+");
! while (boost::regex_search(start, end, m, r)) {
! ret.push_back(std::string(m[0].first, m[0].second));
! start = m[0].second;
! }
! return ret;
! }
!
! std::string uppercase(const std::string& s) {
! std::string output = s;
! for (std::string::iterator i=output.begin(); i!=output.end(); i++)
! *i = std::toupper(*i);
! return output;
}
--- 82,91 ----
// parse a whitespace-delimited list of symbols
// into a vector of strings
! std::vector<string> split(const string &line,
! const string &delim,
! bool token_compress) {
! std::vector<string> ret;
! return boost::algorithm::split(ret, line, is_any_of(delim),
! token_compress ? token_compress_on : token_compress_off);
}
Index: utilities.hpp
===================================================================
RCS file: /cvsroot/objecthandler/ObjectHandler/oh/utilities.hpp,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -d -r1.14 -r1.15
*** utilities.hpp 3 Dec 2006 21:08:46 -0000 1.14
--- utilities.hpp 2 Jan 2007 11:07:43 -0000 1.15
***************
*** 30,34 ****
namespace ObjHandler {
! //! Retrieve ObjectHandler version string
std::string version();
--- 30,34 ----
namespace ObjHandler {
! //! Returns ObjectHandler version string
std::string version();
***************
*** 63,69 ****
/*! Fork log messages to stdout.
*/
! void setConsole(
! const int &console = 0,
! const int &logLevel = 4);
//! Write Object with given ID to log file.
--- 63,68 ----
/*! Fork log messages to stdout.
*/
! void setConsole(const int &console = 0,
! const int &logLevel = 4);
//! Write Object with given ID to log file.
***************
*** 81,89 ****
// some basic utilities
! std::vector<std::string> split(
! const std::string &line,
! const std::string &delim);
!
! std::string uppercase(const std::string&);
//@}
--- 80,86 ----
// some basic utilities
! std::vector<std::string> split(const std::string &line,
! const std::string &delim,
! bool token_compress);
//@}
|