bluetooth/btsdp/database/AttribRange.cpp
changeset 0 29b1cd4cb562
equal deleted inserted replaced
-1:000000000000 0:29b1cd4cb562
       
     1 // Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 #include <bluetooth/logger.h>
       
    17 #include <btsdp.h>
       
    18 
       
    19 #ifdef __FLOG_ACTIVE
       
    20 _LIT8(KLogComponent, LOG_COMPONENT_SDPDATABASE);
       
    21 #endif
       
    22 
       
    23 #ifdef _DEBUG
       
    24 PANICCATEGORY("attrrang");
       
    25 #endif
       
    26 
       
    27 EXPORT_C TAttrRange::TAttrRange()
       
    28 	{
       
    29 	}
       
    30 
       
    31 EXPORT_C TAttrRange::TAttrRange(TSdpAttributeID aAttrId)
       
    32  : iStart(aAttrId), iEnd(aAttrId)
       
    33  	{
       
    34  	}
       
    35 	
       
    36 EXPORT_C TAttrRange::TAttrRange(TSdpAttributeID aStart, TSdpAttributeID aEnd)
       
    37  : iStart(aStart), iEnd(aEnd)
       
    38 	{
       
    39 	ASSERT_DEBUG(iStart <= iEnd);
       
    40 	}
       
    41 	
       
    42 EXPORT_C TBool TAttrRange::IsInRange(TSdpAttributeID aAttrId) const
       
    43 	{
       
    44 	return aAttrId >= iStart && aAttrId <= iEnd;
       
    45 	}
       
    46 
       
    47 EXPORT_C TBool TAttrRange::IsContiguousWith(TSdpAttributeID aAttrId) const 
       
    48 	{
       
    49 	return (aAttrId >= iStart - 1) && (aAttrId <= iEnd + 1);
       
    50 	}
       
    51 
       
    52 EXPORT_C TBool TAttrRange::IsContiguousWith(TAttrRange aRange) const
       
    53 	{
       
    54 	return IsContiguousWith(aRange.iStart) || IsContiguousWith(aRange.iEnd);
       
    55 	}
       
    56 
       
    57 	
       
    58 
       
    59 // EOF