KiCad PCB EDA Suite
NAMEREGISTER Class Reference

#include <vrml1_node.h>

Public Member Functions

bool AddName (const std::string &aName, WRL1NODE *aNode)
 
bool DelName (const std::string &aName, WRL1NODE *aNode)
 
WRL1NODEFindName (const std::string &aName)
 

Private Attributes

std::map< std::string, WRL1NODE * > reg
 

Detailed Description

Definition at line 47 of file vrml1_node.h.

Member Function Documentation

◆ AddName()

bool NAMEREGISTER::AddName ( const std::string &  aName,
WRL1NODE aNode 
)

Definition at line 39 of file vrml1_node.cpp.

40{
41 if( aName.empty() )
42 return false;
43
44 std::map< std::string, WRL1NODE* >::iterator ir = reg.find( aName );
45
46 if( ir != reg.end() )
47 reg.erase( ir );
48
49 reg.emplace( aName, aNode );
50
51 return true;
52}
std::map< std::string, WRL1NODE * > reg
Definition: vrml1_node.h:55

References reg.

Referenced by WRL1BASE::implementDef(), and WRL1NODE::SetName().

◆ DelName()

bool NAMEREGISTER::DelName ( const std::string &  aName,
WRL1NODE aNode 
)

Definition at line 55 of file vrml1_node.cpp.

56{
57 if( aName.empty() )
58 return false;
59
60 std::map< std::string, WRL1NODE* >::iterator ir = reg.find( aName );
61
62 if( ir != reg.end() && ir->second == aNode )
63 {
64 reg.erase( ir );
65 return true;
66 }
67
68 return false;
69}

References reg.

Referenced by WRL1NODE::~WRL1NODE().

◆ FindName()

WRL1NODE * NAMEREGISTER::FindName ( const std::string &  aName)

Definition at line 72 of file vrml1_node.cpp.

73{
74 if( aName.empty() )
75 return nullptr;
76
77 std::map< std::string, WRL1NODE* >::iterator ir = reg.find( aName );
78
79 if( ir != reg.end() )
80 return ir->second;
81
82 return nullptr;
83}

References reg.

Referenced by WRL1NODE::FindNode().

Member Data Documentation

◆ reg

std::map< std::string, WRL1NODE* > NAMEREGISTER::reg
private

Definition at line 55 of file vrml1_node.h.

Referenced by AddName(), DelName(), and FindName().


The documentation for this class was generated from the following files: