EgtGeomKernel :
- aggiunta possibilità di avere lista nomi dei gestori di ObjUser.
This commit is contained in:
@@ -23,6 +23,7 @@
|
||||
#include "/EgtDev/Include/EGkGdbFunct.h"
|
||||
#include "/EgtDev/Include/EGkStringUtils3d.h"
|
||||
#include "/EgtDev/Include/EGkObjUserFactory.h"
|
||||
#include "/EgtDev/Include/EGnStringKeyVal.h"
|
||||
#include <new>
|
||||
|
||||
using namespace std ;
|
||||
@@ -1004,6 +1005,9 @@ GdbObj::SaveObjUser( NgeWriter& ngeOut) const
|
||||
STRVECTOR vString ;
|
||||
if ( ! m_pObjUser->Save( vString))
|
||||
return false ;
|
||||
// eseguo validazione di queste stringhe
|
||||
for ( auto iIter = vString.begin() ; iIter != vString.end() ; ++ iIter)
|
||||
ValidateKeyVal( *iIter) ;
|
||||
// scrivo i dati :
|
||||
// flag presenza ObjUser
|
||||
if ( ! ngeOut.WriteKey( NGE_U))
|
||||
|
||||
+18
-3
@@ -15,18 +15,20 @@
|
||||
#include "stdafx.h"
|
||||
#include "/EgtDev/Include/EGkObjUserFactory.h"
|
||||
|
||||
using namespace std ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
ObjUserFactory::Register( const std::string& sName, ObjUserCreator Creator)
|
||||
ObjUserFactory::Register( const string& sName, ObjUserCreator Creator)
|
||||
{
|
||||
return GetCreatorMap().emplace( sName, Creator).second ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
IObjUser*
|
||||
ObjUserFactory::Create( const std::string& sName)
|
||||
ObjUserFactory::Create( const string& sName)
|
||||
{
|
||||
CreatorMap::iterator Iter = GetCreatorMap().find( sName) ;
|
||||
auto Iter = GetCreatorMap().find( sName) ;
|
||||
if ( Iter != GetCreatorMap().end()) {
|
||||
if ( Iter->second != nullptr)
|
||||
return Iter->second() ;
|
||||
@@ -34,6 +36,19 @@ ObjUserFactory::Create( const std::string& sName)
|
||||
return nullptr ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
ObjUserFactory::GetList( STRVECTOR& vsList)
|
||||
{
|
||||
// verifico parametro di ritorno
|
||||
if ( &vsList == nullptr)
|
||||
return false ;
|
||||
// ciclo sugli oggetti registrati
|
||||
for ( auto Iter = GetCreatorMap().cbegin() ; Iter != GetCreatorMap().cend() ; ++ Iter)
|
||||
vsList.emplace_back( Iter->first) ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
ObjUserFactory::CreatorMap&
|
||||
ObjUserFactory::GetCreatorMap( void)
|
||||
|
||||
Reference in New Issue
Block a user