diff -r e1b950c65cb4 -r 837f303aceeb epoc32/include/babitflags.h --- a/epoc32/include/babitflags.h Wed Mar 31 12:27:01 2010 +0100 +++ b/epoc32/include/babitflags.h Wed Mar 31 12:33:34 2010 +0100 @@ -1,9 +1,9 @@ // Copyright (c) 1999-2009 Nokia Corporation and/or its subsidiary(-ies). // All rights reserved. // This component and the accompanying materials are made available -// under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members +// under the terms of "Eclipse Public License v1.0" // which accompanies this distribution, and is available -// at the URL "http://www.symbianfoundation.org/legal/licencesv10.html". +// at the URL "http://www.eclipse.org/legal/epl-v10.html". // // Initial Contributors: // Nokia Corporation - initial contribution. @@ -19,9 +19,9 @@ // System includes #include -/////////////////////////////////////////////////////////////////////////////////////// +// // ----> TBitFlagsT (header) -/////////////////////////////////////////////////////////////////////////////////////// +// template class TBitFlagsT /** @@ -31,9 +31,9 @@ @released */ { -/////////////////////////////////////////////////////////////////////////////////////// +// public: // CONSTRUCT -/////////////////////////////////////////////////////////////////////////////////////// +// /** * Default constructor - initialize all flags to zero @@ -51,9 +51,9 @@ */ inline TBitFlagsT(const TBitFlagsT& aFlags); -/////////////////////////////////////////////////////////////////////////////////////// +// public: // MANIPULATORS -/////////////////////////////////////////////////////////////////////////////////////// +// /** * Set all the flags @@ -89,9 +89,9 @@ */ inline void Toggle(TInt aFlagIndex); -/////////////////////////////////////////////////////////////////////////////////////// +// public: // OPERATORS -/////////////////////////////////////////////////////////////////////////////////////// +// /** * Check if a particular flag is set or not @@ -113,9 +113,9 @@ */ inline TBool operator==(const TBitFlagsT& aFlags); -/////////////////////////////////////////////////////////////////////////////////////// +// public: // ACCESS -/////////////////////////////////////////////////////////////////////////////////////// +// /** * Check if a particular flag is set @@ -138,18 +138,18 @@ */ inline void SetValue(T aFlags) { iFlags = aFlags; } -/////////////////////////////////////////////////////////////////////////////////////// +// private: // INTERNAL -/////////////////////////////////////////////////////////////////////////////////////// +// /** * Generate a mask for a particular flag */ inline T FlagMask(TInt aFlagIndex) const; -/////////////////////////////////////////////////////////////////////////////////////// +// public: // MEMBER DATA -/////////////////////////////////////////////////////////////////////////////////////// +// // The underlying object container which represents the flags. T iFlags; @@ -183,9 +183,9 @@ typedef TBitFlags32 TBitFlags; -/////////////////////////////////////////////////////////////////////////////////////// +// // ----> TBitFlagsT (inlines) -/////////////////////////////////////////////////////////////////////////////////////// +// template inline TBitFlagsT::TBitFlagsT() : iFlags(T(0)) {} @@ -204,7 +204,18 @@ template inline TBool TBitFlagsT::IsSet(TInt aFlagIndex) const - { return iFlags & FlagMask(aFlagIndex); } + { + // All out-of-range values should return false + if(aFlagIndex <= ((sizeof(T)<<3)-1) ) + { + return iFlags & FlagMask(aFlagIndex); + } + else + { + return EFalse; + } + + } template inline TBool TBitFlagsT::IsClear(TInt aFlagIndex) const