1 /* === S Y N F I G ========================================================= */
2 /*! \file valuelink.cpp
3 ** \brief ValueBase Link Implementation File
5 ** $Id: valuelink.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
8 ** Copyright (c) 2004 Adrian Bentley
10 ** This software and associated documentation
11 ** are CONFIDENTIAL and PROPRIETARY property of
12 ** the above-mentioned copyright holder.
14 ** You may not copy, print, publish, or in any
15 ** other way distribute this software without
16 ** a prior written agreement with
17 ** the copyright holder.
20 /* ========================================================================= */
22 /* === H E A D E R S ======================================================= */
31 #include "valuelink.h"
35 /* === U S I N G =========================================================== */
39 using namespace synfig;
41 using studio::ValueBaseLink;
43 /* === M A C R O S ========================================================= */
45 /* === G L O B A L S ======================================================= */
47 /* === P R O C E D U R E S ================================================= */
49 /* === M E T H O D S ======================================================= */
51 /* === E N T R Y P O I N T ================================================= */
54 ValueBaseLink::ValueBaseLink()
58 ValueBaseLink::~ValueBaseLink()
64 ValueNode::LooseHandle ValueBaseLink::get_link_vfunc(int i)const
66 /*list_type::const_iterator it = list.begin();
68 while(it != list.end() && i-- > 0)
75 return ValueNode::LooseHandle();
80 if(i >= 0 && i < (int)list.size())
85 return ValueNode::LooseHandle();
90 int ValueBaseLink::link_count()const
95 String ValueBaseLink::link_local_name(int i)const
97 ValueNode::LooseHandle h = get_link(i);
101 return h->get_local_name();
102 }else return String();
105 String ValueBaseLink::link_name(int i)const
107 ValueNode::LooseHandle h = get_link(i);
111 return h->get_name();
112 }else return String();
115 int ValueBaseLink::get_link_index_from_name(const String &name)const
117 throw Exception::BadLinkName(name);
120 //list management stuff
121 ValueBaseLink::list_type::const_iterator ValueBaseLink::findlink(ValueNode::Handle x) const
123 for(list_type::const_iterator i = list.begin(); i != list.end(); ++i)
133 ValueBaseLink::list_type::iterator ValueBaseLink::findlink(ValueNode::Handle x)
135 for(list_type::iterator i = list.begin(); i != list.end(); ++i)
146 void ValueBaseLink::add(ValueNode::Handle v)
148 list_type::iterator i = findlink(v);
156 void ValueBaseLink::remove(ValueNode::Handle v)
158 list_type::iterator i = findlink(v);
162 if(i != list.end()-1)