From b84120127c21e6be693f554d7f170b73faacc09d Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Mon, 2 Jun 2008 14:40:27 +0000 Subject: Added another helper to Bu::TafGroup, very handy...something happened to the logger...I guess. --- src/logger.cpp | 3 +++ src/tafnode.cpp | 13 +++++++++++++ src/tafnode.h | 2 ++ 3 files changed, 18 insertions(+) diff --git a/src/logger.cpp b/src/logger.cpp index af529f5..8cba1b9 100644 --- a/src/logger.cpp +++ b/src/logger.cpp @@ -155,6 +155,9 @@ void Bu::Logger::hexDump( uint32_t nLevel, const char *sFile, const char *sFunction, int nLine, const void *pDataV, long nDataLen, const char *lpName ) { + if( (nLevel&nLevelMask) == 0 ) + return; + log( nLevel, sFile, sFunction, nLine, "Displaying %ld bytes of %s.", nDataLen, lpName ); const unsigned char *pData = (const unsigned char *)pDataV; int j = 0; diff --git a/src/tafnode.cpp b/src/tafnode.cpp index 6883b97..bdd96d7 100644 --- a/src/tafnode.cpp +++ b/src/tafnode.cpp @@ -127,6 +127,19 @@ const Bu::FString &Bu::TafGroup::getProperty( const Bu::FString &sName ) const return hProp.get( sName ).first(); } +const Bu::FString &Bu::TafGroup::getProperty( const Bu::FString &sName, + const Bu::FString &sDef ) const +{ + try + { + return getProperty( sName ); + } + catch( Bu::HashException &e ) + { + return sDef; + } +} + Bu::TafProperty::TafProperty( const Bu::FString &sName, const Bu::FString &sValue ) : TafNode( typeProperty ), sName( sName ), diff --git a/src/tafnode.h b/src/tafnode.h index d76fae9..9f80781 100644 --- a/src/tafnode.h +++ b/src/tafnode.h @@ -61,6 +61,8 @@ namespace Bu void setName( const Bu::FString &sName ); const Bu::FString &getProperty( const Bu::FString &sName ) const; + const Bu::FString &getProperty( const Bu::FString &sName, + const Bu::FString &sDef ) const; const PropList &getProperties( const Bu::FString &sName ) const; const TafGroup *getChild( const Bu::FString &sName ) const; const GroupList &getChildren( const Bu::FString &sName ) const; -- cgit v1.2.3