Panda3D
interrogateElement.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 interrogateElement.h
10  * @author drose
11  * @date 2000-08-11
12  */
13 
14 #ifndef INTERROGATEELEMENT_H
15 #define INTERROGATEELEMENT_H
16 
17 #include "dtoolbase.h"
18 
19 #include "interrogateComponent.h"
20 
21 class IndexRemapper;
22 class CPPMakeProperty;
23 
24 /**
25  * An internal representation of a data element, like a data member or a
26  * global variable.
27  */
28 class EXPCL_INTERROGATEDB InterrogateElement : public InterrogateComponent {
29 public:
30  INLINE InterrogateElement(InterrogateModuleDef *def = nullptr);
31  INLINE InterrogateElement(const InterrogateElement &copy);
32  INLINE void operator = (const InterrogateElement &copy);
33 
34  INLINE bool is_global() const;
35 
36  INLINE bool has_scoped_name() const;
37  INLINE const std::string &get_scoped_name() const;
38 
39  INLINE bool has_comment() const;
40  INLINE const std::string &get_comment() const;
41 
42  INLINE TypeIndex get_type() const;
43  INLINE bool has_getter() const;
44  INLINE FunctionIndex get_getter() const;
45  INLINE bool has_setter() const;
46  INLINE FunctionIndex get_setter() const;
47  INLINE bool has_has_function() const;
48  INLINE FunctionIndex get_has_function() const;
49  INLINE bool has_clear_function() const;
50  INLINE FunctionIndex get_clear_function() const;
51  INLINE bool has_del_function() const;
52  INLINE FunctionIndex get_del_function() const;
53  INLINE bool has_insert_function() const;
54  INLINE FunctionIndex get_insert_function() const;
55  INLINE bool has_getkey_function() const;
56  INLINE FunctionIndex get_getkey_function() const;
57  INLINE bool is_sequence() const;
58  INLINE FunctionIndex get_length_function() const;
59  INLINE bool is_mapping() const;
60 
61  void output(std::ostream &out) const;
62  void input(std::istream &in);
63 
64  void remap_indices(const IndexRemapper &remap);
65 
66 private:
67  enum Flags {
68  F_global = 0x0001,
69  F_has_getter = 0x0002,
70  F_has_setter = 0x0004,
71  F_has_has_function= 0x0008,
72  F_has_clear_function= 0x0010,
73  F_has_del_function= 0x0020,
74  F_sequence = 0x0040,
75  F_mapping = 0x0080,
76  F_has_insert_function= 0x0100,
77  F_has_getkey_function= 0x0200,
78  };
79 
80  int _flags;
81  std::string _scoped_name;
82  std::string _comment;
83  TypeIndex _type;
84  FunctionIndex _length_function;
85  FunctionIndex _getter;
86  FunctionIndex _setter;
87  FunctionIndex _has_function;
88  FunctionIndex _clear_function;
89  FunctionIndex _del_function;
90  FunctionIndex _insert_function;
91  FunctionIndex _getkey_function;
92 
93  CPPMakeProperty *_make_property;
94 
95  friend class InterrogateBuilder;
96 };
97 
98 INLINE std::ostream &operator << (std::ostream &out, const InterrogateElement &element);
99 INLINE std::istream &operator >> (std::istream &in, InterrogateElement &element);
100 
101 #include "interrogateElement.I"
102 
103 #endif
This class manages a mapping of integers to integers.
Definition: indexRemapper.h:29
void output(std::ostream &out) const
Formats the component for output to a data file.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
The base class for things that are part of the interrogate database.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
An internal representation of a data element, like a data member or a global variable.
void input(std::istream &in)
Reads the data file as previously formatted by output().
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.