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 | static bool check_tag_used (const Tag* tag); |
---|
42 | |
---|
43 | public: |
---|
44 | Tag (); |
---|
45 | Tag (const Tag& other); |
---|
46 | Tag& operator = (const Tag& other); |
---|
47 | ~Tag (); |
---|
48 | void clear (); |
---|
49 | void add_tag_ref (Tag* ref); |
---|
50 | void add_tag_exclude (Tag* ref); |
---|
51 | void unmark (); |
---|
52 | void mark (); |
---|
53 | void show_definition (bool quiet) const; |
---|
54 | void show (bool quiet) const; |
---|
55 | bool is_selected () const; |
---|
56 | bool is_primary () const; |
---|
57 | const cmt_string& get_name () const; |
---|
58 | int get_priority () const; |
---|
59 | void install (TagMap& instances); |
---|
60 | bool use_operand (const Tag* other) const; |
---|
61 | bool use_ref (const Tag* other) const; |
---|
62 | |
---|
63 | private: |
---|
64 | cmt_string m_name; |
---|
65 | bool m_selected; |
---|
66 | TagPtrVector m_and_operands; |
---|
67 | TagPtrVector m_tag_refs; |
---|
68 | TagPtrVector m_tag_excludes; |
---|
69 | cmt_string m_context; |
---|
70 | Use* m_def_use; |
---|
71 | Use* m_set_use; |
---|
72 | int m_priority; |
---|
73 | }; |
---|
74 | |
---|
75 | #endif |
---|