Panda3D
 All Classes Functions Variables Enumerations
interrogateElement.h
1 // Filename: interrogateElement.h
2 // Created by: drose (11Aug00)
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 INTERROGATEELEMENT_H
16 #define INTERROGATEELEMENT_H
17 
18 #include "dtoolbase.h"
19 
20 #include "interrogateComponent.h"
21 
22 class IndexRemapper;
23 
24 ////////////////////////////////////////////////////////////////////
25 // Class : InterrogateElement
26 // Description : An internal representation of a data element, like a
27 // data member or a global variable.
28 ////////////////////////////////////////////////////////////////////
29 class EXPCL_DTOOLCONFIG InterrogateElement : public InterrogateComponent {
30 public:
31  INLINE InterrogateElement(InterrogateModuleDef *def = NULL);
32  INLINE InterrogateElement(const InterrogateElement &copy);
33  INLINE void operator = (const InterrogateElement &copy);
34 
35  INLINE bool is_global() const;
36 
37  INLINE bool has_scoped_name() const;
38  INLINE const string &get_scoped_name() const;
39 
40  INLINE bool has_comment() const;
41  INLINE const string &get_comment() const;
42 
43  INLINE TypeIndex get_type() const;
44  INLINE bool has_getter() const;
45  INLINE FunctionIndex get_getter() const;
46  INLINE bool has_setter() const;
47  INLINE FunctionIndex get_setter() const;
48 
49  void output(ostream &out) const;
50  void input(istream &in);
51 
52  void remap_indices(const IndexRemapper &remap);
53 
54 private:
55  enum Flags {
56  F_global = 0x0001,
57  F_has_getter = 0x0002,
58  F_has_setter = 0x0004
59  };
60 
61  int _flags;
62  string _scoped_name;
63  string _comment;
64  TypeIndex _type;
65  FunctionIndex _getter;
66  FunctionIndex _setter;
67 
68  friend class InterrogateBuilder;
69 };
70 
71 INLINE ostream &operator << (ostream &out, const InterrogateElement &element);
72 INLINE istream &operator >> (istream &in, InterrogateElement &element);
73 
74 #include "interrogateElement.I"
75 
76 #endif
This class manages a mapping of integers to integers.
Definition: indexRemapper.h:33
void input(istream &in)
Reads the data file as previously formatted by output().
The base class for things that are part of the interrogate database.
An internal representation of a data element, like a data member or a global variable.
void output(ostream &out) const
Formats the component for output to a data file.