Make link_name(), link_local_name, and get_link_index_from_name non pure virtual...
authorCarlos Lopez <genetita@gmail.com>
Mon, 13 Dec 2010 20:11:57 +0000 (21:11 +0100)
committerCarlos Lopez <genetita@gmail.com>
Sun, 2 Jan 2011 07:19:34 +0000 (08:19 +0100)
synfig-core/src/synfig/valuenode.cpp
synfig-core/src/synfig/valuenode.h

index b423afc..a47394e 100644 (file)
@@ -669,3 +669,33 @@ LinkableValueNode::get_description(int index, bool show_exported_name)const
        return description;
 }
 
        return description;
 }
 
+String
+LinkableValueNode::link_name(int i)const
+{
+       Vocab vocab(get_param_vocab());
+       Vocab::iterator iter(vocab.begin());
+       int j=0;
+       for(; iter!=vocab.end(), j<i; iter++, j++);
+       return iter!=vocab.end()?iter->get_name():String();
+}
+
+String
+LinkableValueNode::link_local_name(int i)const
+{
+       Vocab vocab(get_param_vocab());
+       Vocab::iterator iter(vocab.begin());
+       int j=0;
+       for(; iter!=vocab.end(), j<i; iter++, j++);
+       return iter!=vocab.end()?iter->get_local_name():String();
+}
+
+int
+LinkableValueNode::get_link_index_from_name(const String &name)const
+{
+       Vocab vocab(get_param_vocab());
+       Vocab::iterator iter(vocab.begin());
+       int j=0;
+       for(; iter!=vocab.end(); iter++, j++)
+               if(iter->get_name()==name) return j;
+       throw Exception::BadLinkName(name);
+}
index 61b5d6a..8a1552e 100644 (file)
@@ -373,13 +373,13 @@ public:
        virtual int link_count()const=0;
 
        //! Returns the local name of the 'i' linked Value Node
        virtual int link_count()const=0;
 
        //! Returns the local name of the 'i' linked Value Node
-       virtual String link_local_name(int i)const=0;
+       virtual String link_local_name(int i)const;
 
        //! Returns the name of the 'i' linked Value Node
 
        //! Returns the name of the 'i' linked Value Node
-       virtual String link_name(int i)const=0;
+       virtual String link_name(int i)const;
 
        //! Returns the child index Value Node based on the name
 
        //! Returns the child index Value Node based on the name
-       virtual int get_link_index_from_name(const String &name)const=0;
+       virtual int get_link_index_from_name(const String &name)const;
 
        //! Clones a Value Node
        virtual ValueNode* clone(const GUID& deriv_guid=GUID())const;
 
        //! Clones a Value Node
        virtual ValueNode* clone(const GUID& deriv_guid=GUID())const;