14#ifndef EGGNAMEUNIQUIFIER_H
15#define EGGNAMEUNIQUIFIER_H
59class EXPCL_PANDA_EGG EggNameUniquifier :
public EggObject {
68 EggNode *
get_node(
const std::string &category,
const std::string &name)
const;
69 bool has_name(
const std::string &category,
const std::string &name)
const;
70 bool add_name(
const std::string &category,
const std::string &name,
73 virtual std::string get_category(
EggNode *node)=0;
76 const std::string &category,
int index);
79 typedef pmap<std::string, EggNode *> UsedNames;
80 typedef pmap<std::string, UsedNames> Categories;
82 Categories _categories;
90 static void init_type() {
91 EggObject::init_type();
93 EggObject::get_class_type());
96 return get_class_type();
98 virtual TypeHandle force_init_type() {init_type();
return get_class_type();}
bool add_name(const std::string &category, const std::string &name, EggNode *node=nullptr)
Adds the name to the indicated category.
virtual std::string filter_name(EggNode *node)
Returns the name of the given node, or at least the name it should be.
EggNode * get_node(const std::string &category, const std::string &name) const
Returns the node associated with the given category and name, or NULL if the name has not been used.
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.
void clear()
Empties the table of used named and prepares the Uniquifier for a new tree.
void uniquify(EggNode *node)
Begins the traversal from the indicated node.
bool has_name(const std::string &category, const std::string &name) const
Returns true if the name has been used for the indicated category already, false otherwise.
A base class for things that may be directly added into the egg hierarchy.
TypeHandle is the identifier used to differentiate C++ class types.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void register_type(TypeHandle &type_handle, const std::string &name)
This inline function is just a convenient way to call TypeRegistry::register_type(),...