]> git.tdb.fi Git - libs/datafile.git/blobdiff - source/loader.cpp
Consider full statement signature when dealing with auxiliary loaders
[libs/datafile.git] / source / loader.cpp
index 2cd27e92ac4426f9c0ff04f2c07db411938b103e..bffa9fd31c6ccf5018535139aa119f859d3c36b0 100644 (file)
@@ -113,14 +113,16 @@ void Loader::load_statement(const Statement &st)
 
        try
        {
-               if(!aux_loaders.empty() && !has_keyword(st.keyword))
+               ActionKey key(st.keyword, st.get_signature());
+
+               if(!aux_loaders.empty() && !has_action(key))
                {
                        for(list<Loader *>::const_iterator i=aux_loaders.begin(); i!=aux_loaders.end(); ++i)
-                               if((*i)->has_keyword(st.keyword))
+                               if((*i)->has_action(key))
                                        return (*i)->load_statement(st);
                }
 
-               LoaderAction *act = find_action(ActionKey(st.keyword, st.get_signature()));
+               LoaderAction *act = find_action(key);
                if(act)
                {
                        sub_loaded = false;
@@ -166,10 +168,13 @@ void Loader::add_auxiliary_loader(Loader &ldr)
        aux_loaders.push_back(&ldr);
 }
 
-bool Loader::has_keyword(const string &kwd) const
+bool Loader::has_action(const ActionKey &key) const
 {
-       ActionMap::const_iterator i = actions.lower_bound(ActionKey(kwd, string()));
-       return i!=actions.end() && i->first.keyword==kwd;
+       ActionMap::const_iterator i = actions.lower_bound(ActionKey(key.keyword, string()));
+       for(; (i!=actions.end() && i->first.keyword==key.keyword); ++i)
+               if(signature_match(key.signature, i->first.signature))
+                       return true;
+       return false;
 }
 
 LoaderAction *Loader::find_action(const ActionKey &key) const