summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-12-22 20:45:38 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-12-22 20:45:38 +0000
commit79939d71bac1fdf6241decb77180dc12710af0d2 (patch)
treeae0ffab07c96070df2fe35fafaf955b74fb683d0
parentb3a11cb400fd02383c4b3eac67eeb54604d6ad77 (diff)
Add ConvToInt() template to go with ConvToStr() that we've had for a while
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@6064 e03df62e-2008-0410-955e-edbf42e46eb7
-rw-r--r--include/inspircd.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/include/inspircd.h b/include/inspircd.h
index 6c078b1d5..4648eaf69 100644
--- a/include/inspircd.h
+++ b/include/inspircd.h
@@ -71,6 +71,13 @@ template<typename T> inline std::string ConvToStr(const T &in)
return tmp.str();
}
+template<typename T> inline long ConvToInt(const T &in)
+{
+ std::stringstream tmp;
+ if (!(tmp << in)) return 0;
+ return atoi(tmp.str().c_str());
+}
+
/** This class contains various STATS counters
* It is used by the InspIRCd class, which internally
* has an instance of it.