MCPcopy Create free account
hub / github.com/KhronosGroup/OpenCOLLADA / addId

Method addId

COLLADABaseUtils/src/COLLADABUIDList.cpp:22–55  ·  view source on GitHub ↗

-------------------------------------

Source from the content-addressed store, hash-verified

20
21 //-------------------------------------
22 String IDList::addId (
23 const String& newId,
24 bool returnConverted /*= true*/,
25 bool alwaysAddNumberSuffix /*= false*/ )
26 {
27 String newIdChecked = mConversionFunction( newId );
28
29 IDSet::iterator it = mIdSet.find ( newIdChecked );
30 if ( !alwaysAddNumberSuffix )
31 {
32 if ( it == mIdSet.end() )
33 {
34 mIdSet.insert ( newIdChecked );
35 return returnConverted ? newIdChecked : newId;
36 }
37 else if ( !returnConverted )
38 {
39 return newId;
40 }
41 }
42
43 String idCandidate;
44 size_t numberSuffix = 0;
45 do
46 {
47 ++numberSuffix;
48 idCandidate = newIdChecked + "_" + Utils::toString ( numberSuffix );
49 }
50 while ( mIdSet.find ( idCandidate ) != mIdSet.end() );
51
52 mIdSet.insert ( idCandidate );
53
54 return returnConverted ? idCandidate : newId + "_" + Utils::toString ( numberSuffix );
55 }
56
57 //-------------------------------------
58 bool IDList::containsId ( const String& id )

Callers 15

exportSimpleEffectMethod · 0.80
exportImageMethod · 0.80
addSymbolMethod · 0.80
setTextureMethod · 0.80
createMethod · 0.80
DocumentImporterMethod · 0.80
addGlobalNodeIdMethod · 0.80
addDependNodeIdMethod · 0.80
addChildNodeIdMethod · 0.80
setTextureMethod · 0.80
openVisualSceneNodeMethod · 0.80
exportLightMethod · 0.80

Calls 1

endMethod · 0.45

Tested by

no test coverage detected