]> git.tdb.fi Git - libs/datafile.git/commitdiff
Consider full statement signature when dealing with auxiliary loaders
authorMikko Rasa <tdb@tdb.fi>
Sun, 16 Jun 2013 08:25:58 +0000 (11:25 +0300)
committerMikko Rasa <tdb@tdb.fi>
Sun, 16 Jun 2013 08:25:58 +0000 (11:25 +0300)
source/loader.cpp
source/loader.h

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
index 3ab6d28fcfd194b2029588a03383ddf53adc7194..dcbbd5dcda202bcd1e1af4f6da7c9f52df2a0f20 100644 (file)
@@ -136,7 +136,7 @@ protected:
        void add_auxiliary_loader(Loader &);
 
 private:
-       bool has_keyword(const std::string &) const;
+       bool has_action(const ActionKey &) const;
        LoaderAction *find_action(const ActionKey &) const;
 
 protected: