Use LinkableValueNode members functions when possible in the derived valuenodes.
[synfig.git] / synfig-core / src / synfig / valuenode_join.cpp
index eaa8fbc..19b49f7 100644 (file)
@@ -55,6 +55,8 @@ using namespace synfig;
 ValueNode_Join::ValueNode_Join(const ValueBase &value):
        LinkableValueNode(value.get_type())
 {
+       Vocab ret(get_children_vocab());
+       set_children_vocab(ret);
        switch(value.get_type())
        {
        case ValueBase::TYPE_STRING:
@@ -74,8 +76,6 @@ ValueNode_Join::ValueNode_Join(const ValueBase &value):
        default:
                throw Exception::BadType(ValueBase::type_local_name(value.get_type()));
        }
-
-       DCAST_HACK_ENABLE();
 }
 
 LinkableValueNode*
@@ -174,56 +174,40 @@ ValueNode_Join::get_link_vfunc(int i)const
        return 0;
 }
 
-int
-ValueNode_Join::link_count()const
+bool
+ValueNode_Join::check_type(ValueBase::Type type)
 {
-       return 4;
+       return
+               type==ValueBase::TYPE_STRING;
 }
 
-String
-ValueNode_Join::link_name(int i)const
+LinkableValueNode::Vocab
+ValueNode_Join::get_children_vocab_vfunc()const
 {
-       assert(i>=0 && i<link_count());
+       if(children_vocab.size())
+               return children_vocab;
 
-       switch(i)
-       {
-               case 0: return "strings";
-               case 1: return "before";
-               case 2: return "separator";
-               case 3: return "after";
-       }
-       return String();
-}
+       LinkableValueNode::Vocab ret;
 
-String
-ValueNode_Join::link_local_name(int i)const
-{
-       assert(i>=0 && i<link_count());
+       ret.push_back(ParamDesc(ValueBase(),"strings")
+               .set_local_name(_("Strings"))
+               .set_description(_("The List of strings to join"))
+       );
 
-       switch(i)
-       {
-               case 0: return _("Strings");
-               case 1: return _("Before");
-               case 2: return _("Separator");
-               case 3: return _("After");
-       }
-       return String();
-}
+       ret.push_back(ParamDesc(ValueBase(),"before")
+               .set_local_name(_("Before"))
+               .set_description(_("The string to place before the joined strings"))
+       );
 
-int
-ValueNode_Join::get_link_index_from_name(const String &name)const
-{
-       if (name=="strings") return 0;
-       if (name=="before") return 1;
-       if (name=="separator") return 2;
-       if (name=="after") return 3;
+       ret.push_back(ParamDesc(ValueBase(),"separator")
+               .set_local_name(_("Separator"))
+               .set_description(_("The string to place between each string joined"))
+       );
 
-       throw Exception::BadLinkName(name);
-}
+       ret.push_back(ParamDesc(ValueBase(),"after")
+               .set_local_name(_("After"))
+               .set_description(_("The string to place after the joined strings"))
+       );
 
-bool
-ValueNode_Join::check_type(ValueBase::Type type)
-{
-       return
-               type==ValueBase::TYPE_STRING;
+       return ret;
 }