Panda3D
|
00001 // Filename: dcKeywordList.h 00002 // Created by: drose (25Jul05) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) Carnegie Mellon University. All rights reserved. 00008 // 00009 // All use of this software is subject to the terms of the revised BSD 00010 // license. You should have received a copy of this license along 00011 // with this source code in a file named "LICENSE." 00012 // 00013 //////////////////////////////////////////////////////////////////// 00014 00015 #ifndef DCKEYWORDLIST_H 00016 #define DCKEYWORDLIST_H 00017 00018 #include "dcbase.h" 00019 00020 class DCKeyword; 00021 class HashGenerator; 00022 00023 //////////////////////////////////////////////////////////////////// 00024 // Class : DCKeywordList 00025 // Description : This is a list of keywords (see DCKeyword) that may 00026 // be set on a particular field. 00027 //////////////////////////////////////////////////////////////////// 00028 class EXPCL_DIRECT DCKeywordList { 00029 public: 00030 DCKeywordList(); 00031 DCKeywordList(const DCKeywordList ©); 00032 void operator = (const DCKeywordList ©); 00033 ~DCKeywordList(); 00034 00035 PUBLISHED: 00036 bool has_keyword(const string &name) const; 00037 bool has_keyword(const DCKeyword *keyword) const; 00038 int get_num_keywords() const; 00039 const DCKeyword *get_keyword(int n) const; 00040 const DCKeyword *get_keyword_by_name(const string &name) const; 00041 00042 bool compare_keywords(const DCKeywordList &other) const; 00043 00044 public: 00045 void copy_keywords(const DCKeywordList &other); 00046 00047 bool add_keyword(const DCKeyword *keyword); 00048 void clear_keywords(); 00049 00050 void output_keywords(ostream &out) const; 00051 void generate_hash(HashGenerator &hashgen) const; 00052 00053 private: 00054 typedef pvector<const DCKeyword *> Keywords; 00055 Keywords _keywords; 00056 00057 typedef pmap<string, const DCKeyword *> KeywordsByName; 00058 KeywordsByName _keywords_by_name; 00059 00060 int _flags; 00061 }; 00062 00063 #endif