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