Panda3D
dcKeywordList.h
Go to the documentation of this file.
1 /**
2  * PANDA 3D SOFTWARE
3  * Copyright (c) Carnegie Mellon University. All rights reserved.
4  *
5  * All use of this software is subject to the terms of the revised BSD
6  * license. You should have received a copy of this license along
7  * with this source code in a file named "LICENSE."
8  *
9  * @file dcKeywordList.h
10  * @author drose
11  * @date 2005-07-25
12  */
13 
14 #ifndef DCKEYWORDLIST_H
15 #define DCKEYWORDLIST_H
16 
17 #include "dcbase.h"
18 
19 class DCKeyword;
20 class HashGenerator;
21 
22 /**
23  * This is a list of keywords (see DCKeyword) that may be set on a particular
24  * field.
25  */
26 class EXPCL_DIRECT_DCPARSER DCKeywordList {
27 public:
28  DCKeywordList();
29  DCKeywordList(const DCKeywordList &copy);
30  void operator = (const DCKeywordList &copy);
31  ~DCKeywordList();
32 
33 PUBLISHED:
34  bool has_keyword(const std::string &name) const;
35  bool has_keyword(const DCKeyword *keyword) const;
36  int get_num_keywords() const;
37  const DCKeyword *get_keyword(int n) const;
38  const DCKeyword *get_keyword_by_name(const std::string &name) const;
39 
40  bool compare_keywords(const DCKeywordList &other) const;
41 
42 public:
43  void copy_keywords(const DCKeywordList &other);
44 
45  bool add_keyword(const DCKeyword *keyword);
46  void clear_keywords();
47 
48  void output_keywords(std::ostream &out) const;
49  void generate_hash(HashGenerator &hashgen) const;
50 
51 private:
52  typedef pvector<const DCKeyword *> Keywords;
53  Keywords _keywords;
54 
55  typedef pmap<std::string, const DCKeyword *> KeywordsByName;
56  KeywordsByName _keywords_by_name;
57 
58  int _flags;
59 };
60 
61 #endif
This represents a single keyword declaration in the dc file.
Definition: dcKeyword.h:28
This is our own Panda specialization on the default STL map.
Definition: pmap.h:49
This is a list of keywords (see DCKeyword) that may be set on a particular field.
Definition: dcKeywordList.h:26
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This is our own Panda specialization on the default STL vector.
Definition: pvector.h:42
This class generates an arbitrary hash number from a sequence of ints.
Definition: hashGenerator.h:24