[2] | 1 | //----------------------------------------------------------- |
---|
| 2 | // Copyright Christian Arnault LAL-Orsay CNRS |
---|
| 3 | // arnault@lal.in2p3.fr |
---|
[663] | 4 | // Modified by Grigory Rybkin |
---|
[2] | 5 | // See the complete license in cmt_license.txt "http://www.cecill.info". |
---|
| 6 | //----------------------------------------------------------- |
---|
| 7 | |
---|
| 8 | #ifndef __cmt_tag_h__ |
---|
| 9 | #define __cmt_tag_h__ |
---|
| 10 | |
---|
| 11 | #include "cmt_parser.h" |
---|
| 12 | #include "cmt_system.h" |
---|
| 13 | #include "cmt_use.h" |
---|
| 14 | #include "cmt_map.h" |
---|
| 15 | |
---|
| 16 | class Tag |
---|
| 17 | { |
---|
| 18 | public: |
---|
| 19 | typedef cmt_map<cmt_string, Tag> TagMap; |
---|
| 20 | typedef cmt_vector<Tag> TagVector; |
---|
| 21 | typedef cmt_vector<Tag*> TagPtrVector; |
---|
| 22 | |
---|
[662] | 23 | typedef cmt_vmap<const Tag*, Use::UsePtrVector> TagUses; |
---|
| 24 | |
---|
[2] | 25 | static void action (const CmtSystem::cmt_string_vector& words, Use* use); |
---|
| 26 | static void action_apply (const CmtSystem::cmt_string_vector& words, Use* use); |
---|
| 27 | static void action_exclude (const CmtSystem::cmt_string_vector& words, Use* use); |
---|
| 28 | static Tag* find (const cmt_string& name, TagMap& instances); |
---|
| 29 | static Tag* find (const cmt_string& name); |
---|
| 30 | static Tag* add (const cmt_string& name, int priority, |
---|
| 31 | const cmt_string& context, Use* use = 0); |
---|
| 32 | static int tag_number (); |
---|
| 33 | static Tag* tag (int index); |
---|
| 34 | static void unmark_all (); |
---|
| 35 | static void restore_tree (); |
---|
| 36 | static void clear_all (); |
---|
| 37 | |
---|
| 38 | static TagMap& tag_map (); |
---|
| 39 | static TagVector& all_tags (); |
---|
| 40 | static TagPtrVector& tags (); |
---|
| 41 | |
---|
| 42 | static Tag* get_default (); |
---|
| 43 | |
---|
[3] | 44 | static bool check_tag_used (const Tag* tag); |
---|
| 45 | |
---|
[662] | 46 | static TagUses& apply_tag (); |
---|
| 47 | |
---|
[2] | 48 | public: |
---|
| 49 | Tag (); |
---|
| 50 | Tag (const Tag& other); |
---|
| 51 | Tag& operator = (const Tag& other); |
---|
| 52 | ~Tag (); |
---|
| 53 | void clear (); |
---|
| 54 | void add_tag_ref (Tag* ref); |
---|
| 55 | void add_tag_exclude (Tag* ref); |
---|
[546] | 56 | void add_ref_use (Use* use); |
---|
[2] | 57 | void unmark (); |
---|
[568] | 58 | void mark (const cmt_string& context); |
---|
| 59 | //void mark (); |
---|
[549] | 60 | void show_definition (bool quiet, ostream& out = cout, |
---|
| 61 | const cmt_string& prefix = "") const; |
---|
[547] | 62 | // void show_definition (bool quiet) const; |
---|
[549] | 63 | void show (bool quiet, ostream& out = cout, const cmt_string& prefix = "") const; |
---|
[547] | 64 | // void show (bool quiet) const; |
---|
[2] | 65 | bool is_selected () const; |
---|
| 66 | bool is_primary () const; |
---|
| 67 | const cmt_string& get_name () const; |
---|
| 68 | int get_priority () const; |
---|
| 69 | void install (TagMap& instances); |
---|
[3] | 70 | bool use_operand (const Tag* other) const; |
---|
| 71 | bool use_ref (const Tag* other) const; |
---|
[2] | 72 | |
---|
| 73 | private: |
---|
| 74 | cmt_string m_name; |
---|
| 75 | bool m_selected; |
---|
| 76 | TagPtrVector m_and_operands; |
---|
| 77 | TagPtrVector m_tag_refs; |
---|
| 78 | TagPtrVector m_tag_excludes; |
---|
| 79 | cmt_string m_context; |
---|
| 80 | Use* m_def_use; |
---|
| 81 | Use* m_set_use; |
---|
[568] | 82 | cmt_string m_act_context; |
---|
[546] | 83 | Use::UsePtrVector m_ref_uses; |
---|
[2] | 84 | int m_priority; |
---|
[318] | 85 | ScopeType scope; |
---|
[2] | 86 | }; |
---|
| 87 | |
---|
| 88 | #endif |
---|