forked from panda3d/panda3d
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdcFile.h
More file actions
129 lines (99 loc) · 3.16 KB
/
dcFile.h
File metadata and controls
129 lines (99 loc) · 3.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
/**
* PANDA 3D SOFTWARE
* Copyright (c) Carnegie Mellon University. All rights reserved.
*
* All use of this software is subject to the terms of the revised BSD
* license. You should have received a copy of this license along
* with this source code in a file named "LICENSE."
*
* @file dcFile.h
* @author drose
* @date 2000-10-05
*/
#ifndef DCFILE_H
#define DCFILE_H
#include "dcbase.h"
#include "dcKeywordList.h"
class DCClass;
class DCSwitch;
class DCField;
class HashGenerator;
class DCTypedef;
class DCKeyword;
class DCDeclaration;
/**
* Represents the complete list of Distributed Class descriptions as read from
* a .dc file.
*/
class EXPCL_DIRECT_DCPARSER DCFile {
PUBLISHED:
DCFile();
~DCFile();
void clear();
#ifdef WITHIN_PANDA
bool read_all();
#endif
bool read(Filename filename);
bool read(std::istream &in, const std::string &filename = std::string());
bool write(Filename filename, bool brief) const;
bool write(std::ostream &out, bool brief) const;
int get_num_classes() const;
DCClass *get_class(int n) const;
DCClass *get_class_by_name(const std::string &name) const;
DCSwitch *get_switch_by_name(const std::string &name) const;
DCField *get_field_by_index(int index_number) const;
INLINE bool all_objects_valid() const;
int get_num_import_modules() const;
std::string get_import_module(int n) const;
int get_num_import_symbols(int n) const;
std::string get_import_symbol(int n, int i) const;
int get_num_typedefs() const;
DCTypedef *get_typedef(int n) const;
DCTypedef *get_typedef_by_name(const std::string &name) const;
int get_num_keywords() const;
const DCKeyword *get_keyword(int n) const;
const DCKeyword *get_keyword_by_name(const std::string &name) const;
unsigned long get_hash() const;
public:
void generate_hash(HashGenerator &hashgen) const;
bool add_class(DCClass *dclass);
bool add_switch(DCSwitch *dswitch);
void add_import_module(const std::string &import_module);
void add_import_symbol(const std::string &import_symbol);
bool add_typedef(DCTypedef *dtypedef);
bool add_keyword(const std::string &name);
void add_thing_to_delete(DCDeclaration *decl);
void set_new_index_number(DCField *field);
INLINE void check_inherited_fields();
INLINE void mark_inherited_fields_stale();
private:
void setup_default_keywords();
void rebuild_inherited_fields();
typedef pvector<DCClass *> Classes;
Classes _classes;
typedef pmap<std::string, DCDeclaration *> ThingsByName;
ThingsByName _things_by_name;
typedef pvector<std::string> ImportSymbols;
class Import {
public:
std::string _module;
ImportSymbols _symbols;
};
typedef pvector<Import> Imports;
Imports _imports;
typedef pvector<DCTypedef *> Typedefs;
Typedefs _typedefs;
typedef pmap<std::string, DCTypedef *> TypedefsByName;
TypedefsByName _typedefs_by_name;
DCKeywordList _keywords;
DCKeywordList _default_keywords;
typedef pvector<DCDeclaration *> Declarations;
Declarations _declarations;
Declarations _things_to_delete;
typedef pvector<DCField *> FieldsByIndex;
FieldsByIndex _fields_by_index;
bool _all_objects_valid;
bool _inherited_fields_stale;
};
#include "dcFile.I"
#endif