add variants of atoi etc. for std::string
authorPaul Davis <paul@linuxaudiosystems.com>
Mon, 8 Feb 2010 19:37:51 +0000 (19:37 +0000)
committerPaul Davis <paul@linuxaudiosystems.com>
Mon, 8 Feb 2010 19:37:51 +0000 (19:37 +0000)
git-svn-id: svn://localhost/ardour2/branches/3.0@6651 d708f5d6-7413-0410-9779-e7cbd77b26cf

libs/pbd/convert.cc
libs/pbd/pbd/convert.h

index 617fbec4736df9ed3f350df0234caf88e7e07184..06105671020a255efd07aedfd6ab837337528653 100644 (file)
@@ -106,6 +106,18 @@ atoi (const string& s)
        return ::atoi (s.c_str());
 }
 
+int32_t
+atol (const string& s)
+{
+       return (int32_t) ::atol (s.c_str());
+}
+
+int64_t
+atoll (const string& s)
+{
+       return (int64_t) ::atoll (s.c_str());
+}
+
 double
 atof (const string& s)
 {
@@ -282,11 +294,14 @@ length2string (const int64_t frames, const double sample_rate)
        
        return duration_str;
 }
+
 static bool 
 chars_equal_ignore_case(char x, char y)
 {
-       static std::locale loc;
-       return toupper(x, loc) == toupper(y, loc);
+       /* app should have called setlocale() if its wants this comparison to be
+          locale sensitive.
+       */
+       return toupper (x) == toupper (y);
 }
 
 bool 
index f8358e88011707da16de209745ab808978630ed8..e6e063bf41d59858423fd40533fd7bfd3b04ced1 100644 (file)
@@ -31,10 +31,12 @@ namespace PBD {
 
 std::string short_version (std::string, std::string::size_type target_length);
 
-int    atoi (const std::string&);
-double atof (const std::string&);
-void   url_decode (std::string&);
-void   url_decode (Glib::ustring&);
+int     atoi (const std::string&);
+int32_t atol (const std::string&);
+int64_t atoll (const std::string&);
+double  atof (const std::string&);
+void    url_decode (std::string&);
+void    url_decode (Glib::ustring&);
 
 // std::string length2string (const int32_t frames, const float sample_rate);
 std::string length2string (const int64_t frames, const double sample_rate);