#ifndef __cmt_tag_h__
#define __cmt_tag_h__

#include "cmt_parser.h"
#include "cmt_system.h"
#include "cmt_use.h"

class Tag
{
public:
  typedef cmt_vector<Tag> TagVector;
  typedef cmt_vector<Tag*> TagPtrVector;

  static void action (const CmtSystem::cmt_string_vector& words, Use* use);
  static void action_exclude (const CmtSystem::cmt_string_vector& words, Use* use);
  static Tag* find (const cmt_string& name);
  static Tag* add (const cmt_string& name, int priority,
                   const cmt_string& context, Use* use = 0);
  static int tag_number ();
  static Tag* tag (int index);
  static void unmark_all ();
  static void restore_tree ();
  static void clear_all ();
  static TagVector& all_tags ();
  static TagPtrVector& tags ();
  static Tag* get_default ();

public:
  Tag ();
  ~Tag ();
  void clear ();
  void add_tag_ref (Tag* ref);
  void add_tag_exclude (Tag* ref);
  void unmark ();
  void mark ();
  void show_definition (bool quiet) const;
  void show (bool quiet) const;
  bool is_selected () const;

  cmt_string name;
  TagPtrVector tag_refs;
  TagPtrVector tag_excludes;
  int priority;
  Use* def_use;
  Use* set_use;
  cmt_string context;
  bool selected;
};

#endif
