metadataengine/server/inc/mdseventdef.h
changeset 0 c53acadfccc6
equal deleted inserted replaced
-1:000000000000 0:c53acadfccc6
       
     1 /*
       
     2 * Copyright (c) 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:  Class to hold description about one event definition
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef __MDSEVENTDEF_H__
       
    19 #define __MDSEVENTDEF_H__
       
    20 
       
    21 #include "mdsitemdef.h"
       
    22 
       
    23 
       
    24 /**
       
    25  *  Metadata eventdef class
       
    26  *
       
    27  *  This class is responsible for holding information one event
       
    28  *
       
    29  */
       
    30 class CMdsEventDef : public CMdsItemDef
       
    31     {
       
    32     friend class CMdsNamespaceDef;
       
    33 public:
       
    34 	/**
       
    35 	 * Create new event object
       
    36 	 * @param aId id of event
       
    37 	 * @param aName name of event
       
    38 	 * @param aPriority priority of event
       
    39 	 * @return pointer to new created event
       
    40 	 */
       
    41     static CMdsEventDef* NewL( const TDesC& aName, const TInt32 aPriority );
       
    42 
       
    43 	/**
       
    44 	 * Create new event object
       
    45 	 * @param aId id of event
       
    46 	 * @param aName name of event
       
    47 	 * @param aPriority priority of event
       
    48 	 * @return pointer to new created event
       
    49 	 */
       
    50     static CMdsEventDef* NewLC( const TDesC& aName, const TInt32 aPriority );
       
    51 
       
    52     /**
       
    53      * Stores event definition to DB
       
    54      * @param aNamespaceDefId namespace definition
       
    55      * @param aConnection connection to database
       
    56      */
       
    57  	void StoreToDBL( const TInt aNamespaceDefId );
       
    58 
       
    59  	/**
       
    60  	 * Destructor
       
    61  	 */
       
    62     virtual ~CMdsEventDef();
       
    63 
       
    64 	TBool operator==( const CMdsEventDef& aEventDef ) const;
       
    65 
       
    66 	inline TBool operator!=( const CMdsEventDef& aEventDef ) const;
       
    67 
       
    68 	/**
       
    69 	 * Get object priority
       
    70 	 * @return object priority
       
    71 	 */
       
    72 	inline TInt32 GetPriority() const;
       
    73 
       
    74     /**
       
    75      * Get required size of serialized buffer when this is serialized.
       
    76      *
       
    77      * @return required size of serialized buffer
       
    78      */
       
    79     TUint32 RequiredBufferSize();
       
    80 
       
    81     /**
       
    82      * Serialize own data to serialized buffer (correct position must be set 
       
    83      * before calling) and return new position of serialized buffer.
       
    84 	 *
       
    85      * @param aBuffer  serialized buffer.
       
    86      */
       
    87     TMdCOffset SerializeL(CMdCSerializationBuffer& aBuffer, TMdCOffset aFreeSpace);
       
    88 
       
    89 private:
       
    90 	/**
       
    91 	 * Default constructor
       
    92 	 */
       
    93     inline CMdsEventDef()
       
    94     	{}
       
    95 
       
    96 	/**
       
    97 	 * 2nd phase construction
       
    98 	 * @param aName name of event
       
    99 	 * @param aPriority priority of event
       
   100 	 */
       
   101     void ConstructL( const TDesC& aName, TInt32 aPriority );
       
   102 
       
   103 private: // data
       
   104 	
       
   105 	/**
       
   106 	 * event priority
       
   107 	 */
       
   108 	TInt32 iPriority;
       
   109     };
       
   110 
       
   111 #include "mdseventdef.inl"
       
   112     
       
   113 #endif // __MDSEVENTDEF_H__