Panda3D

Loading...
Searching...
No Matches
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
33PUBLISHED:
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
DCKeywordList::copy_keywords
void copy_keywords(const DCKeywordList &other)
Replaces this keyword list with those from the other list.
Definition dcKeywordList.cxx:118
DCKeywordList::clear_keywords
void clear_keywords()
Removes all keywords from the field.
Definition dcKeywordList.cxx:141
DCKeywordList::add_keyword
bool add_keyword(const DCKeyword *keyword)
Adds the indicated keyword to the list.
Definition dcKeywordList.cxx:127
DCKeywordList::get_keyword
const DCKeyword * get_keyword(int n) const
Returns the nth keyword in the list.
Definition dcKeywordList.cxx:85
DCKeywordList::generate_hash
void generate_hash(HashGenerator &hashgen) const
Accumulates the properties of these keywords into the hash.
Definition dcKeywordList.cxx:162
DCKeywordList::compare_keywords
bool compare_keywords(const DCKeywordList &other) const
Returns true if this list has the same keywords as the other list, false if some keywords differ.
Definition dcKeywordList.cxx:110
DCKeywordList::has_keyword
bool has_keyword(const std::string &name) const
Returns true if this list includes the indicated keyword, false otherwise.
Definition dcKeywordList.cxx:60
DCKeywordList::get_keyword_by_name
const DCKeyword * get_keyword_by_name(const std::string &name) const
Returns the keyword in the list with the indicated name, or NULL if there is no keyword in the list w...
Definition dcKeywordList.cxx:95
DCKeywordList::get_num_keywords
int get_num_keywords() const
Returns the number of keywords in the list.
Definition dcKeywordList.cxx:76
DCKeyword
This represents a single keyword declaration in the dc file.
Definition dcKeyword.h:28
HashGenerator
This class generates an arbitrary hash number from a sequence of ints.
Definition hashGenerator.h:23
dcbase.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.