Panda3D

eggGroupUniquifier.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 eggGroupUniquifier.h
10 * @author drose
11 * @date 2001-02-22
12 */
13
14 #ifndef EGGGROUPUNIQUIFIER_H
15 #define EGGGROUPUNIQUIFIER_H
16
17 #include "pandabase.h"
18
19 #include "eggNameUniquifier.h"
20
21 /**
22 * This is a specialization of EggNameUniquifier to generate unique names for
23 * EggGroup nodes. It's not called automatically; you must invoke it yourself
24 * if you want it.
25 */
26 class EXPCL_PANDA_EGG EggGroupUniquifier : public EggNameUniquifier {
27 PUBLISHED:
28 explicit EggGroupUniquifier(bool filter_names = true);
29
30 virtual std::string get_category(EggNode *node);
31 virtual std::string filter_name(EggNode *node);
32 virtual std::string generate_name(EggNode *node,
33 const std::string &category, int index);
34
35 private:
36 bool _filter_names;
37
38 public:
39 static TypeHandle get_class_type() {
40 return _type_handle;
41 }
42 static void init_type() {
43 EggNameUniquifier::init_type();
44 register_type(_type_handle, "EggGroupUniquifier",
45 EggNameUniquifier::get_class_type());
46 }
47 virtual TypeHandle get_type() const {
48 return get_class_type();
49 }
50 virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
51
52 private:
53 static TypeHandle _type_handle;
54
55 };
56
57 #endif
EggGroupUniquifier
This is a specialization of EggNameUniquifier to generate unique names for EggGroup nodes.
Definition: eggGroupUniquifier.h:26
EggNameUniquifier
This is a handy class for guaranteeing unique node names in an egg hierarchy.
Definition: eggNameUniquifier.h:59
EggNameUniquifier::filter_name
virtual std::string filter_name(EggNode *node)
Returns the name of the given node, or at least the name it should be.
Definition: eggNameUniquifier.cxx:162
EggNameUniquifier::generate_name
virtual std::string generate_name(EggNode *node, const std::string &category, int index)
Generates a new name for the given node when its existing name clashes with some other node.
Definition: eggNameUniquifier.cxx:175
EggNode
A base class for things that may be directly added into the egg hierarchy.
Definition: eggNode.h:36
TypeHandle
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:81
eggNameUniquifier.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
pandabase.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
register_type
void register_type(TypeHandle &type_handle, const std::string &name)
This inline function is just a convenient way to call TypeRegistry::register_type(),...
Definition: register_type.I:22