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