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