40 bool match(
const Properties&,
const Ex::iterator&,
bool ignore_parent_rel=
false)
const;
50 typedef std::pair<std::string, Ex::iterator>
kvpair_t;
134 virtual void latex(std::ostream&)
const;
136 virtual std::string
name()
const=0;
182 virtual std::string
name()
const {
return std::string(
"Stay Away"); };
190 virtual std::string
name()
const {
return std::string(
"PropertyInherit"); };
211 typedef internal_property_map_t::iterator
iterator;
231 typedef std::multimap<nset_t::iterator, pat_prop_pair_t, nset_it_less>
property_map_t;
249 template<
class T>
const T*
get(Ex::iterator,
bool ignore_parent_rel=
false)
const;
250 template<
class T>
const T*
get()
const;
251 template<
class T>
const T*
get_composite(Ex::iterator,
bool ignore_parent_rel=
false)
const;
252 template<
class T>
const T*
get_composite(Ex::iterator,
int& serialnum,
bool doserial=
true,
bool ignore_parent_rel=
false)
const;
254 template<
class T>
const T*
get_composite(Ex::iterator,
const std::string& label)
const;
255 template<
class T>
const T*
get_composite(Ex::iterator,
int& serialnum,
const std::string& label,
bool doserial=
true)
const;
257 template<
class T>
const T*
get_composite(Ex::iterator, Ex::iterator,
bool ignore_parent_rel=
false)
const;
258 template<
class T>
const T*
get_composite(Ex::iterator, Ex::iterator,
int&,
int&,
bool ignore_parent_rel=
false)
const;
262 template<
class T> Ex::iterator
head(Ex::iterator,
bool ignore_parent_rel=
false)
const;
287 return get_composite<T>(it, ignore_parent_rel);
294 return get_composite<T>(it, tmp,
false, ignore_parent_rel);
305 std::pair<property_map_t::const_iterator, property_map_t::const_iterator> pit=
props.equal_range(it->name_only());
310 bool wildcards=
false;
312 property_map_t::const_iterator walk=pit.first;
313 while(walk!=pit.second) {
314 if(wildcards==(*walk).second.first->children_wildcard()) {
316 ret=
dynamic_cast<const T *
>((*walk).second.second);
318 if((*walk).second.first->match(*
this, it, ignore_parent_rel)) {
320 std::pair<pattern_map_t::const_iterator, pattern_map_t::const_iterator>
321 pm=
pats.equal_range((*walk).second.second);
323 while(pm.first!=pm.second) {
324 if((*pm.first).second==(*walk).second.first)
334 if(dynamic_cast<const PropertyInherit *>((*walk).second.second))
336 else if(
dynamic_cast<const Inherit<T> *
>((*walk).second.second))
341 if(!wildcards && !ret) {
352 if(!ret && inherits) {
354 Ex::sibling_iterator sib=it.begin();
355 while(sib!=it.end()) {
356 const T* tmp=get_composite<T>((Ex::iterator)(sib), serialnum, doserial);
373 return get_composite<T>(it, tmp, label,
false);
381 std::pair<property_map_t::const_iterator, property_map_t::const_iterator> pit=
props.equal_range(it->name);
386 bool wildcards=
false;
388 property_map_t::const_iterator walk=pit.first;
389 while(walk!=pit.second) {
390 if(wildcards==(*walk).second.first->children_wildcard()) {
391 if((*walk).second.first->match(*
this, it)) {
392 ret=
dynamic_cast<const T *
>((*walk).second.second);
395 if(ret->label!=label && ret->label!=
"all")
399 serialnum=
serial_number( (*walk).second.second, (*walk).second.first );
403 if(dynamic_cast<const PropertyInherit *>((*walk).second.second))
405 else if(
dynamic_cast<const Inherit<T> *
>((*walk).second.second))
411 if(!wildcards) wildcards=
true;
416 if(!ret && inherits) {
417 Ex::sibling_iterator sib=it.begin();
418 while(sib!=it.end()) {
419 const T* tmp=get_composite<T>((Ex::iterator)(sib), serialnum, label, doserial);
434 return get_composite<T>(it1,it2,tmp1,tmp2, ignore_parent_rel);
444 bool inherits1=
false, inherits2=
false;
445 std::pair<property_map_t::const_iterator, property_map_t::const_iterator> pit1=
props.equal_range(it1->name);
446 std::pair<property_map_t::const_iterator, property_map_t::const_iterator> pit2=
props.equal_range(it2->name);
448 property_map_t::const_iterator walk1=pit1.first;
449 while(walk1!=pit1.second) {
450 if((*walk1).second.first->match(*
this, it1, ignore_parent_rel)) {
451 ret1=
dynamic_cast<const T *
>((*walk1).second.second);
453 property_map_t::const_iterator walk2=pit2.first;
454 while(walk2!=pit2.second) {
455 if((*walk2).second.first->match(*
this, it2, ignore_parent_rel)) {
456 ret2=
dynamic_cast<const T *
>((*walk2).second.second);
458 if(ret1==ret2 && walk1!=walk2) {
459 serialnum1=
serial_number( (*walk1).second.second, (*walk1).second.first );
460 serialnum2=
serial_number( (*walk2).second.second, (*walk2).second.first );
466 if(dynamic_cast<const PropertyInherit *>((*walk2).second.second))
471 if(dynamic_cast<const PropertyInherit *>((*walk1).second.second))
478 if(!found && (inherits1 || inherits2)) {
479 Ex::sibling_iterator sib1, sib2;
480 if(inherits1) sib1=it1.begin();
482 bool keepgoing1=
true;
484 bool keepgoing2=
true;
485 if(inherits2) sib2=it2.begin();
488 const T* tmp=get_composite<T>((Ex::iterator)(sib1), (Ex::iterator)(sib2), serialnum1, serialnum2, ignore_parent_rel);
494 if(!inherits2 || ++sib2==it2.end())
497 if(!inherits1 || ++sib1==it1.end())
512 nset_t::iterator nit=
name_set.insert(std::string(
"")).first;
513 std::pair<property_map_t::const_iterator, property_map_t::const_iterator> pit=
514 props.equal_range(nit);
515 while(pit.first!=pit.second) {
516 ret=
dynamic_cast<const T *
>((*pit.first).second.second);
528 if(get<PropertyInherit>(dn, ignore_parent_rel)) {
const_iterator find(const std::string &) const
Definition: Props.cc:170
bool hidden_
Definition: Props.hh:156
void register_property(property *(*)(), const std::string &name)
Registering properties.
Definition: Props.cc:165
bool parse_to_keyvals(const Ex &, keyval_t &)
Definition: Props.cc:261
virtual void latex(std::ostream &) const
Display the property on the stream.
Definition: Props.cc:287
match_t
Definition: Props.hh:145
bool has(const property *, Ex::iterator)
Definition: Props.cc:125
Basic storage class for symbolic mathemematical expressions.
Definition: Storage.hh:130
Ex obj
Definition: Props.hh:43
PropertyInherit is like Inherit<T> for all properties.
Definition: Props.hh:188
virtual ~property()
Definition: Props.hh:110
const_iterator begin() const
Definition: Props.cc:192
void insert_prop(const Ex &, const property *)
Definition: Props.cc:331
virtual bool parse(const Kernel &, keyval_t &) override
Definition: Props.cc:302
void erase(iterator)
Definition: Props.cc:207
virtual std::string name() const
Definition: Props.hh:182
virtual std::string unnamed_argument() const
Definition: Props.cc:292
Ex::iterator head(Ex::iterator, bool ignore_parent_rel=false) const
Definition: Props.hh:524
bool hidden(void) const
Definition: Props.cc:223
std::pair< pattern *, const property * > pat_prop_pair_t
Definition: Props.hh:222
void insert_list_prop(const std::vector< Ex > &, const list_property *)
Definition: Props.cc:417
void clear()
Definition: Props.cc:141
virtual void validate(const Kernel &, const Ex &) const
Definition: Props.cc:237
const T * get() const
Definition: Props.hh:508
std::string label
Definition: Props.hh:162
kvlist_t keyvals
Definition: Props.hh:65
Arguments to properties get parsed into a keyval_t structure.
Definition: Props.hh:48
bool parse_one_argument(Ex::iterator arg, keyval_t &keyvals)
Definition: Props.cc:241
pattern_map_t pats
Definition: Props.hh:246
virtual match_t equals(const property *) const
Definition: Props.cc:297
registered_property_map_t registered_properties
Definition: Props.hh:221
bool children_wildcard() const
Definition: Props.cc:117
const_iterator end() const
Definition: Props.cc:197
Base class for all properties, handling argument parsing and defining the interface.
Definition: Props.hh:107
kvlist_t::iterator iterator
Definition: Props.hh:54
int serial_number(const property *, const pattern *) const
Definition: Props.cc:512
std::multimap< const property *, pattern * > pattern_map_t
Definition: Props.hh:232
virtual std::string name() const
Definition: Props.hh:190
std::multimap< nset_t::iterator, pat_prop_pair_t, nset_it_less > property_map_t
We keep two multi-maps: one from the pattern to the property (roughly) and one from the property to t...
Definition: Props.hh:231
~registered_property_map_t()
Definition: Props.cc:160
void push_back(const kvpair_t &)
Definition: Props.cc:202
property_map_t props
The following two maps own the pointers to the properties and patterns stored in them; use clear() to...
Definition: Props.hh:245
const T * get_composite(Ex::iterator, bool ignore_parent_rel=false) const
Definition: Props.hh:291
pattern()
Definition: Props.cc:32
std::map< std::string, property *(*)()> internal_property_map_t
Definition: Props.hh:210
Something cannot be both a list property and a normal property at the same time, so we can safely inh...
Definition: Props.hh:168
nset_t name_set
Definition: Storage.cc:31
virtual std::string name() const =0
internal_property_map_t store
Definition: Props.hh:213
kvpair_t value_type
Definition: Props.hh:55
If a property X derives from Inherit<Y>, and get<Y> is called on an object which has an X property (b...
Definition: Props.hh:179
kvlist_t::const_iterator const_iterator
Definition: Props.hh:53
virtual ~Inherit()
Definition: Props.hh:181
std::list< kvpair_t > kvlist_t
Definition: Props.hh:51
std::string master_insert(Ex proptree, property *thepropbase)
Register a property for the indicated Ex.
Definition: Props.cc:562
internal_property_map_t::iterator iterator
Definition: Props.hh:211
Class holding a collection of properties attached to expressions.
Definition: Props.hh:203
property(bool hidden=false)
Definition: Props.cc:213
virtual bool parse(const Kernel &, keyval_t &keyvals)
Definition: Props.cc:228
ProgressMonitor * pm
Definition: PythonCdb.cc:965
bool match(const Properties &, const Ex::iterator &, bool ignore_parent_rel=false) const
Definition: Props.cc:41
std::pair< std::string, Ex::iterator > kvpair_t
Definition: Props.hh:50