From 0706264669dd0bc18d6d1994cd906be68f37d3e2 Mon Sep 17 00:00:00 2001 From: Dario Sassi Date: Mon, 6 Feb 2017 07:49:04 +0000 Subject: [PATCH] =?UTF-8?q?EgtExecutor=20:=20-=20aggiunta=20funzione=20Exe?= =?UTF-8?q?TextGetContent=20-=20in=20lua=20modificata=20EgtSplitString=20p?= =?UTF-8?q?er=20gestire=20campi=20vuoti=20tra=20separatori=20e=20considera?= =?UTF-8?q?re=20pi=C3=B9=20spazi,=20definito=20spazio=20come=20separatore,?= =?UTF-8?q?=20come=20un=20solo=20separatore?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- EXE_GeoSnap.cpp | 17 +++++++++++++++++ LUA_General.cpp | 8 +++++++- 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/EXE_GeoSnap.cpp b/EXE_GeoSnap.cpp index f8d428e..5562352 100644 --- a/EXE_GeoSnap.cpp +++ b/EXE_GeoSnap.cpp @@ -31,6 +31,9 @@ #include "/EgtDev/Include/EgkDistPointCurve.h" #include "/EgtDev/Include/EgkIntersCurves.h" #include "/EgtDev/Include/EgtPointerOwner.h" +#include + +using namespace std ; //---------------------------------------------------------------------------- bool @@ -1084,6 +1087,20 @@ ExeTextNormVersor( int nId, int nRefId, Vector3d& vtNorm) return TrasformVector( pGeomDB, nId, nRefId, vtNorm) ; } +//---------------------------------------------------------------------------- +bool +ExeTextGetContent( int nId, string& sText) +{ + IGeomDB* pGeomDB = GetCurrGeomDB() ; + VERIFY_GEOMDB( pGeomDB, false) + // recupero il testo + const IExtText* pTxt = GetExtText( pGeomDB->GetGeoObj( nId)) ; + if ( pTxt == nullptr) + return false ; + // recupero il contenuto + sText = pTxt->GetText() ; + return true ; +} //------------------------------------------------------------------------------- // Geo Transforms diff --git a/LUA_General.cpp b/LUA_General.cpp index 42d2427..9480882 100644 --- a/LUA_General.cpp +++ b/LUA_General.cpp @@ -150,8 +150,14 @@ LuaSplitString( lua_State* L) bool bFound = LuaGetParam( L, 1, sVal) ; LuaGetParam( L, 2, sSep) ; LuaClearStack( L) ; - // se ricevuta stringa, la divido in parti separate da ',' + // se ricevuta stringa, la divido in parti separate da sSep if ( bFound) { + // se tra i separatori c'é ' ', collasso gli spazi consecutivi in uno solo + if ( sSep.find( " ") != string::npos) { + while ( ReplaceString( sVal, " ", " ") > 0) + ; + } + // eseguo separazione STRVECTOR vsVal ; Tokenize( sVal, sSep, vsVal) ; // ritorno il risultato