mds_plat/metadata_engine_api/inc/mdenumberproperty.inl
changeset 0 c53acadfccc6
equal deleted inserted replaced
-1:000000000000 0:c53acadfccc6
       
     1 /*
       
     2 * Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  CMdENumberPropertys' compatible wrapper to CMdEProperty
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include <mdepropertydef.h>
       
    20 
       
    21 #define MDE_DEFINE_NUMBER_PROPERTY(PropertyType) \
       
    22 template<> inline T##PropertyType CMdENumberProperty< T##PropertyType >::Value() const \
       
    23     { \
       
    24     T##PropertyType value = NULL; \
       
    25     TRAPD( err, value = PropertyType##ValueL() ); \
       
    26 	if( err != KErrNone ) \
       
    27 		{ \
       
    28 		_LIT( KCMdEPropertyGetValuePanic, "CMdE##PropertyType##Property::Value" ); \
       
    29 		User::Panic( KCMdEPropertyGetValuePanic, KErrNotSupported ); \
       
    30 		} \
       
    31     return value; \
       
    32     } \
       
    33     template<> inline void CMdENumberProperty<T##PropertyType>::SetValueL(T##PropertyType aValue) \
       
    34     { \
       
    35     TRAPD( err, Set##PropertyType##ValueL( aValue ) ); \
       
    36 	if( err != KErrNone ) \
       
    37 		{ \
       
    38 		_LIT( KCMdEPropertySetValuePanic, "CMdE##PropertyType##Property::SetValueL" ); \
       
    39 		User::Panic( KCMdEPropertySetValuePanic, KErrNotSupported ); \
       
    40 		} \
       
    41     }
       
    42 
       
    43 MDE_DEFINE_NUMBER_PROPERTY(Bool)
       
    44 MDE_DEFINE_NUMBER_PROPERTY(Int8)
       
    45 MDE_DEFINE_NUMBER_PROPERTY(Uint8)
       
    46 MDE_DEFINE_NUMBER_PROPERTY(Int16)
       
    47 MDE_DEFINE_NUMBER_PROPERTY(Uint16)
       
    48 MDE_DEFINE_NUMBER_PROPERTY(Int32)
       
    49 MDE_DEFINE_NUMBER_PROPERTY(Uint32)
       
    50 MDE_DEFINE_NUMBER_PROPERTY(Int64)
       
    51 MDE_DEFINE_NUMBER_PROPERTY(Real32)
       
    52 MDE_DEFINE_NUMBER_PROPERTY(Real64)
       
    53 MDE_DEFINE_NUMBER_PROPERTY(Time)
       
    54 
       
    55 #undef MDE_DEFINE_NUMBER_PROPERTY