]> git.tdb.fi Git - libs/datafile.git/blobdiff - source/binaryparser.cpp
Use C++11 features to manipulate containers
[libs/datafile.git] / source / binaryparser.cpp
index e2ced82098e7b1472944dd4a2b626bef32211459..e4282aea8f64ae3cf23eec698f885ab2bcd823b6 100644 (file)
@@ -5,6 +5,7 @@
 #include "argumentstore.h"
 #include "binaryparser.h"
 #include "binfloat.h"
+#include "except.h"
 #include "input.h"
 #include "loaderaction.h"
 
@@ -13,27 +14,6 @@ using namespace std;
 namespace Msp {
 namespace DataFile {
 
-class bad_definition: public runtime_error
-{
-public:
-       bad_definition(const std::string &w):
-               runtime_error(w)
-       { }
-
-       virtual ~bad_definition() throw() { }
-};
-
-class nesting_error: public logic_error
-{
-public:
-       nesting_error(const std::string &w):
-               logic_error(w)
-       { }
-
-       virtual ~nesting_error() throw() { }
-};
-
-
 BinaryParser::BinaryParser(Input &i, const string &s):
        ParserMode(i, s),
        float_precision(32),
@@ -111,8 +91,8 @@ void BinaryParser::process_control_statement(const Statement &st)
 
                const string &kw = st.args[1].get<const string &>();
                const string &args = st.args[2].get<const string &>();
-               for(string::const_iterator i=args.begin(); i!=args.end(); ++i)
-                       for(unsigned j=0; valid_signatures[j]!=*i; ++j)
+               for(char c: args)
+                       for(unsigned j=0; valid_signatures[j]!=c; ++j)
                                if(!valid_signatures[j])
                                        throw bad_definition("__kwd");