Home
Install
Use
Develop
Support
News
Credits
hosted by
|
12 #ifndef __TextInterfaceTo_h
13 #define __TextInterfaceTo_h
15 #include "TextInterfaceAttribute.h"
16 #include "TextInterfaceFunction.h"
17 #include "TextInterfaceElement.h"
18 #include "TextInterfaceProxy.h"
19 #include "TextInterfaceEmbed.h"
21 namespace TextInterface
25 class To : public Parser {
29 template< class Type> class Generator : public Allocator<C,Type> { };
31 template< class Type> class VGenerator : public VAllocator<C,Type> { };
37 for ( unsigned i=0; i< values.size(); i++)
42 void setup ( const Value* value)
45 std::cerr << "TextInterface::To<C>::setup"
46 " name=" << value->get_name() <<
47 " instance=" << ( void*) instance. ptr() << std::endl;
54 std::cerr << "TextInterface::To<C>::setup " << value->get_name() <<
55 " is not an Attribute<C>" << std::endl;
69 void import ( const To<P>* parent)
71 for ( unsigned i=0; i < parent->size(); i++)
73 add_value( new IsAProxy<C,P>(parent->get(i)) );
79 template< class M, class G>
80 void import ( const std::string& name, const To<M>* member, G get)
82 for ( unsigned i=0; i < member->size(); i++)
92 template< class E, class G, class S>
93 void import ( const std::string& name, const To<E>* member, G g, S s)
95 for ( unsigned i=0; i < member->size(); i++)
102 std::cerr << "TextInterface::import name="
115 template< class K, class E, class G>
116 void import ( const std::string& name, K, const To<E>* member, G g)
118 for ( unsigned i=0; i < member->size(); i++)
120 add_value( new MapOfProxy<C,K,E,G>(name, member->get(i), g) );
125 void import ( const To<P>& parent)
126 { import (&parent); }
129 template< class M, class G>
130 void import ( const std::string& name, const To<M>& member, G get )
131 { import (name, &member, get); }
134 template< class M, class G>
136 { import (std::string(), &member, get); }
138 template< class E, class G, class S>
139 void import ( const std::string& name, const To<E>& element, G g, S size)
140 { import (name, &element, g, size); }
142 template< class K, class E, class G>
143 void import ( const std::string& name, K k, const To<E>& element, G g)
144 { import (name, k, &element, g); }
147 unsigned size () const { return values.size(); }
156 template< class P, typename T>
158 const char* name, const char* description = 0)
168 template< class P, typename T, typename U>
169 void add (T(P::* get)() const, void(P::*set)( const U&),
170 const char* name, const char* description = 0)
180 template< class P, typename T, typename U>
181 void add (T(P::* get)() const, void(P::*set)(U),
182 const char* name, const char* description = 0)
185 Attribute<C>* getset = gen (name, get, set);
187 getset->set_description (description);
192 template< class P, typename T, typename U>
193 void add (T(P::* get)() const, void(P::*set)( const U&),
194 Parser*(P::*get_parser)(),
195 const char* name, const char* description = 0)
197 EmbedAllocator<C,U> gen;
198 Attribute<C>* getset = gen.direct (name, get, set, get_parser);
200 getset->set_description (description);
205 template< class P, typename T, typename U>
206 void add (T(P::* get)() const, void(P::*set)(U),
207 Parser*(P::*get_parser)(),
208 const char* name, const char* description = 0)
210 EmbedAllocator<C,U> gen;
218 template< class P, typename U, typename Parent>
219 void add (U*(P::* get)() const, void(P::*set)(U*),
220 Parser*(Parent::*get_parser)(),
221 const char* name, const char* description = 0)
223 EmbedAllocator<C,U*> gen;
231 template< class Get, class Set, class Parser>
233 const char* name, const char* description = 0)
235 EmbedAllocator<C,typename Set::second_argument_type> gen;
244 void add (Get get, const char* name, const char* description = 0)
253 template< class Get, class Set>
254 void add (Get get, Set set, const char* name, const char* description = 0)
void add(T(P::*get)() const, const char *name, const char *description=0) Factory generates a new AttributeGet instance. Definition: TextInterfaceTo.h:167
ElementGet and ElementGetSet factory. Definition: TextInterfaceElement.h:130
Proxy enables attribute interface of member to be used by class. Definition: TextInterfaceProxy.h:61
Reference::To< C, false > instance Pointer to the instance from which attribute value will be obtained. Definition: TextInterfaceAttribute.h:65
virtual std::string get_name() const =0 Get the name of the value.
Proxy enables attribute interface of elements in a vector. Definition: TextInterfaceProxy.h:114
virtual void set_description(const std::string &)=0 Set the description of the value.
std::vector< Reference::To< Value > > values The vector of values. Definition: TextInterfaceParser.h:156
An array of Value interfaces. Definition: TextInterfaceParser.h:35
virtual void set_instance(C *c) Set the instance. Definition: TextInterfaceTo.h:44
bool found(const std::string &name) const Return true if the named value is found. Definition: TextInterfaceParser.C:287
Get is function object that receives C* and returns some type. Definition: TextInterfaceFunction.h:28
void setup(const Value *value) Set the instance of the Attribute<C> Definition: TextInterfaceTo.h:52
void add(Get get, const char *name, const char *description=0) Add adaptable unary function object template. Definition: TextInterfaceTo.h:254
Parser() Default constructor. Definition: TextInterfaceParser.C:202
const Type * ptr() const Return pointer without testing for validity. Definition: ReferenceTo.h:234
const Attribute< C > * get(unsigned i) const Provide access to the attributes. Definition: TextInterfaceTo.h:160
Interface to a class attribute with an accessor and modifier methods. Definition: TextInterfaceFunction.h:97
void add_value(Value *value) Add a new value interface. Definition: TextInterfaceParser.C:167
Text interface to a class attribute. Definition: TextInterfaceAttribute.h:27
unsigned size() const Return the number of attributes. Definition: TextInterfaceTo.h:157
Reference::To< C, false > instance The instance of the class with which this interfaces. Definition: TextInterfaceTo.h:273
bool import_filter Filter duplicate value names during import. Definition: TextInterfaceParser.h:138
Class text interface: an instance of C and a vector of Attribute<C> Definition: TextInterfaceTo.h:30
Generated using doxygen 1.8.17
|