]> git.tdb.fi Git - libs/core.git/blobdiff - source/strings/utils.cpp
Exception changes in strings/utils.cpp
[libs/core.git] / source / strings / utils.cpp
index 5728332d595c1bba62d126f9ddbee776c6164004..fff6cdb290362cb724b96b61c29f68c5970dfe0c 100644 (file)
@@ -1,13 +1,6 @@
-/* $Id$
-
-This file is part of libmspstrings
-Copyright © 2006-2008 Mikko Rasa
-Distributed under the LGPL
-*/
-
 #include <algorithm>
 #include <list>
-#include <msp/core/except.h>
+#include <stdexcept>
 #include "utils.h"
 
 using namespace std;
@@ -155,7 +148,7 @@ string c_unescape(const std::string &str)
                        else if(*i>='A' && *i<='F')
                                digit = *i-'A'+10;
                        else
-                               throw InvalidParameterValue("Invalid hexadecimal digit");
+                               throw invalid_argument("c_unescape");
 
                        numeric_value = (numeric_value<<4 | digit);
                        ++numeric_pos;
@@ -171,7 +164,7 @@ string c_unescape(const std::string &str)
                        if(*i>='0' && *i<='7')
                                digit = *i-'0';
                        else
-                               throw InvalidParameterValue("Invalid octal digit");
+                               throw invalid_argument("c_unescape");
 
                        numeric_value = (numeric_value<<3 | digit);
                        ++numeric_pos;
@@ -216,7 +209,7 @@ string c_unescape(const std::string &str)
                        else if(*i=='\\')
                                result += '\\';
                        else
-                               throw InvalidParameterValue("Invalid escape sequence");
+                               throw invalid_argument("c_unescape");
 
                        escape = false;
                }
@@ -227,7 +220,7 @@ string c_unescape(const std::string &str)
        }
 
        if(escape)      
-               throw InvalidParameterValue("Stray backslash at end of string");
+               throw invalid_argument("c_unescape");
 
        return result;
 }