From d566004aa94eb7c01705e15a358581efe66f059b Mon Sep 17 00:00:00 2001 From: Dario Sassi Date: Tue, 18 Mar 2014 08:52:35 +0000 Subject: [PATCH] Include : - aggiornamento interfacce. --- EGkGdbIterator.h | 9 ++++++--- EGkGeomDB.h | 13 ++++++++----- EGnStringConverter.h | 41 +++++++++++++++++++++++++++++++++++++++-- EGnStringUtils.h | 7 +++++-- EgnCmdExecutor.h | 1 + EgnCmdParser.h | 13 +++++++------ EgtLogger.h | 4 ++-- 7 files changed, 68 insertions(+), 20 deletions(-) diff --git a/EGkGdbIterator.h b/EGkGdbIterator.h index 265e1a1..f5c6ddc 100644 --- a/EGkGdbIterator.h +++ b/EGkGdbIterator.h @@ -58,9 +58,12 @@ class __declspec( novtable) IGdbIterator virtual bool RevertStatus( void) = 0 ; virtual bool GetStatus( int& nStat) const = 0 ; virtual bool GetCalcStatus( int& nStat) const = 0 ; - virtual bool SetColor( Color cCol) = 0 ; - virtual bool GetColor( Color& cCol) const = 0 ; - virtual bool GetCalcColor( Color& cCol) const = 0 ; + virtual bool SetMaterial( int nMat) = 0 ; + virtual bool SetMaterial( Color cCol) = 0 ; + virtual bool GetMaterial( int& nMat) const = 0 ; + virtual bool GetMaterial( Color& cCol) const = 0 ; + virtual bool GetCalcMaterial( int& nMat) const = 0 ; + virtual bool GetCalcMaterial( Color& cCol) const = 0 ; virtual bool SetName( const std::string& sName) = 0 ; virtual bool GetName( std::string& sName) const = 0 ; virtual bool RemoveName( void) = 0 ; diff --git a/EGkGeomDB.h b/EGkGeomDB.h index 66c2419..f71f861 100644 --- a/EGkGeomDB.h +++ b/EGkGeomDB.h @@ -77,11 +77,14 @@ class __declspec( novtable) IGeomDB virtual bool RevertStatus( int nId) = 0 ; virtual bool GetStatus( int nId, int& nStat) const = 0 ; virtual bool GetCalcStatus( int nId, int& nStat) const = 0 ; - virtual bool SetDefaultColor( Color cCol) = 0 ; - virtual bool GetDefaultColor( Color& cCol) const = 0 ; - virtual bool SetColor( int nId, Color cCol) = 0 ; - virtual bool GetColor( int nId, Color& cCol) const = 0 ; - virtual bool GetCalcColor( int nId, Color& cCol) const = 0 ; + virtual bool SetDefaultMaterial( Color cCol) = 0 ; + virtual bool GetDefaultMaterial( Color& cCol) const = 0 ; + virtual bool SetMaterial( int nId, int nMat) = 0 ; + virtual bool SetMaterial( int nId, Color cCol) = 0 ; + virtual bool GetMaterial( int nId, int& nMat) const = 0 ; + virtual bool GetMaterial( int nId, Color& cCol) const = 0 ; + virtual bool GetCalcMaterial( int nId, int& nMat) const = 0 ; + virtual bool GetCalcMaterial( int nId, Color& cCol) const = 0 ; virtual bool SetName( int nId, const std::string& sName) = 0 ; virtual bool GetName( int nId, std::string& sName) const = 0 ; virtual bool RemoveName( int nId) = 0 ; diff --git a/EGnStringConverter.h b/EGnStringConverter.h index deb7f9b..7cd51c2 100644 --- a/EGnStringConverter.h +++ b/EGnStringConverter.h @@ -7,6 +7,7 @@ // // // Modifiche : 10.02.13 DS Creazione modulo. +// 15.03.14 DS Agg. classe wcharBuffer per buffer con Windows API. // // //---------------------------------------------------------------------------- @@ -16,7 +17,10 @@ //----------------------------------------------------------------------------- #include +#include +//----------------------------------------------------------------------------- +// Funzioni ausiliarie //----------------------------------------------------------------------------- template inline void SmartAllocMemory( _CharType** ppBuff, int nLength, _CharType* pszFixedBuffer, int nFixedBufferLength) @@ -121,8 +125,11 @@ inline bool IsTextUtf8( const char* psz) return true ; } + //----------------------------------------------------------------------------- -template< int t_nBufferLength = 128 > +//! Classe per convertire stringhe A (char UTF-8) in stringhe W (wchar_t UTF-16) +//----------------------------------------------------------------------------- +template< int t_nBufferLength = 128> class AtoWEX { public : @@ -182,8 +189,11 @@ class AtoWEX typedef AtoWEX<> AtoW ; #define stringtoW(s) LPWSTR( AtoW( s.c_str())) + //----------------------------------------------------------------------------- -template < int t_nBufferLength = 128 > +//! Classe per convertire stringhe W (wchar_t UTF-16) in stringhe A (char UTF-8) +//----------------------------------------------------------------------------- +template < int t_nBufferLength = 128> class WtoAEX { public : @@ -245,3 +255,30 @@ class WtoAEX typedef WtoAEX<> WtoA ; #define wstringtoA(ws) LPSTR( WtoA( ws.c_str())) + + +//----------------------------------------------------------------------------- +//! Classe contenente un buffer di wchar_t da passare alle funzioni Unicode delle API +//! di Windows, con metodo per terminarlo e macro per convertirlo in char UTF-8.
+//! Esempio di utilizzo :
+//!    wcharBuffer wBuffer( nLen) ;
+//!    int nChar = GetLine( nCurrLine, wBuffer.data(), nLen) ;
+//!    wBuffer.terminate( nChar) ;
+//!    string sCmd = wcharBtoA( wBuffer) ; 
+//---------------------------------------------------------------------------- +class wcharBuffer +{ + public : + wcharBuffer( size_t nDim) + { m_wBuffer.resize( nDim) ; } + wchar_t* data( void) + { return m_wBuffer.data() ; } + void terminate( size_t nLen) + { nLen = min( nLen, m_wBuffer.size() - 1) ; + m_wBuffer[nLen] = '\0' ; } + + private : + std::vector m_wBuffer ; +} ; + +#define wcharBtoA(wcB) LPSTR( WtoA( wcB.data())) diff --git a/EGnStringUtils.h b/EGnStringUtils.h index 20ecd22..f5652de 100644 --- a/EGnStringUtils.h +++ b/EGnStringUtils.h @@ -1,7 +1,7 @@ //---------------------------------------------------------------------------- -// EgalTech 2013-2013 +// EgalTech 2013-2014 //---------------------------------------------------------------------------- -// File : EgnStringUtils.h Data : 20.11.13 Versione : 1.3a1 +// File : EgnStringUtils.h Data : 17.03.14 Versione : 1.5c2 // Contenuto : Dichiarazione delle funzioni di utilità per le stringhe. // // @@ -110,3 +110,6 @@ EGN_EXPORT bool Tokenize( const std::string& sString, const std::string& sSepara //---------------------------------------------------------------------------- EGN_EXPORT int ReplaceString( std::string& sString, const std::string& sOld, const std::string& sNew) ; + +//---------------------------------------------------------------------------- +EGN_EXPORT const std::string CurrDateTime( void) ; diff --git a/EgnCmdExecutor.h b/EgnCmdExecutor.h index ad70f5f..1595665 100644 --- a/EgnCmdExecutor.h +++ b/EgnCmdExecutor.h @@ -23,5 +23,6 @@ class __declspec( novtable) ICmdExecutor public : virtual bool SetCmdParser( ICmdParser* pParser) = 0 ; virtual bool AddExecutor( ICmdExecutor* pOtherExec) = 0 ; + virtual bool AddStandardVariables( void) = 0 ; virtual bool Execute( const std::string& sCmd1, const std::string& sCmd2, const STRVECTOR& vsParams) = 0 ; } ; diff --git a/EgnCmdParser.h b/EgnCmdParser.h index 92fdebf..d3f6f2b 100644 --- a/EgnCmdParser.h +++ b/EgnCmdParser.h @@ -1,13 +1,13 @@ //---------------------------------------------------------------------------- -// EgalTech 2013-2013 +// EgalTech 2013-2014 //---------------------------------------------------------------------------- -// File : EgnCmdParser.h Data : 25.11.13 Versione : 1.3a1 +// File : EgnCmdParser.h Data : 15.03.14 Versione : 1.5c // Contenuto : Dichiarazione della interfaccia ICmdParser. // // // // Modifiche : 25.11.13 DS Creazione modulo. -// +// 15.03.14 DS Agg. ExecuteLine. // //---------------------------------------------------------------------------- @@ -31,12 +31,13 @@ class __declspec( novtable) ICmdParser { public : virtual ~ICmdParser( void) {} - virtual bool Init( ICmdExecutor* pCmdExec, int nLev = 0) = 0 ; - virtual bool Run( const std::string& sCmdFile) = 0 ; + virtual bool Init( ICmdExecutor* pCmdExec) = 0 ; + virtual bool Run( const std::string& sCmdFile, bool bIsolated = true) = 0 ; + virtual bool ExecLine( const std::string& sCmdLine, bool bIsolated = false) = 0 ; virtual bool AddVariable( const std::string& sName, int nVal) = 0 ; virtual bool SetVariable( const std::string& sName, int nVal) = 0 ; virtual bool GetVariable( const std::string& sName, int& nVal) = 0 ; - virtual bool EraseVariable( const std::string& sName) = 0 ; + virtual bool RemoveVariable( const std::string& sName) = 0 ; } ; //----------------------------------------------------------------------------- diff --git a/EgtLogger.h b/EgtLogger.h index 0aa85c7..17447c6 100644 --- a/EgtLogger.h +++ b/EgtLogger.h @@ -202,8 +202,8 @@ namespace egtlogger char strDate[10] = { '\0'} ; char strTime[10] = { '\0'} ; - _strdate_s( strDate, 10) ; - _strtime_s( strTime, 10) ; + _strdate_s( strDate) ; + _strtime_s( strTime) ; (*strm) << strDate << " " << strTime ;