const Name* 
NameCollection::getBestName( LangTypes::language_t lang ) const
{
   // Simply uses NameUtility::getBestName
   
   // Create a uint32 array from the Name:s
   ScopedArray<uint32> nameArray( new uint32[ getSize() ] );
   
   for ( size_type i = 0; i < getSize(); ++i ) {
      const Name* name = getName( i );
      nameArray[ i ] = CREATE_NEW_NAME( name->getLanguage(), 
                                        name->getType(), 
                                        i ); 
   }
   
   int result = NameUtility::getBestName( getSize(), 
                                          nameArray.get(), 
                                          lang, 
                                          NULL, 
                                          false );
   if ( result >= 0 ) {
      return getName( result );
   }
   else {
      return &m_missingName;
   }
}
Ejemplo n.º 2
0
XSI::Null DoesObjectExist ( XSI::X3DObject in_pModel, XSI::CString in_szName )
{
	XSI::Null theNull;

	XSI::CStringArray emptyArray;
	XSI::CRefArray cRefArray = in_pModel.FindChildren( L"", L"", emptyArray, true );

	XSI::CStringArray nameArray(cRefArray.GetCount());
	for ( long i=0; i < cRefArray.GetCount(); i++ )
	{
		if ( in_szName == XSI::SIObject(cRefArray[i]).GetName() )
		{
			theNull = cRefArray[i];
			break;
		}
	}

	return theNull;

}