Panda3D
 All Classes Functions Variables Enumerations
xFileDataObjectArray.h
1 // Filename: xFileDataObjectArray.h
2 // Created by: drose (07Oct04)
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 XFILEDATAOBJECTARRAY_H
16 #define XFILEDATAOBJECTARRAY_H
17 
18 #include "pandatoolbase.h"
19 #include "xFileDataObject.h"
20 
21 ////////////////////////////////////////////////////////////////////
22 // Class : XFileDataObjectArray
23 // Description : An array of nested data elements.
24 ////////////////////////////////////////////////////////////////////
26 public:
27  INLINE XFileDataObjectArray(const XFileDataDef *data_def);
28 
29  virtual bool is_complex_object() const;
30 
31  virtual bool add_element(XFileDataObject *element);
32 
33  virtual void write_data(ostream &out, int indent_level,
34  const char *separator) const;
35 
36 protected:
37  virtual int get_num_elements() const;
38  virtual XFileDataObject *get_element(int n);
39 
40 private:
42  NestedElements _nested_elements;
43 
44 public:
45  static TypeHandle get_class_type() {
46  return _type_handle;
47  }
48  static void init_type() {
49  XFileDataObject::init_type();
50  register_type(_type_handle, "XFileDataObjectArray",
51  XFileDataObject::get_class_type());
52  }
53  virtual TypeHandle get_type() const {
54  return get_class_type();
55  }
56  virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
57 
58 private:
59  static TypeHandle _type_handle;
60 };
61 
62 #include "xFileDataObjectArray.I"
63 
64 #endif
virtual bool add_element(XFileDataObject *element)
Adds the indicated element as a nested data element, if this data object type supports it...
A definition of a single data element appearing within a template record.
Definition: xFileDataDef.h:35
virtual void write_data(ostream &out, int indent_level, const char *separator) const
Writes a suitable representation of this node to an .x file in text mode.
An array of nested data elements.
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:85
virtual bool is_complex_object() const
Returns true if this kind of data object is a complex object that can hold nested data elements...
The abstract base class for a number of different types of data elements that may be stored in the X ...