source: CMT/HEAD/source/cmt_tag.h @ 662

Last change on this file since 662 was 662, checked in by rybkin, 10 years ago

See C.L. 521

  • Property svn:eol-style set to native
File size: 2.5 KB
Line 
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
15class Tag
16{
17public:
18  typedef cmt_map<cmt_string, Tag> TagMap;
19  typedef cmt_vector<Tag> TagVector;
20  typedef cmt_vector<Tag*> TagPtrVector;
21
22  typedef cmt_vmap<const Tag*, Use::UsePtrVector> TagUses;
23
24  static void action (const CmtSystem::cmt_string_vector& words, Use* use);
25  static void action_apply (const CmtSystem::cmt_string_vector& words, Use* use);
26  static void action_exclude (const CmtSystem::cmt_string_vector& words, Use* use);
27  static Tag* find (const cmt_string& name, TagMap& instances);
28  static Tag* find (const cmt_string& name);
29  static Tag* add (const cmt_string& name, int priority,
30                   const cmt_string& context, Use* use = 0);
31  static int tag_number ();
32  static Tag* tag (int index);
33  static void unmark_all ();
34  static void restore_tree ();
35  static void clear_all ();
36
37  static TagMap& tag_map ();
38  static TagVector& all_tags ();
39  static TagPtrVector& tags ();
40
41  static Tag* get_default ();
42
43  static bool check_tag_used (const Tag* tag);
44
45  static TagUses& apply_tag ();
46
47public:
48  Tag ();
49  Tag (const Tag& other);
50  Tag& operator = (const Tag& other);
51  ~Tag ();
52  void clear ();
53  void add_tag_ref (Tag* ref);
54  void add_tag_exclude (Tag* ref);
55  void add_ref_use (Use* use);
56  void unmark ();
57  void mark (const cmt_string& context);
58  //void mark ();
59  void show_definition (bool quiet, ostream& out = cout,
60                        const cmt_string& prefix = "") const;
61  //  void show_definition (bool quiet) const;
62  void show (bool quiet, ostream& out = cout, const cmt_string& prefix = "") const;
63  //  void show (bool quiet) const;
64  bool is_selected () const;
65  bool is_primary () const;
66  const cmt_string& get_name () const;
67  int get_priority () const;
68  void install (TagMap& instances);
69  bool use_operand (const Tag* other) const;
70  bool use_ref (const Tag* other) const;
71
72private:
73  cmt_string m_name;
74  bool m_selected;
75  TagPtrVector m_and_operands;
76  TagPtrVector m_tag_refs;
77  TagPtrVector m_tag_excludes;
78  cmt_string m_context;
79  Use* m_def_use;
80  Use* m_set_use;
81  cmt_string m_act_context;
82  Use::UsePtrVector m_ref_uses;
83  int m_priority;
84  ScopeType scope;
85};
86
87#endif
Note: See TracBrowser for help on using the repository browser.