Module: sems
Branch: master
Commit: e7238151988b53da00cc276f3f85b679a45465db
URL:    
http://git.sip-router.org/cgi-bin/gitweb.cgi/sems/?a=commit;h=e7238151988b53da00cc276f3f85b679a45465db

Author: Stefan Sayer <[email protected]>
Committer: Stefan Sayer <[email protected]>
Date:   Fri Mar  4 16:16:13 2011 +0100

moved trim() to AmUtils

---

 apps/dsm/DSMModule.cpp |    8 --------
 apps/dsm/DSMModule.h   |    3 ---
 core/AmUtils.h         |    8 ++++++++
 3 files changed, 8 insertions(+), 11 deletions(-)

diff --git a/apps/dsm/DSMModule.cpp b/apps/dsm/DSMModule.cpp
index 5a900ac..016e6e3 100644
--- a/apps/dsm/DSMModule.cpp
+++ b/apps/dsm/DSMModule.cpp
@@ -44,14 +44,6 @@ SCStrArgAction::SCStrArgAction(const string& m_arg) {
     arg = trim(arg, "'");
 }
 
-string trim(string const& str,char const* sepSet)
-{
-  string::size_type const first = str.find_first_not_of(sepSet);
-  return ( first==string::npos )
-    ? std::string()  : 
-    str.substr(first, str.find_last_not_of(sepSet)-first+1);
-}
-
 bool isNumber(const std::string& s) {
   if (s.empty())
     return false;
diff --git a/apps/dsm/DSMModule.h b/apps/dsm/DSMModule.h
index 941d843..7f7f8e8 100644
--- a/apps/dsm/DSMModule.h
+++ b/apps/dsm/DSMModule.h
@@ -81,9 +81,6 @@ typedef void* (*SCFactoryCreate)();
 #define SC_EXPORT(class_name)                  \
   EXPORT_SC_FACTORY(SC_FACTORY_EXPORT,class_name)
 
-
-string trim(string const& str,char const* sepSet);
-
 class SCStrArgAction   
 : public DSMAction {
  protected:
diff --git a/core/AmUtils.h b/core/AmUtils.h
index bbcfa71..75be38e 100644
--- a/core/AmUtils.h
+++ b/core/AmUtils.h
@@ -242,6 +242,14 @@ unsigned int get_random();
 /** Explode string by a separator to a vector */
 std::vector<string> explode(const string& s, const string& delim, const bool 
keep_empty = false);
 
+/** remove chars in sepSet from beginning and end of str */
+inline std::string trim(std::string const& str,char const* sepSet)
+{
+  std::string::size_type const first = str.find_first_not_of(sepSet);
+  return ( first==std::string::npos ) ?
+    std::string() : str.substr(first, str.find_last_not_of(sepSet)-first+1);
+}
+
 /** add a directory to an environement variable */
 void add_env_path(const char* name, const string& path);
 

_______________________________________________
Semsdev mailing list
[email protected]
http://lists.iptel.org/mailman/listinfo/semsdev

Reply via email to