Include :
- modifica prototipi per funzioni redis - aggiunta funzione GetValInNotes con parametro aggiuntivo.
This commit is contained in:
+39
-4
@@ -101,14 +101,14 @@ GetVal( const std::string& sString, const std::string& sKey, T& Val)
|
||||
inline bool
|
||||
SetValInNotes( const std::string& sKey, const std::string& sVal, std::string& sNotes)
|
||||
{
|
||||
// verifiche validità chiave
|
||||
// verifiche validità chiave
|
||||
if ( ! IsValidKey( sKey) || ! IsValidVal( sVal))
|
||||
return false ;
|
||||
// chiave con carattere finale speciale
|
||||
std::string sTkey = sKey ;
|
||||
if ( sKey.back() != COLON)
|
||||
sTkey += EQUAL ;
|
||||
// ricerca se già presente
|
||||
// ricerca se già presente
|
||||
STRVECTOR vsTokens ;
|
||||
Tokenize( sNotes, ";", vsTokens) ;
|
||||
bool bFound = false ;
|
||||
@@ -143,7 +143,7 @@ SetValInNotes( const std::string& sKey, T& Val, std::string& sNotes)
|
||||
inline bool
|
||||
GetValInNotes( const std::string& sNotes, const std::string& sKey, std::string& sVal)
|
||||
{
|
||||
// verifiche validità chiave
|
||||
// verifiche validità chiave
|
||||
if ( sNotes.empty() || ! IsValidKey( sKey))
|
||||
return false ;
|
||||
// chiave con carattere finale speciale
|
||||
@@ -171,11 +171,46 @@ GetValInNotes( const std::string& sNotes, const std::string& sKey, T& Val)
|
||||
return ( GetValInNotes( sNotes, sKey, sVal) && FromString( sVal, Val)) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
inline bool
|
||||
GetValInNotes( const std::string& sNotes, const std::string& sKey, const std::string& sToken, std::string& sVal)
|
||||
{
|
||||
// verifiche validità chiave
|
||||
if ( sNotes.empty() || ! IsValidKey( sKey))
|
||||
return false ;
|
||||
// verifiche validità del token
|
||||
if ( sToken.empty())
|
||||
return false ;
|
||||
// chiave con carattere finale speciale
|
||||
std::string sTkey = sKey ;
|
||||
if ( sKey.back() != COLON)
|
||||
sTkey += EQUAL ;
|
||||
// ricerca
|
||||
STRVECTOR vsTokens ;
|
||||
Tokenize( sNotes, sToken, vsTokens) ;
|
||||
for ( const auto& sToken : vsTokens) {
|
||||
if ( FindKey( sToken, sTkey, true)) {
|
||||
sVal = sToken.substr( sTkey.length()) ;
|
||||
return true ;
|
||||
}
|
||||
}
|
||||
return false ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
template <class T>
|
||||
inline bool
|
||||
GetValInNotes( const std::string& sNotes, const std::string& sKey, const std::string& sToken, T& Val)
|
||||
{
|
||||
std::string sVal ;
|
||||
return ( GetValInNotes( sNotes, sKey, sToken, sVal) && FromString( sVal, Val)) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
inline bool
|
||||
RemoveValInNotes( const std::string& sKey, std::string& sNotes)
|
||||
{
|
||||
// verifiche validità chiave
|
||||
// verifiche validità chiave
|
||||
if ( sNotes.empty() || ! IsValidKey( sKey))
|
||||
return false ;
|
||||
// chiave con carattere finale speciale
|
||||
|
||||
Reference in New Issue
Block a user