]> git.tdb.fi Git - libs/datafile.git/blobdiff - source/loader.cpp
Replace local RAII set utility with one from mspcore
[libs/datafile.git] / source / loader.cpp
index 2c0fbd12275ffdf4e54715a4ca05fc9524ce430d..c2de4011232c93da747bfdead7df18af72c6087d 100644 (file)
@@ -1,3 +1,4 @@
+#include <msp/core/raii.h>
 #include <msp/strings/format.h>
 #include "dataerror.h"
 #include "loader.h"
@@ -7,16 +8,6 @@ using namespace std;
 
 namespace {
 
-template<typename T>
-struct Set
-{
-       T &ref;
-       T orig;
-
-       Set(T &r, const T &v): ref(r), orig(r) { r = v; }
-       ~Set() { ref = orig; }
-};
-
 bool signature_match(char s, char a)
 {
        if(s==a)
@@ -109,7 +100,7 @@ void Loader::load(const Statement &st)
 
 void Loader::load_statement(const Statement &st)
 {
-       Set<const Statement *> set_cst(cur_st, &st);
+       SetForScope<const Statement *> set_cst(cur_st, &st);
 
        try
        {