]> git.tdb.fi Git - libs/datafile.git/commitdiff
Replace local RAII set utility with one from mspcore
authorMikko Rasa <tdb@tdb.fi>
Sat, 3 Aug 2013 12:24:01 +0000 (15:24 +0300)
committerMikko Rasa <tdb@tdb.fi>
Mon, 5 Aug 2013 11:57:46 +0000 (14:57 +0300)
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"
 #include <msp/strings/format.h>
 #include "dataerror.h"
 #include "loader.h"
@@ -7,16 +8,6 @@ using namespace std;
 
 namespace {
 
 
 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)
 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)
 {
 
 void Loader::load_statement(const Statement &st)
 {
-       Set<const Statement *> set_cst(cur_st, &st);
+       SetForScope<const Statement *> set_cst(cur_st, &st);
 
        try
        {
 
        try
        {