loggingservices/eventlogger/Shared/LogChangeDefinition.h
changeset 0 08ec8eefde2f
equal deleted inserted replaced
-1:000000000000 0:08ec8eefde2f
       
     1 // Copyright (c) 2002-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 #ifndef __LOGCHANGEDEFINITION_H__
       
    17 #define __LOGCHANGEDEFINITION_H__
       
    18 
       
    19 // System includes
       
    20 #include <e32base.h>
       
    21 #include <s32strm.h>
       
    22 #include <logwrap.h>
       
    23 #include <logwraplimits.h>
       
    24 
       
    25 /**
       
    26 Constants
       
    27 @internalComponent
       
    28 */
       
    29 const TInt KLogChangeDefinitionDefaultGranularity = 10;
       
    30 
       
    31 /**
       
    32 Enumerations
       
    33 @internalComponent
       
    34 */
       
    35 enum TLogDatabaseChangeType
       
    36 	{
       
    37 	ELogChangeTypeUndefined = -1,
       
    38 	ELogChangeTypeEventAdded = 0,
       
    39 	ELogChangeTypeEventChanged,
       
    40 	ELogChangeTypeEventChangedHidden,
       
    41 	ELogChangeTypeEventDeleted,
       
    42 	ELogChangeTypeLogCleared
       
    43 	};
       
    44 
       
    45 
       
    46 /////////////////////////////////////////////////////////////////////////////////////////
       
    47 // -----> CLogChangeDefinition (header)
       
    48 /////////////////////////////////////////////////////////////////////////////////////////
       
    49 class CLogChangeDefinition : public CBase
       
    50 /**
       
    51 @internalComponent
       
    52 */
       
    53 	{
       
    54 public: // CONSTRUCT / DESTRUCT
       
    55 	IMPORT_C static CLogChangeDefinition* NewL(TInt aGranularity = KLogChangeDefinitionDefaultGranularity);
       
    56 	IMPORT_C static CLogChangeDefinition* NewL(RReadStream& aStream);
       
    57 	IMPORT_C static CLogChangeDefinition* NewL(const CLogChangeDefinition& aCopy);
       
    58 	IMPORT_C ~CLogChangeDefinition();
       
    59 
       
    60 private: // INTERNAL CONSTRUCT
       
    61 	CLogChangeDefinition(TInt aGranularity);
       
    62 	void ConstructL(const CLogChangeDefinition& aCopy);
       
    63 
       
    64 public: // API
       
    65 
       
    66 	/**
       
    67 	 * Return the number of events in the change definition
       
    68 	 */
       
    69 	IMPORT_C TInt Count() const;
       
    70 
       
    71 	/**
       
    72 	 * Get a change description
       
    73 	 */
       
    74 	IMPORT_C TLogDatabaseChangeType At(TInt aIndex) const;
       
    75 	IMPORT_C TLogDatabaseChangeType At(TInt aIndex, TLogId& aId) const;
       
    76 	IMPORT_C TLogDatabaseChangeType At(TInt aIndex, TLogId& aId, TInt& aViewIndex) const;
       
    77 
       
    78 	/**
       
    79 	 * Find the position of a specific event
       
    80 	 */
       
    81 	IMPORT_C TInt Find(TLogId aId) const;
       
    82 	IMPORT_C TInt Find(TLogId aId, TLogDatabaseChangeType aType) const;
       
    83 	IMPORT_C TInt FindByViewIndex(TInt aViewIndex) const;
       
    84 
       
    85 	/**
       
    86 	 * Add a change definition
       
    87 	 */
       
    88 	IMPORT_C void AddL(TLogId aId, TLogDatabaseChangeType aType, TInt aViewIndex);
       
    89 
       
    90 	/**
       
    91 	 * Reset change contents
       
    92 	 */
       
    93 	IMPORT_C void Reset();
       
    94 
       
    95 public: // INTERNALIZE / EXTERNALIZE
       
    96 	IMPORT_C void InternalizeL(RReadStream& aStream);
       
    97 	IMPORT_C void ExternalizeL(RWriteStream& aStream) const;
       
    98 
       
    99 private: // INTERNAL CLASSES
       
   100 	class TLogShdChangeDetails
       
   101 		{
       
   102 	public:
       
   103 		inline TLogShdChangeDetails() : iId(KLogNullId), iType(ELogChangeTypeUndefined), iViewIndex(KErrNotFound) { }
       
   104 		inline TLogShdChangeDetails(TLogId aId, TLogDatabaseChangeType aType = ELogChangeTypeUndefined, TInt aViewIndex = KErrNotFound) : iId(aId), iType(aType), iViewIndex(aViewIndex) { }
       
   105 
       
   106 	public:
       
   107 		TLogId iId;
       
   108 		TLogDatabaseChangeType iType;
       
   109 		TInt iViewIndex;
       
   110 		};
       
   111 
       
   112 private: // INTERNAL METHODS
       
   113 	static TBool CompareEntryIds(const TLogShdChangeDetails& aLeft, const TLogShdChangeDetails& aRight);
       
   114 	static TBool CompareViewIndicies(const TLogShdChangeDetails& aLeft, const TLogShdChangeDetails& aRight);
       
   115 	void AddToContainerL(TLogId aId, TLogDatabaseChangeType aType, TInt aViewIndex);
       
   116 
       
   117 private: // MEMBER DATA
       
   118 
       
   119 	/**
       
   120 	 * List of changes
       
   121 	 */
       
   122 	RArray<TLogShdChangeDetails> iChanges;
       
   123 	};
       
   124 
       
   125 
       
   126 
       
   127 
       
   128 #endif