Include :

- aggiornamento interfacce
- aggiunta interfaccia per oggetti Testo
- aggiunta funzione di Decode di UTF-8.
This commit is contained in:
Dario Sassi
2014-06-03 13:23:04 +00:00
parent f996edd33b
commit 3581e55404
14 changed files with 266 additions and 21 deletions
+4 -2
View File
@@ -1,7 +1,7 @@
//----------------------------------------------------------------------------
// EgalTech 2013-2013
// EgalTech 2013-2014
//----------------------------------------------------------------------------
// File : EgkDllMain.h Data : 18.12.13 Versione : 1.4l2
// File : EgkDllMain.h Data : 29.05.14 Versione : 1.5e10
// Contenuto : Prototipi funzioni generali della DLL.
//
//
@@ -29,3 +29,5 @@ class ILogger ;
EGK_EXPORT const char* GetEGkVersion( void) ;
// permette di impostare il logger per la Dll
EGK_EXPORT void SetEGkLogger( ILogger* pLogger) ;
// permette di inizializzare il font manager
EGK_EXPORT void InitFontManager( const std::string& sNfeFontDir, const std::string& sDefaultFont) ;
+61
View File
@@ -0,0 +1,61 @@
//----------------------------------------------------------------------------
// EgalTech 2014-2014
//----------------------------------------------------------------------------
// File : EGkExtText.h Data : 28.05.14 Versione : 1.5e10
// Contenuto : Dichiarazione della interfaccia IExtText.
//
//
//
// Modifiche : 28.05.14 DS Creazione modulo.
//
//
//----------------------------------------------------------------------------
#pragma once
#include "/EgtDev/Include/EGkGeoObj.h"
#include "/EgtDev/Include/EGkCurve.h"
//-----------------------------------------------------------------------------
class __declspec( novtable) IExtText : public IGeoObj
{
public :
virtual bool Copy( const IGeoObj* pGObjSrc) = 0 ;
virtual bool Set( const std::string& sText, const Point3d& ptP, double dAngDeg, double dH) = 0 ;
virtual bool Set( const std::string& sText, const Point3d& ptP, double dAngDeg,
const std::string& sFont, int nW, bool bItl, double dH, double dRat, double dAddAdv) = 0 ;
virtual const Point3d& GetPoint( void) const = 0 ;
virtual const Vector3d& GetNormVersor( void) const = 0 ;
virtual const Vector3d& GetDirVersor( void) const = 0 ;
virtual const std::string& GetText( void) const = 0 ;
virtual const std::string& GetFont( void) const = 0 ;
virtual int GetWeight( void) const = 0 ;
virtual bool GetItalic( void) const = 0 ;
virtual double GetHeight( void) const = 0 ;
virtual double GetRatio( void) const = 0 ;
virtual double GetAddAdvance( void) const = 0 ;
virtual bool GetStartPoint( Point3d& ptStart) const = 0 ;
virtual bool GetEndPoint( Point3d& ptEnd) const = 0 ;
virtual bool GetMidPoint( Point3d& ptMid) const = 0 ;
virtual bool GetCenterPoint( Point3d& ptCen) const = 0 ;
virtual bool GetOutline( ICURVEPLIST& lstPC) const = 0 ;
virtual bool ApproxWithLines( double dLinTol, double dAngTolDeg, POLYLINELIST& lstPL) const = 0 ;
virtual bool Flip( void) = 0 ;
virtual bool Mir( bool bOnLen) = 0 ;
} ;
//-----------------------------------------------------------------------------
inline IExtText* CreateExtText( void)
{ return (static_cast<IExtText*>( CreateGeoObj( EXT_TEXT))) ; }
inline IExtText* CloneExtText( const IGeoObj* pGObj)
{ if ( pGObj == nullptr || pGObj->GetType() != EXT_TEXT)
return nullptr ;
return (static_cast<IExtText*>(pGObj->Clone())) ; }
inline const IExtText* GetExtText( const IGeoObj* pGObj)
{ if ( pGObj == nullptr || pGObj->GetType() != EXT_TEXT)
return nullptr ;
return (static_cast<const IExtText*>(pGObj)) ; }
inline IExtText* GetExtText( IGeoObj* pGObj)
{ if ( pGObj == nullptr || pGObj->GetType() != EXT_TEXT)
return nullptr ;
return (static_cast<IExtText*>(pGObj)) ; }
+5 -3
View File
@@ -1,7 +1,7 @@
//----------------------------------------------------------------------------
// EgalTech 2013-2013
// EgalTech 2013-2014
//----------------------------------------------------------------------------
// File : EgkFrame3d.h Data : 20.11.13 Versione : 1.3a1
// File : EgkFrame3d.h Data : 30.05.14 Versione : 1.5e10
// Contenuto : Dichiarazione della classe Reference Frame 3d.
//
//
@@ -40,13 +40,15 @@ class EGK_EXPORT Frame3d
const Vector3d& vtDirY, const Vector3d& vtDirZ) ;
bool Set( const Point3d& ptOrig, const Point3d& ptOnX, const Point3d& ptNearY) ;
bool Set( const Point3d& ptOrig, const Vector3d& vtDirZ) ;
bool Set( const Point3d& ptOrig, const Vector3d& vtDirZ, const Vector3d& vtNearDirX) ;
bool Set( const Point3d& ptOrig, Type nType) ;
bool Reset( void) ;
void Translate( const Vector3d& vtMove) ;
bool Rotate( const Point3d& ptAx, const Vector3d& vtAx, double dAngDeg) ;
bool Rotate( const Point3d& ptAx, const Vector3d& vtAx, double dCosAng, double dSinAng) ;
bool Rotate( const Point3d& ptAx, const Vector3d& vtAx, double dAngRad) ;
bool PseudoScale( const Frame3d& frRef, double dCoeffX, double dCoeffY, double dCoeffZ) ;
bool PseudoMirror( const Point3d& ptOn, const Vector3d& vtNorm) ;
bool PseudoShear( const Point3d& ptOn, const Vector3d& vtNorm, const Vector3d& vtDir, double dCoeff) ;
bool Invert( void) ;
bool ToGlob( const Frame3d& frRef) ;
bool ToLoc( const Frame3d& frRef) ;
+12
View File
@@ -82,7 +82,19 @@ class __declspec( novtable) IGdbIterator
virtual bool ExistsName( void) const = 0 ;
virtual bool RemoveName( void) = 0 ;
virtual bool SetInfo( const std::string& sKey, const std::string& sInfo) = 0 ;
virtual bool SetInfo( const std::string& sKey, bool bInfo) = 0 ;
virtual bool SetInfo( const std::string& sKey, int nInfo) = 0 ;
virtual bool SetInfo( const std::string& sKey, double dInfo) = 0 ;
virtual bool SetInfo( const std::string& sKey, const Point3d& ptInfo) = 0 ;
virtual bool SetInfo( const std::string& sKey, const Vector3d& vtInfo) = 0 ;
virtual bool SetInfo( const std::string& sKey, const Frame3d& frInfo) = 0 ;
virtual bool GetInfo( const std::string& sKey, std::string& sInfo) const = 0 ;
virtual bool GetInfo( const std::string& sKey, bool& bInfo) const = 0 ;
virtual bool GetInfo( const std::string& sKey, int& nInfo) const = 0 ;
virtual bool GetInfo( const std::string& sKey, double& dInfo) const = 0 ;
virtual bool GetInfo( const std::string& sKey, Point3d& ptInfo) const = 0 ;
virtual bool GetInfo( const std::string& sKey, Vector3d& vtInfo) const = 0 ;
virtual bool GetInfo( const std::string& sKey, Frame3d& frInfo) const = 0 ;
virtual bool ExistsInfo( const std::string& sKey) const = 0 ;
virtual bool RemoveInfo( const std::string& sKey) = 0 ;
} ;
+3 -1
View File
@@ -41,12 +41,14 @@ class __declspec( novtable) IGeoObj
virtual bool GetLocalBBox( BBox3d& b3Loc) const = 0 ;
virtual bool GetBBox( const Frame3d& frRef, BBox3d& b3Ref) const = 0 ;
virtual bool Translate( const Vector3d& vtMove) = 0 ;
virtual bool Rotate( const Point3d& ptAx, const Vector3d& vtAx, double dAngDeg) = 0 ;
virtual bool Rotate( const Point3d& ptAx, const Vector3d& vtAx, double dCosAng, double dSinAng) = 0 ;
virtual bool Rotate( const Point3d& ptAx, const Vector3d& vtAx, double dAngRad) = 0 ;
virtual bool Scale( const Frame3d& frRef, double dCoeffX, double dCoeffY, double dCoeffZ) = 0 ;
virtual bool Mirror( const Point3d& ptOn, const Vector3d& vtNorm) = 0 ;
virtual bool Shear( const Point3d& ptOn, const Vector3d& vtNorm, const Vector3d& vtDir, double dCoeff) = 0 ;
virtual bool ToGlob( const Frame3d& frRef) = 0 ;
virtual bool ToLoc( const Frame3d& frRef) = 0 ;
virtual bool LocToLoc( const Frame3d& frOri, const Frame3d& frDest) = 0 ;
virtual void SetObjGraphics( IObjGraphics* pOGr) = 0 ;
virtual IObjGraphics* GetObjGraphics( void) = 0 ;
virtual const IObjGraphics* GetObjGraphics( void) const = 0 ;
+6 -4
View File
@@ -1,13 +1,13 @@
//----------------------------------------------------------------------------
// EgalTech 2013-2013
// EgalTech 2013-2014
//----------------------------------------------------------------------------
// File : EGkGeoObjType.h Data : 21.11.13 Versione : 1.3a1
// File : EGkGeoObjType.h Data : 27.05.14 Versione : 1.5e10
// Contenuto : Definizione Tipo degli Oggetti Geometrici.
//
//
//
// Modifiche : 30.04.13 DS Creazione modulo.
//
// 27.05.14 DS Agg. EXT_TEXT.
//
//----------------------------------------------------------------------------
@@ -19,6 +19,7 @@
const int GEO_ZERODIM = 0x080 ;
const int GEO_CURVE = 0x100 ;
const int GEO_SURF = 0x200 ;
const int GEO_EXTRA = 0x400 ;
//----------------- Costanti tipo oggetto geometrico --------------------------
enum GeoObjType { GEO_NONE = 0,
@@ -29,4 +30,5 @@ enum GeoObjType { GEO_NONE = 0,
CRV_ARC = ( GEO_CURVE + 1),
CRV_BEZ = ( GEO_CURVE + 2),
CRV_COMPO = ( GEO_CURVE + 3),
SRF_TRIMESH = ( GEO_SURF + 0)} ;
SRF_TRIMESH = ( GEO_SURF + 0),
EXT_TEXT = ( GEO_EXTRA + 0)} ;
+21 -5
View File
@@ -1,7 +1,7 @@
//----------------------------------------------------------------------------
// EgalTech 2013-2014
//----------------------------------------------------------------------------
// File : EGkGeomDB.h Data : 21.05.14 Versione : 1.5e8
// File : EGkGeomDB.h Data : 30.05.14 Versione : 1.5e10
// Contenuto : Dichiarazione della interfaccia IGeomDB.
//
//
@@ -9,6 +9,7 @@
// Modifiche : 24.11.13 DS Creazione modulo.
// 26.04.14 DS Agg. gestione libreria materiali.
// 21.05.14 DS Agg. GotoFirst/Next/Last/Prev.
// 30.05.14 DS Agg. metodi di Shear.
//
//----------------------------------------------------------------------------
@@ -58,10 +59,10 @@ class __declspec( novtable) IGeomDB
virtual bool GetLocalBBox( int nId, BBox3d& b3Loc, int nFlag = BBF_NONE) const = 0 ;
virtual bool GetGlobalBBox( int nId, BBox3d& b3Glob, int nFlag = BBF_NONE) const = 0 ;
virtual bool GetRefBBox( int nId, const Frame3d& frRef, BBox3d& b3Ref, int nFlag = BBF_NONE) const = 0 ;
virtual int Copy( int nIdSou, int nIdDest, int nParentIdDest) = 0 ;
virtual int CopyGlob( int nIdSou, int nIdDest, int nParentIdDest) = 0 ;
virtual bool Relocate( int nId, int nNewParentId) = 0 ;
virtual bool RelocateGlob( int nId, int nNewParentId) = 0 ;
virtual int Copy( int nIdSou, int nIdDest, int nRefId, int nSonBeforeAfter = GDB_SON) = 0 ;
virtual int CopyGlob( int nIdSou, int nIdDest, int nRefId, int nSonBeforeAfter = GDB_SON) = 0 ;
virtual bool Relocate( int nId, int nRefId, int nSonBeforeAfter = GDB_SON) = 0 ;
virtual bool RelocateGlob( int nId, int nRefId, int nSonBeforeAfter = GDB_SON) = 0 ;
virtual bool Erase( int nId) = 0 ;
virtual bool Translate( int nId, const Vector3d& vtMove) = 0 ;
virtual bool TranslateGlob( int nId, const Vector3d& vtMove) = 0 ;
@@ -78,6 +79,9 @@ class __declspec( novtable) IGeomDB
virtual bool Mirror( int nId, const Point3d& ptOn, const Vector3d& vtNorm) = 0 ;
virtual bool MirrorGlob( int nId, const Point3d& ptOn, const Vector3d& vtNorm) = 0 ;
virtual bool MirrorGroup( int nId, const Point3d& ptOn, const Vector3d& vtNorm) = 0 ;
virtual bool Shear( int nId, const Point3d& ptOn, const Vector3d& vtNorm, const Vector3d& vtDir, double dCoeff) = 0 ;
virtual bool ShearGlob( int nId, const Point3d& ptOn, const Vector3d& vtNorm, const Vector3d& vtDir, double dCoeff) = 0 ;
virtual bool ShearGroup( int nId, const Point3d& ptOn, const Vector3d& vtNorm, const Vector3d& vtDir, double dCoeff) = 0 ;
// selection
virtual bool SelectObj( int nId) = 0 ;
virtual bool DeselectObj( int nId) = 0 ;
@@ -122,7 +126,19 @@ class __declspec( novtable) IGeomDB
virtual bool ExistsName( int nId) const = 0 ;
virtual bool RemoveName( int nId) = 0 ;
virtual bool SetInfo( int nId, const std::string& sKey, const std::string& sInfo) = 0 ;
virtual bool SetInfo( int nId, const std::string& sKey, bool bInfo) = 0 ;
virtual bool SetInfo( int nId, const std::string& sKey, int nInfo) = 0 ;
virtual bool SetInfo( int nId, const std::string& sKey, double dInfo) = 0 ;
virtual bool SetInfo( int nId, const std::string& sKey, const Point3d& ptInfo) = 0 ;
virtual bool SetInfo( int nId, const std::string& sKey, const Vector3d& vtInfo) = 0 ;
virtual bool SetInfo( int nId, const std::string& sKey, const Frame3d& frInfo) = 0 ;
virtual bool GetInfo( int nId, const std::string& sKey, std::string& sInfo) const = 0 ;
virtual bool GetInfo( int nId, const std::string& sKey, bool& bInfo) const = 0 ;
virtual bool GetInfo( int nId, const std::string& sKey, int& nInfo) const = 0 ;
virtual bool GetInfo( int nId, const std::string& sKey, double& dInfo) const = 0 ;
virtual bool GetInfo( int nId, const std::string& sKey, Point3d& ptInfo) const = 0 ;
virtual bool GetInfo( int nId, const std::string& sKey, Vector3d& vtInfo) const = 0 ;
virtual bool GetInfo( int nId, const std::string& sKey, Frame3d& frInfo) const = 0 ;
virtual bool ExistsInfo( int nId, const std::string& sKey) const = 0 ;
virtual bool RemoveInfo( int nId, const std::string& sKey) = 0 ;
// material library
+4 -3
View File
@@ -1,7 +1,7 @@
//----------------------------------------------------------------------------
// EgalTech 2013-2013
// EgalTech 2013-2014
//----------------------------------------------------------------------------
// File : EGkPoint3d.h Data : 20.11.13 Versione : 1.3a1
// File : EGkPoint3d.h Data : 30.05.14 Versione : 1.5e10
// Contenuto : Dichiarazione della classe Punto 3d.
//
//
@@ -56,10 +56,11 @@ class EGK_EXPORT Point3d
const Point3d& operator /=( double dDiv)
{ double dMul = 1 / dDiv ; this->x *= dMul ; this->y *= dMul ; this->z *= dMul ; return *this ; }
void Translate( const Vector3d& vtMove) ;
bool Rotate( const Point3d& ptAx, const Vector3d& vtAx, double dAngRad) ;
bool Rotate( const Point3d& ptAx, const Vector3d& vtAx, double dAngDeg) ;
bool Rotate( const Point3d& ptAx, const Vector3d& vtAx, double dCosAng, double dSinAng) ;
bool Scale( const Frame3d& frRef, double dCoeffX, double dCoeffY, double dCoeffZ) ;
bool Mirror( const Point3d& ptOn, const Vector3d& vtNorm) ;
bool Shear( const Point3d& ptOn, const Vector3d& vtNorm, const Vector3d& vtDir, double dCoeff) ;
bool ToGlob( const Frame3d& frRef) ;
bool ToLoc( const Frame3d& frRef) ;
bool LocToLoc( const Frame3d& frOri, const Frame3d& frDest) ;
+16
View File
@@ -37,6 +37,17 @@ class PolyLine
EGK_EXPORT bool EraseFirstUPoint( void) ;
EGK_EXPORT bool EraseLastUPoint( void) ;
EGK_EXPORT bool AddOffsetToU( double dOffset) ;
EGK_EXPORT bool Translate( const Vector3d& vtMove) ;
EGK_EXPORT bool Rotate( const Point3d& ptAx, const Vector3d& vtAx, double dAngDeg)
{ double dAngRad = dAngDeg * DEGTORAD ;
return Rotate( ptAx, vtAx, cos( dAngRad), sin( dAngRad)) ; }
EGK_EXPORT bool Rotate( const Point3d& ptAx, const Vector3d& vtAx, double dCosAng, double dSinAng) ;
EGK_EXPORT bool Scale( const Frame3d& frRef, double dCoeffX, double dCoeffY, double dCoeffZ) ;
EGK_EXPORT bool Mirror( const Point3d& ptOn, const Vector3d& vtNorm) ;
EGK_EXPORT bool Shear( const Point3d& ptOn, const Vector3d& vtNorm, const Vector3d& vtDir, double dCoeff) ;
EGK_EXPORT bool ToGlob( const Frame3d& frRef) ;
EGK_EXPORT bool ToLoc( const Frame3d& frRef) ;
EGK_EXPORT bool LocToLoc( const Frame3d& frOri, const Frame3d& frDest) ;
EGK_EXPORT bool Splice( PolyLine& PL) ;
EGK_EXPORT bool IsClosed( void) const ;
EGK_EXPORT int GetPointNbr( void) const
@@ -81,3 +92,8 @@ class PolyLine
UPNTLIST m_lUPoints ;
mutable UPNTLIST::const_iterator m_iter ;
} ;
//----------------------------------------------------------------------------
// Raccolte di PolyLine
typedef std::vector<PolyLine> POLYLINEVECTOR ; // vettore di PolyLine
typedef std::list<PolyLine> POLYLINELIST ; // lista di PolyLine
+4 -3
View File
@@ -1,7 +1,7 @@
//----------------------------------------------------------------------------
// EgalTech 2013-2013
// EgalTech 2013-2014
//----------------------------------------------------------------------------
// File : EgkVector3d.h Data : 20.11.13 Versione : 1.3a1
// File : EgkVector3d.h Data : 30.05.14 Versione : 1.5e10
// Contenuto : Dichiarazione della classe Vettore 3d.
//
//
@@ -73,10 +73,11 @@ class EGK_EXPORT Vector3d
{ double dMul = 1 / dDiv ; this->x *= dMul ; this->y *= dMul ; this->z *= dMul ; return *this ; }
void ToSpherical( double* pdLen, double* pdAngVertDeg, double* pdAngOrizzDeg) const ;
bool Normalize( double dEps = EPS_SMALL) ;
bool Rotate( const Vector3d& vtAx, double dAngRad) ;
bool Rotate( const Vector3d& vtAx, double dAngDeg) ;
bool Rotate( const Vector3d& vtAx, double dCosAng, double dSinAng) ;
bool Scale( const Frame3d& frRef, double dCoeffX, double dCoeffY, double dCoeffZ) ;
bool Mirror( const Vector3d& vtNorm) ;
bool Shear( const Vector3d& vtNorm, const Vector3d& vtDir, double dCoeff) ;
bool ToGlob( const Frame3d& frRef) ;
bool ToLoc( const Frame3d& frRef) ;
bool LocToLoc( const Frame3d& frOri, const Frame3d& frDest) ;
+118
View File
@@ -0,0 +1,118 @@
//----------------------------------------------------------------------------
// EgalTech 2014-2014
//----------------------------------------------------------------------------
// File : EgnStringDecoder.h Data : 01.06.14 Versione : 1.5f1
// Contenuto : Insieme di funzioni per decodificare stringhe UTF-8.
//
//
//
// Modifiche : 01.06.14 DS Creazione modulo.
//
//
//----------------------------------------------------------------------------
#pragma once
#include "/EgtDev/Include/EGnStringBase.h"
#include "/EgtDev/Include/EGtNumCollection.h"
//-----------------------------------------------------------------------------
typedef unsigned char uint8_t ;
typedef unsigned int uint32_t ;
//-----------------------------------------------------------------------------
const uint32_t UTF8_ACCEPT = 0 ;
const uint32_t UTF8_REJECT = 12 ;
//-----------------------------------------------------------------------------
// Copyright (c) 2008-2010 Bjoern Hoehrmann <bjoern@hoehrmann.de>
// See http://bjoern.hoehrmann.de/utf-8/decoder/dfa/ for details.
//-----------------------------------------------------------------------------
static const uint8_t utf8d[] = {
// The first part of the table maps bytes to character classes that
// to reduce the size of the transition table and create bitmasks.
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,
7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
8,8,2,2,2,2,2,2,2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
10,3,3,3,3,3,3,3,3,3,3,3,3,4,3,3, 11,6,6,6,5,8,8,8,8,8,8,8,8,8,8,8,
// The second part is a transition table that maps a combination
// of a state of the automaton and a character class to a state.
0,12,24,36,60,96,84,12,12,12,48,72, 12,12,12,12,12,12,12,12,12,12,12,12,
12, 0,12,12,12,12,12, 0,12, 0,12,12, 12,24,12,12,12,12,12,24,12,24,12,12,
12,12,12,12,12,12,12,24,12,12,12,12, 12,24,12,12,12,12,12,12,12,24,12,12,
12,12,12,12,12,12,12,36,12,36,12,12, 12,36,12,12,12,12,12,36,12,36,12,12,
12,36,12,12,12,12,12,12,12,12,12,12
} ;
//-----------------------------------------------------------------------------
uint32_t inline
decode( uint32_t* state, uint32_t* codep, uint8_t byte)
{
uint32_t type = utf8d[byte] ;
*codep = (*state != UTF8_ACCEPT) ?
(byte & 0x3fu) | (*codep << 6) :
(0xff >> type) & (byte) ;
*state = utf8d[ 256 + *state + type] ;
return *state ;
}
//-----------------------------------------------------------------------------
bool inline
CountCodePoints( const std::string& sString, int& nCount)
{
// inizializzo numero caratteri
nCount = 0 ;
// ciclo sui byte della stringa UTF-8
uint32_t codepoint ;
uint32_t state = UTF8_ACCEPT ;
for ( unsigned int i = 0 ; i < sString.length() ; ++ i) {
if ( ! decode( &state, &codepoint, sString[i]))
++ nCount ;
}
return ( state == UTF8_ACCEPT) ;
}
//-----------------------------------------------------------------------------
bool inline
GetCodePoints( const std::string& sString, UINTVECTOR& vCode)
{
// pulisco vettore di codici da restituire
vCode.reserve( sString.length()) ;
vCode.clear() ;
// ciclo sui byte della stringa UTF-8
bool bOk = true ;
uint32_t codepoint ;
uint32_t state = UTF8_ACCEPT ;
uint32_t stPrev = UTF8_ACCEPT ;
for ( unsigned int i = 0 ; i < sString.length() ; ++ i) {
switch ( decode( &state, &codepoint, sString[i])) {
case UTF8_ACCEPT :
// A properly encoded character has been found.
vCode.push_back( codepoint) ;
break ;
case UTF8_REJECT :
// The byte is invalid, replace it and restart.
vCode.push_back( 0xFFFD) ;
bOk = false ;
state = UTF8_ACCEPT ;
if ( stPrev != UTF8_ACCEPT)
-- i ;
break ;
}
stPrev = state ;
}
return bOk ;
}
+5
View File
@@ -56,3 +56,8 @@ inline ICurve* GetCurve( IGeoObj* pGObj)
{ if ( pGObj == nullptr || ( pGObj->GetType() & GEO_CURVE) == 0)
return nullptr ;
return (static_cast<ICurve*>(pGObj)) ; }
//----------------------------------------------------------------------------
// Raccolte di puntatori a ICurve
typedef std::vector<ICurve*> ICURVEPVECTOR ; // vettore di puntatori a ICurve
typedef std::list<ICurve*> ICURVEPLIST ; // lista di puntatori a ICurve
+2
View File
@@ -25,5 +25,7 @@
#endif
//-----------------------------------------------------------------------------
EGN_EXPORT bool ExistsFile( const std::string& sFile) ;
EGN_EXPORT bool EraseFile( const std::string& sFile) ;
EGN_EXPORT bool FileExtensionMatches( const std::string& sFile, const std::string& sExt) ;
EGN_EXPORT bool EmptyDirectory( const std::string& sDir) ;
+5
View File
@@ -21,6 +21,11 @@
typedef std::vector<int> INTVECTOR ; // vettore di interi
typedef std::list<int> INT_LIST ; // lista di interi (con _ per non collidere con Win)
//----------------------------------------------------------------------------
// Raccolte di interi senza segno
typedef std::vector<unsigned int> UINTVECTOR ; // vettore di interi senza segno
typedef std::list<unsigned int> UINT_LIST ; // lista di interi senza segno (con _ per non collidere con Win)
//----------------------------------------------------------------------------
// Raccolte di double
typedef std::vector<double> DBLVECTOR ; // vettore di double