Compare commits
26 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| cd6160b319 | |||
| f58045441d | |||
| b842032948 | |||
| 8ce22a9b4c | |||
| 4436a88b9d | |||
| 0e650a034d | |||
| e07e0e553f | |||
| df77db20d2 | |||
| a94693ba8d | |||
| 37e5a2b802 | |||
| 9415a0ff92 | |||
| 9ef479bed3 | |||
| 5a7a4c2b6d | |||
| 70a503c15a | |||
| 7d59b48f1a | |||
| d9433601ef | |||
| 093706532e | |||
| 080e12a7be | |||
| 606142c0c9 | |||
| 295d312b29 | |||
| dca079dc25 | |||
| 59c8c9f589 | |||
| 22872023b7 | |||
| 1707f324ef | |||
| 49cbf8b5f1 | |||
| 85e6a8b561 |
Binary file not shown.
+7
-7
@@ -22,14 +22,14 @@
|
|||||||
<ProjectGuid>{D216A77C-ACE6-4012-B4E1-61E5C9102E9A}</ProjectGuid>
|
<ProjectGuid>{D216A77C-ACE6-4012-B4E1-61E5C9102E9A}</ProjectGuid>
|
||||||
<Keyword>Win32Proj</Keyword>
|
<Keyword>Win32Proj</Keyword>
|
||||||
<RootNamespace>EgtGeneral</RootNamespace>
|
<RootNamespace>EgtGeneral</RootNamespace>
|
||||||
<WindowsTargetPlatformVersion>10.0.20348.0</WindowsTargetPlatformVersion>
|
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||||
<UseDebugLibraries>true</UseDebugLibraries>
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
<CharacterSet>Unicode</CharacterSet>
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
<PlatformToolset>v141_xp</PlatformToolset>
|
<PlatformToolset>v143</PlatformToolset>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||||
@@ -42,7 +42,7 @@
|
|||||||
<UseDebugLibraries>false</UseDebugLibraries>
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
<CharacterSet>Unicode</CharacterSet>
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
<PlatformToolset>v141_xp</PlatformToolset>
|
<PlatformToolset>v143</PlatformToolset>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||||
@@ -103,7 +103,7 @@
|
|||||||
<PreprocessorDefinitions>WIN32;I_AM_EGN;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>WIN32;I_AM_EGN;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||||
<OpenMPSupport>false</OpenMPSupport>
|
<OpenMPSupport>false</OpenMPSupport>
|
||||||
<LanguageStandard>stdcpp17</LanguageStandard>
|
<LanguageStandard>stdcpp20</LanguageStandard>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<SubSystem>Windows</SubSystem>
|
<SubSystem>Windows</SubSystem>
|
||||||
@@ -125,7 +125,7 @@ copy $(TargetPath) \EgtProg\DllD32</Command>
|
|||||||
<WarningLevel>Level3</WarningLevel>
|
<WarningLevel>Level3</WarningLevel>
|
||||||
<Optimization>Disabled</Optimization>
|
<Optimization>Disabled</Optimization>
|
||||||
<PreprocessorDefinitions>WIN32;I_AM_EGN;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>WIN32;I_AM_EGN;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<LanguageStandard>stdcpp17</LanguageStandard>
|
<LanguageStandard>stdcpp20</LanguageStandard>
|
||||||
<AdditionalOptions>-Wno-tautological-undefined-compare</AdditionalOptions>
|
<AdditionalOptions>-Wno-tautological-undefined-compare</AdditionalOptions>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
@@ -157,7 +157,7 @@ copy $(TargetPath) \EgtProg\DllD64</Command>
|
|||||||
<EnableFiberSafeOptimizations>true</EnableFiberSafeOptimizations>
|
<EnableFiberSafeOptimizations>true</EnableFiberSafeOptimizations>
|
||||||
<EnableParallelCodeGeneration>true</EnableParallelCodeGeneration>
|
<EnableParallelCodeGeneration>true</EnableParallelCodeGeneration>
|
||||||
<OpenMPSupport>false</OpenMPSupport>
|
<OpenMPSupport>false</OpenMPSupport>
|
||||||
<LanguageStandard>stdcpp17</LanguageStandard>
|
<LanguageStandard>stdcpp20</LanguageStandard>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<SubSystem>Windows</SubSystem>
|
<SubSystem>Windows</SubSystem>
|
||||||
@@ -190,7 +190,7 @@ copy $(TargetPath) \EgtProg\Dll32</Command>
|
|||||||
<EnableFiberSafeOptimizations>false</EnableFiberSafeOptimizations>
|
<EnableFiberSafeOptimizations>false</EnableFiberSafeOptimizations>
|
||||||
<EnableParallelCodeGeneration>true</EnableParallelCodeGeneration>
|
<EnableParallelCodeGeneration>true</EnableParallelCodeGeneration>
|
||||||
<OpenMPSupport>false</OpenMPSupport>
|
<OpenMPSupport>false</OpenMPSupport>
|
||||||
<LanguageStandard>stdcpp17</LanguageStandard>
|
<LanguageStandard>stdcpp20</LanguageStandard>
|
||||||
<AdditionalOptions>-Wno-tautological-undefined-compare</AdditionalOptions>
|
<AdditionalOptions>-Wno-tautological-undefined-compare</AdditionalOptions>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
#include "\EgtDev\Include\EGnStringUtils.h"
|
#include "\EgtDev\Include\EGnStringUtils.h"
|
||||||
#include "\EgtDev\Include\EgtStringConverter.h"
|
#include "\EgtDev\Include\EgtStringConverter.h"
|
||||||
#include <io.h>
|
#include <io.h>
|
||||||
|
#include <filesystem>
|
||||||
|
|
||||||
using namespace std ;
|
using namespace std ;
|
||||||
|
|
||||||
@@ -297,6 +298,16 @@ EraseDirectory( const string& sDir)
|
|||||||
return( ::RemoveDirectoryW( sDirW.c_str()) != FALSE) ;
|
return( ::RemoveDirectoryW( sDirW.c_str()) != FALSE) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
bool
|
||||||
|
EraseNonEmptyDirectory( const string& sDir)
|
||||||
|
{
|
||||||
|
wstring sDirW = stringtoW( sDir) ;
|
||||||
|
error_code Ec ;
|
||||||
|
uintmax_t nRes = filesystem::remove_all( sDirW, Ec) ;
|
||||||
|
return ( nRes > 0) ;
|
||||||
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
bool
|
bool
|
||||||
FindAllDirectories( const string& sDirSpec, STRVECTOR& vsDirNames)
|
FindAllDirectories( const string& sDirSpec, STRVECTOR& vsDirNames)
|
||||||
|
|||||||
+1
-1
@@ -107,7 +107,7 @@ GetOsInfo( string& sOsInfo)
|
|||||||
else
|
else
|
||||||
GetSystemInfo( &si) ;
|
GetSystemInfo( &si) ;
|
||||||
|
|
||||||
// Assegnazione dati ( solo NT, 2000, XP, Vista, 7, 8, 8.1, 10)
|
// Assegnazione dati ( solo NT, 2000, XP, Vista, 7, 8, 8.1, 10, 11)
|
||||||
if ( osvi.dwPlatformId == VER_PLATFORM_WIN32_NT) {
|
if ( osvi.dwPlatformId == VER_PLATFORM_WIN32_NT) {
|
||||||
// Nome del prodotto
|
// Nome del prodotto
|
||||||
if ( osvi.dwMajorVersion == 6 && osvi.dwMinorVersion == 2) {
|
if ( osvi.dwMajorVersion == 6 && osvi.dwMinorVersion == 2) {
|
||||||
|
|||||||
+1
-1
@@ -109,7 +109,7 @@ Scanner::GetLine( string& sLine)
|
|||||||
// incremento contatore di linee
|
// incremento contatore di linee
|
||||||
m_nLineNbr ++ ;
|
m_nLineNbr ++ ;
|
||||||
} while ( ( m_bSkipEmptyLine && sLine.empty()) ||
|
} while ( ( m_bSkipEmptyLine && sLine.empty()) ||
|
||||||
( m_bFindRem && sLine.find( m_sRemInit) == 0)) ;
|
( m_bFindRem && sLine.rfind( m_sRemInit, 0) == 0)) ;
|
||||||
m_nDeltaLineUnget = m_nLineNbr - nOldLineNbr ;
|
m_nDeltaLineUnget = m_nLineNbr - nOldLineNbr ;
|
||||||
}
|
}
|
||||||
return true ;
|
return true ;
|
||||||
|
|||||||
+68
-139
@@ -2,13 +2,13 @@
|
|||||||
// EgalTech 2013-2014
|
// EgalTech 2013-2014
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
// File : StringUtils.cpp Data : 13.01.15 Versione : 1.6a2
|
// File : StringUtils.cpp Data : 13.01.15 Versione : 1.6a2
|
||||||
// Contenuto : Implementazione delle funzioni di utilità per le stringhe.
|
// Contenuto : Implementazione delle funzioni di utilità per le stringhe.
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
// Modifiche : 20.01.13 DS Creazione modulo.
|
// Modifiche : 20.01.13 DS Creazione modulo.
|
||||||
// 02.12.13 DS Agg. FromString per Vector3d, Point3d e Point3d+W.
|
// 02.12.13 DS Agg. FromString per Vector3d, Point3d e Point3d+W.
|
||||||
// 19.01.14 DS Tokenize con Atom ora funziona su più livelli.
|
// 19.01.14 DS Tokenize con Atom ora funziona su più livelli.
|
||||||
// 17.03.14 DS Agg. CurrDateTime.
|
// 17.03.14 DS Agg. CurrDateTime.
|
||||||
// 13.01.15 DS Agg. CurrDateTime.
|
// 13.01.15 DS Agg. CurrDateTime.
|
||||||
//
|
//
|
||||||
@@ -17,7 +17,7 @@
|
|||||||
//--------------------------- Include ----------------------------------------
|
//--------------------------- Include ----------------------------------------
|
||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
#include "DllMain.h"
|
#include "DllMain.h"
|
||||||
#include "/EgtDEv/Include/EGnStringUtils.h"
|
#include "/EgtDev/Include/EGnStringUtils.h"
|
||||||
#include "/EgtDev/Include/EgtILogger.h"
|
#include "/EgtDev/Include/EgtILogger.h"
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
|
||||||
@@ -31,38 +31,35 @@ SkipSpaces( const char*& pC)
|
|||||||
++ pC ;
|
++ pC ;
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
|
||||||
static inline void
|
|
||||||
SkipSpaces( char*& pC)
|
|
||||||
{
|
|
||||||
while ( *pC == ' ' || *pC == '\t')
|
|
||||||
++ pC ;
|
|
||||||
}
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
bool
|
bool
|
||||||
FromString( const string& sVal, INTVECTOR& vnVal)
|
FromString( const string& sVal, INTVECTOR& vnVal)
|
||||||
{
|
{
|
||||||
// pulisco il vettore dei risultati
|
// pulisco il vettore dei risultati
|
||||||
vnVal.clear() ;
|
vnVal.clear() ;
|
||||||
// reset errori di conversione
|
// se stringa vuota, esco con successo (per compatibilità con versione precedente)
|
||||||
errno = 0 ;
|
if ( IsEmptyOrSpaces( sVal))
|
||||||
// ciclo sui caratteri della stringa
|
return true ;
|
||||||
const char* pStart = sVal.c_str() ;
|
// ciclo sulla stringa
|
||||||
SkipSpaces( pStart) ;
|
const char* pFirst = sVal.data() ;
|
||||||
while ( ( *pStart >= '0' && *pStart <= '9') || *pStart == '+' || *pStart == '-') {
|
while ( true) {
|
||||||
char* pStop ;
|
int nVal ;
|
||||||
int nVal = strtol( pStart, &pStop, 10) ;
|
auto answer = fast_float::from_chars_advanced( pFirst, sVal.data() + sVal.size(), nVal, FAST_FLOAT_OPTS) ;
|
||||||
vnVal.push_back( nVal) ;
|
if ( answer.ec != std::errc())
|
||||||
SkipSpaces( pStop) ;
|
|
||||||
if ( *pStop == '\0' && errno == 0)
|
|
||||||
return true ;
|
|
||||||
if ( *pStop != ',' || errno != 0)
|
|
||||||
return false ;
|
return false ;
|
||||||
pStart = pStop + 1 ;
|
vnVal.push_back( nVal) ;
|
||||||
SkipSpaces( pStart) ;
|
const char* pLast = answer.ptr ;
|
||||||
|
SkipSpaces( pLast) ;
|
||||||
|
if ( pLast[0] == '\0')
|
||||||
|
return true ;
|
||||||
|
if ( pLast[0] != ',')
|
||||||
|
return false ;
|
||||||
|
pFirst = pLast + 1 ;
|
||||||
|
SkipSpaces( pFirst) ;
|
||||||
|
if ( pFirst[0] == '\0')
|
||||||
|
return true ;
|
||||||
}
|
}
|
||||||
return ( *pStart == '\0' && errno == 0) ;
|
// posizione non raggiungibile (return inutile)
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
@@ -71,25 +68,29 @@ FromString( const string& sVal, DBLVECTOR& vdVal)
|
|||||||
{
|
{
|
||||||
// pulisco il vettore dei risultati
|
// pulisco il vettore dei risultati
|
||||||
vdVal.clear() ;
|
vdVal.clear() ;
|
||||||
// reset errori di conversione
|
// se stringa vuota, esco con successo (per compatibilità con versione precedente)
|
||||||
errno = 0 ;
|
if ( IsEmptyOrSpaces( sVal))
|
||||||
// ciclo sui caratteri della stringa
|
return true ;
|
||||||
const char* pStart = sVal.c_str() ;
|
// ciclo sulla stringa
|
||||||
SkipSpaces( pStart) ;
|
const char* pFirst = sVal.data() ;
|
||||||
while ( ( *pStart >= '0' && *pStart <= '9') ||
|
while ( true) {
|
||||||
*pStart == '+' || *pStart == '-' || *pStart == '.') {
|
double dVal ;
|
||||||
char* pStop ;
|
auto answer = fast_float::from_chars( pFirst, sVal.data() + sVal.size(), dVal, FAST_FLOAT_FMT) ;
|
||||||
double dVal = strtod( pStart, &pStop) ;
|
if ( answer.ec != std::errc())
|
||||||
vdVal.push_back( dVal) ;
|
|
||||||
SkipSpaces( pStop) ;
|
|
||||||
if ( *pStop == '\0' && errno == 0)
|
|
||||||
return true ;
|
|
||||||
if ( *pStop != ',' || errno != 0)
|
|
||||||
return false ;
|
return false ;
|
||||||
pStart = pStop + 1 ;
|
vdVal.push_back( dVal) ;
|
||||||
SkipSpaces( pStart) ;
|
const char* pLast = answer.ptr ;
|
||||||
|
SkipSpaces( pLast) ;
|
||||||
|
if ( pLast[0] == '\0')
|
||||||
|
return true ;
|
||||||
|
if ( pLast[0] != ',')
|
||||||
|
return false ;
|
||||||
|
pFirst = pLast + 1 ;
|
||||||
|
SkipSpaces( pFirst) ;
|
||||||
|
if ( pFirst[0] == '\0')
|
||||||
|
return true ;
|
||||||
}
|
}
|
||||||
return ( *pStart == '\0' && errno == 0) ;
|
// posizione non raggiungibile (return inutile)
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
@@ -101,85 +102,31 @@ FromString( const string& sVal, STRVECTOR& vsVal)
|
|||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
const string
|
const string
|
||||||
ToString( double dVal, int nPrec)
|
ToString( double dVal, int nPrec, int* pnErr)
|
||||||
{
|
{
|
||||||
const double BIG_NUMBER = 1e10 ;
|
const double BIG_NUMBER = 1e10 ;
|
||||||
const int BIG_DIGITNBR = 10 ;
|
|
||||||
const int MAX_PREC = 12 ;
|
const int MAX_PREC = 12 ;
|
||||||
|
|
||||||
// verifico la precisione
|
// verifiche (precisione e grande numero)
|
||||||
bool bCutTrailingZero = ( nPrec >= 0) ;
|
bool bCutTrailingZero = ( nPrec > 0) ;
|
||||||
nPrec = min( abs( nPrec), MAX_PREC) ;
|
nPrec = min( abs( nPrec), MAX_PREC) ;
|
||||||
|
bool bStdNbr = ( abs( dVal) < BIG_NUMBER) ;
|
||||||
|
|
||||||
// converto la mantissa
|
// converto in stringa
|
||||||
char szBuff[24] ;
|
const int nBuffSize = 32 ;
|
||||||
int nErr, nDecimal, nSign ;
|
char szBuff[nBuffSize]{} ;
|
||||||
if ( abs( dVal) < BIG_NUMBER)
|
auto Res = ( bStdNbr ? to_chars( szBuff, szBuff + nBuffSize - 1, dVal, chars_format::fixed, nPrec) :
|
||||||
nErr = _fcvt_s( szBuff, dVal, nPrec, &nDecimal, &nSign) ;
|
to_chars( szBuff, szBuff + nBuffSize - 1, dVal, chars_format::scientific)) ;
|
||||||
else
|
if ( Res.ec != std::errc()) {
|
||||||
nErr = _ecvt_s( szBuff, dVal, BIG_DIGITNBR + nPrec, &nDecimal, &nSign) ;
|
string sOut = make_error_code( Res.ec).message() ;
|
||||||
|
LOG_ERROR( GetEGnLogger(), sOut.c_str())
|
||||||
// se errore, ritorno stringa opportuna
|
if ( pnErr != nullptr)
|
||||||
if ( nErr != 0) {
|
*pnErr = int( Res.ec) ;
|
||||||
_ASSERT( 0) ;
|
|
||||||
string sErr = "ToString Error : " + ToString( nErr) ;
|
|
||||||
LOG_ERROR( GetEGnLogger(), sErr.c_str())
|
|
||||||
return "#Error" ;
|
return "#Error" ;
|
||||||
}
|
}
|
||||||
|
|
||||||
// se buffer vuoto, risultato è numero 0
|
|
||||||
if ( szBuff[0] == '\0')
|
|
||||||
return "0" ;
|
|
||||||
|
|
||||||
// verifica per forma esponenziale
|
|
||||||
int nExp ;
|
|
||||||
if ( nDecimal > BIG_DIGITNBR) {
|
|
||||||
nExp = nDecimal - 1 ;
|
|
||||||
nDecimal = 1 ;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
nExp = 0 ;
|
|
||||||
|
|
||||||
// puntatori a inizio stringhe
|
|
||||||
char szDest[32] ;
|
|
||||||
char* pBuff = szBuff ;
|
|
||||||
char* pDest = szDest ;
|
|
||||||
// eventuale inserimento segno '-'
|
|
||||||
if ( nSign != 0) {
|
|
||||||
*pDest = '-' ;
|
|
||||||
pDest ++ ;
|
|
||||||
} ;
|
|
||||||
// gestione decimali dopo 0
|
|
||||||
if ( nDecimal <= 0) {
|
|
||||||
*pDest = '0' ;
|
|
||||||
pDest ++ ;
|
|
||||||
*pDest = '.' ;
|
|
||||||
pDest ++ ;
|
|
||||||
for ( ; nDecimal < 0 ; nDecimal ++) {
|
|
||||||
*pDest = '0' ;
|
|
||||||
pDest ++ ;
|
|
||||||
}
|
|
||||||
nDecimal -- ;
|
|
||||||
}
|
|
||||||
// gestione cifre e .
|
|
||||||
while ( *pBuff != '\0') {
|
|
||||||
if ( *pBuff == '#') { // NAN, INFINITY, INDEFINITE
|
|
||||||
_ASSERT( 0) ;
|
|
||||||
string sErr = "ToString Error : " + string( szBuff) ;
|
|
||||||
LOG_ERROR( GetEGnLogger(), sErr.c_str())
|
|
||||||
}
|
|
||||||
if ( nDecimal == 0) {
|
|
||||||
*pDest = '.' ;
|
|
||||||
pDest ++ ;
|
|
||||||
}
|
|
||||||
nDecimal -- ;
|
|
||||||
*pDest = *pBuff ;
|
|
||||||
pDest ++ ;
|
|
||||||
pBuff ++ ;
|
|
||||||
}
|
|
||||||
*pDest = '\0' ;
|
|
||||||
// se abilitato e inserito un punto decimale tolgo i trailing zero
|
// se abilitato e inserito un punto decimale tolgo i trailing zero
|
||||||
if ( bCutTrailingZero && nDecimal < 0) {
|
if ( bCutTrailingZero && bStdNbr) {
|
||||||
|
char* pDest = Res.ptr ;
|
||||||
pDest -- ;
|
pDest -- ;
|
||||||
while ( *pDest == '0') {
|
while ( *pDest == '0') {
|
||||||
*pDest = '\0' ;
|
*pDest = '\0' ;
|
||||||
@@ -187,33 +134,15 @@ ToString( double dVal, int nPrec)
|
|||||||
}
|
}
|
||||||
if ( *pDest == '.')
|
if ( *pDest == '.')
|
||||||
*pDest = '\0' ;
|
*pDest = '\0' ;
|
||||||
else
|
|
||||||
pDest ++ ;
|
|
||||||
}
|
|
||||||
// aggiungo eventuale esponente (sempre compreso tra 9 e 308)
|
|
||||||
if ( nExp > 0) {
|
|
||||||
*pDest = 'e' ;
|
|
||||||
pDest ++ ;
|
|
||||||
int nTmp = nExp ;
|
|
||||||
if ( nTmp >= 100) {
|
|
||||||
*pDest = '0' + ( nTmp / 100) ;
|
|
||||||
pDest ++ ;
|
|
||||||
nTmp = nTmp % 100 ;
|
|
||||||
}
|
|
||||||
if ( nTmp >= 10 || nExp >= 100) {
|
|
||||||
*pDest = '0' + ( nTmp / 10) ;
|
|
||||||
pDest ++ ;
|
|
||||||
nTmp = nTmp % 10 ;
|
|
||||||
}
|
|
||||||
*pDest = '0' + nTmp ;
|
|
||||||
pDest ++ ;
|
|
||||||
*pDest = '\0' ;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( szDest[0] == '-' && szDest[1] == '0' && szDest[2] == '\0')
|
if ( pnErr != nullptr)
|
||||||
|
*pnErr = 0 ;
|
||||||
|
|
||||||
|
if ( szBuff[0] == '-' && szBuff[1] == '0' && szBuff[2] == '\0')
|
||||||
return "0" ;
|
return "0" ;
|
||||||
else
|
else
|
||||||
return szDest ;
|
return szBuff ;
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
@@ -354,7 +283,7 @@ Tokenize( const string& sString, const string& sSeparators,
|
|||||||
return false ;
|
return false ;
|
||||||
// pulisco il risultato
|
// pulisco il risultato
|
||||||
vsTokens.clear() ;
|
vsTokens.clear() ;
|
||||||
// se la stringa è vuota non c'è niente da cercare
|
// se la stringa è vuota non c'è niente da cercare
|
||||||
if ( sString.empty())
|
if ( sString.empty())
|
||||||
return true ;
|
return true ;
|
||||||
// parto dall'inizio
|
// parto dall'inizio
|
||||||
@@ -388,7 +317,7 @@ Tokenize( const string& sString, const string& sSeparators,
|
|||||||
else
|
else
|
||||||
++ iPosEnd ;
|
++ iPosEnd ;
|
||||||
}
|
}
|
||||||
// se è rimasto un ultimo token
|
// se è rimasto un ultimo token
|
||||||
if ( iPosStart != string::npos)
|
if ( iPosStart != string::npos)
|
||||||
vsTokens.push_back( sString.substr( iPosStart)) ;
|
vsTokens.push_back( sString.substr( iPosStart)) ;
|
||||||
return true ;
|
return true ;
|
||||||
|
|||||||
Reference in New Issue
Block a user