sl@0: // Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // CLogEvent sl@0: // sl@0: // sl@0: sl@0: inline TLogId CLogEvent::Id() const sl@0: /** Gets the unique event ID associated with this log event. sl@0: sl@0: Unique event IDs are allocated by the Log Engine when an event is added to sl@0: the log. sl@0: sl@0: @return The unique event ID. sl@0: @see CLogClient::GetEvent() sl@0: @see CLogClient::AddEvent() sl@0: @see CLogClient::ChangeEvent() sl@0: @see CLogClient::DeleteEvent() */ sl@0: { sl@0: return iId; sl@0: } sl@0: sl@0: inline void CLogEvent::SetId(TLogId aId) sl@0: /** Sets the unique event ID. sl@0: sl@0: @param aId The unique event ID. */ sl@0: { sl@0: iId = aId; sl@0: } sl@0: sl@0: inline TUid CLogEvent::EventType() const sl@0: /** Gets the type of this log event. Event types are identified by a UID. sl@0: sl@0: @return The event type UID. sl@0: @see CLogEvent::Description() */ sl@0: { sl@0: return iEventType; sl@0: } sl@0: sl@0: inline void CLogEvent::SetEventType(TUid aId) sl@0: /** Sets the type of this log event. Event types are identified by a UID. sl@0: sl@0: @param aId The event type UID. sl@0: @see CLogEvent::Description() */ sl@0: { sl@0: iEventType = aId; sl@0: } sl@0: sl@0: inline const TDesC& CLogEvent::RemoteParty() const sl@0: /** Gets the remote party associated with this event. sl@0: sl@0: @return A reference to a non-modifiable descriptor containing the remote party. */ sl@0: { sl@0: return *iRemoteParty; sl@0: } sl@0: sl@0: inline void CLogEvent::SetRemoteParty(const TDesC& aRemote) sl@0: /** Sets the remote party associated with this event. This describes the destination sl@0: of an outgoing event or the source of an incoming event. sl@0: sl@0: The remote party is represented by a string. sl@0: sl@0: The string is copied into a pre-allocated heap descriptor that has a maximum sl@0: length of KLogMaxRemoteLength. If the length of the specified descriptor is sl@0: greater than KLogMaxRemoteLength, then the data is truncated. sl@0: sl@0: @param aRemote The remote party. */ sl@0: { sl@0: TPtr ptr(iRemoteParty->Des()); sl@0: iRemoteParty->Des().Copy(aRemote.Ptr(), Min(aRemote.Length(), ptr.MaxLength())); sl@0: } sl@0: sl@0: inline const TDesC& CLogEvent::Direction() const sl@0: /** Gets the direction of the call represented by this event. The direction of sl@0: a call means incoming, outgoing etc. sl@0: sl@0: The direction is represented by a string. sl@0: sl@0: @return A reference to a non-modifiable descriptor containing the string representing sl@0: the direction of the call. */ sl@0: { sl@0: return *iDirection; sl@0: } sl@0: sl@0: inline void CLogEvent::SetDirection(const TDesC& aDirection) sl@0: /** Sets the direction of the call represented by this event. The direction of sl@0: a call means incoming, outgoing etc. sl@0: sl@0: The direction is represented by a string. Standard strings are available in sl@0: the log wrapper resource file and can be accessed through the resource IDs: sl@0: R_LOG_DIR_IN, R_LOG_DIR_OUT, R_LOG_DIR_IN_ALT, R_LOG_DIR_OUT_ALT, R_LOG_DIR_FETCHED sl@0: and R_LOG_DIR_MISSED. sl@0: sl@0: The string is copied into a pre-allocated heap descriptor that has a maximum sl@0: length of KLogMaxDirectionLength. If the length of the specified descriptor sl@0: is greater than KLogMaxDirectionLength, then the data is truncated. sl@0: sl@0: @param aDirection The readable name. sl@0: @see CLogClient::GetString() */ sl@0: { sl@0: TPtr ptr(iDirection->Des()); sl@0: ptr.Copy(aDirection.Ptr(), Min(aDirection.Length(), ptr.MaxLength())); sl@0: } sl@0: sl@0: inline const TTime& CLogEvent::Time() const sl@0: /** Gets the UTC time that this event was created. sl@0: sl@0: @return The time of the event. */ sl@0: { sl@0: return iTime; sl@0: } sl@0: sl@0: inline void CLogEvent::SetTime(const TTime& aTime) sl@0: /** Sets the UTC time that this event was created. sl@0: sl@0: Note that this field is used when ordering events in a view; changing this sl@0: value may change the position of the event in a view. sl@0: sl@0: @param aTime The UTC time of the event. */ sl@0: { sl@0: iTime = aTime; sl@0: } sl@0: sl@0: inline TLogDurationType CLogEvent::DurationType() const sl@0: /** Gets the duration type. sl@0: sl@0: This applies meaning to the idea of a duration. sl@0: sl@0: The duration type is implemented as a UI variant-specific enumeration. The sl@0: following duration types are generic: KLogDurationNone, KLogDurationValid sl@0: and KLogDurationData. sl@0: sl@0: @return The duration type. */ sl@0: { sl@0: return iDurationType; sl@0: } sl@0: sl@0: inline void CLogEvent::SetDurationType(TLogDurationType aDurationType) sl@0: /** Sets the duration type. This applies meaning to the idea of a duration. sl@0: sl@0: @param aDurationType The duration type. */ sl@0: { sl@0: iDurationType = aDurationType; sl@0: } sl@0: sl@0: inline TLogDuration CLogEvent::Duration() const sl@0: /** Gets the duration of the event. sl@0: sl@0: @return The duration of the event, expressed as the number of seconds since sl@0: the time of the event. */ sl@0: { sl@0: return iDuration; sl@0: } sl@0: sl@0: inline void CLogEvent::SetDuration(TLogDuration aDuration) sl@0: /** Sets the duration of the event. sl@0: sl@0: @param aDuration The duration of the event, expressed as the number of seconds sl@0: since the time of the event. */ sl@0: { sl@0: iDuration = aDuration; sl@0: } sl@0: sl@0: inline const TDesC& CLogEvent::Status() const sl@0: /** Gets the delivery status of this event. sl@0: sl@0: @return A reference to a non-modifiable descriptor containing the delivery sl@0: status. */ sl@0: { sl@0: return *iStatus; sl@0: } sl@0: sl@0: inline void CLogEvent::SetStatus(const TDesC& aStatus) sl@0: /** Sets the delivery status of this event. sl@0: sl@0: The delivery status is represented by a string. Standard strings are available sl@0: in the log wrapper resource file and can be accessed through the resource sl@0: IDs: R_LOG_DEL_PENDING, R_LOG_DEL_SENT, R_LOG_DEL_FAILED, R_LOG_DEL_NONE, sl@0: R_LOG_DEL_DONE and R_LOG_DEL_NOT_SENT. sl@0: sl@0: The string is copied into a pre-allocated heap descriptor that has a maximum sl@0: length of KLogMaxStatusLength. If the length of the specified descriptor is sl@0: greater than KLogMaxStatusLength, then the data is truncated. sl@0: sl@0: @param aStatus The delivery status. sl@0: @see CLogClient::GetString() */ sl@0: { sl@0: TPtr ptr(iStatus->Des()); sl@0: ptr.Copy(aStatus.Ptr(), Min(aStatus.Length(), ptr.MaxLength())); sl@0: } sl@0: sl@0: inline const TDesC& CLogEvent::Subject() const sl@0: /** Gets the subject of this event. sl@0: sl@0: @return A reference to a non-modifiable descriptor containing the subject. */ sl@0: { sl@0: return *iSubject; sl@0: } sl@0: sl@0: inline void CLogEvent::SetSubject(const TDesC& aSubject) sl@0: /** Sets the subject of this event. sl@0: sl@0: The subject is represented by a string. sl@0: sl@0: The string is copied into a pre-allocated heap descriptor that has a maximum sl@0: length of KLogMaxSubjectLength. If the length of the specified descriptor sl@0: is greater than KLogMaxSubjectLength, then the data is truncated. sl@0: sl@0: @param aSubject The subject. */ sl@0: { sl@0: TPtr ptr(iSubject->Des()); sl@0: ptr.Copy(aSubject.Ptr(), Min(aSubject.Length(), ptr.MaxLength())); sl@0: } sl@0: sl@0: inline const TDesC& CLogEvent::Number() const sl@0: /** Gets the phone number associated with the event. sl@0: sl@0: @return A reference to a non-modifiable descriptor containing the phone number. */ sl@0: { sl@0: return *iNumber; sl@0: } sl@0: sl@0: inline void CLogEvent::SetNumber(const TDesC& aNumber) sl@0: /** Sets the phone number associated with this event. This is used when the number sl@0: cannot be stored in any other field. sl@0: sl@0: The number is specified as a string and is copied into a pre-allocated heap sl@0: descriptor that has a maximum length of KLogMaxNumberLength. If the length sl@0: of the specified descriptor is greater than KLogMaxNumberLength, then the sl@0: number is truncated. sl@0: sl@0: @param aNumber The number. */ sl@0: { sl@0: TPtr ptr(iNumber->Des()); sl@0: ptr.Copy(aNumber.Ptr(), Min(aNumber.Length(), ptr.MaxLength())); sl@0: } sl@0: sl@0: inline TLogContactItemId CLogEvent::Contact() const sl@0: /** Gets the contact ID associated with the event. sl@0: sl@0: @return The contact ID. */ sl@0: { sl@0: return iContact; sl@0: } sl@0: sl@0: inline void CLogEvent::SetContact(TLogContactItemId aContact) sl@0: /** Sets the contact ID associated with the event. sl@0: sl@0: @param aContact The contact ID. */ sl@0: { sl@0: iContact = aContact; sl@0: } sl@0: sl@0: inline TLogLink CLogEvent::Link() const sl@0: /** Gets the link value. sl@0: sl@0: @return The link value. */ sl@0: { sl@0: return iLink; sl@0: } sl@0: sl@0: inline void CLogEvent::SetLink(TLogLink aLink) sl@0: /** Sets the link value. sl@0: sl@0: The link can be used to relate this event to an entity in another application. sl@0: For example, it can be used to associate the event with the call ID or the sl@0: message ID for emails and faxes. sl@0: sl@0: @param aLink The link value. */ sl@0: { sl@0: iLink = aLink; sl@0: } sl@0: sl@0: inline const TDesC& CLogEvent::Description() const sl@0: /** Gets the human readable name describing the event type. sl@0: sl@0: Note that this is set automatically by the Log Engine. sl@0: sl@0: @return A reference to a non-modifiable descriptor containing the readable sl@0: name. */ sl@0: { sl@0: return *iDescription; sl@0: } sl@0: sl@0: inline void CLogEvent::SetDescription(const TDesC& aDescription) sl@0: { sl@0: TPtr ptr(iDescription->Des()); sl@0: ptr.Copy(aDescription.Ptr(), Min(aDescription.Length(), ptr.MaxLength())); sl@0: } sl@0: sl@0: inline const TDesC8& CLogEvent::Data() const sl@0: /** Gets event specific data. sl@0: sl@0: @return A reference to a non-modifiable descriptor containing the data that sl@0: is specific to the event.KNullDesC8, if there is no data. */ sl@0: { sl@0: if (iData) sl@0: return *iData; sl@0: else sl@0: return KNullDesC8; sl@0: } sl@0: sl@0: inline TLogFlags CLogEvent::Flags() const sl@0: /** Gets the flags set for this event. sl@0: sl@0: @return The flags. */ sl@0: { sl@0: return iFlags; sl@0: } sl@0: sl@0: inline void CLogEvent::SetFlags(TLogFlags aFlags) sl@0: /** Sets the specified flags for this event. sl@0: sl@0: The function does not change any of the other flag bit settings. sl@0: sl@0: Only the low order 4 bits are stored in the Log Engine Database; the constant sl@0: KLogFlagsMask can be used as a mask. sl@0: sl@0: @param aFlags The flags to be set. */ sl@0: { sl@0: __ASSERT_DEBUG(aFlags <= KLogFlagsMask, User::Invariant()); sl@0: iFlags = (TLogFlags)(iFlags | aFlags); sl@0: } sl@0: sl@0: inline void CLogEvent::ClearFlags(TLogFlags aFlags) sl@0: /** Clears the specified flags for this event. sl@0: sl@0: The function does not change any of the other flag bit settings. sl@0: sl@0: The constant KLogFlagsMask may be used to clear all the flags in an event. sl@0: sl@0: @param aFlags The flags to be cleared. */ sl@0: { sl@0: __ASSERT_DEBUG(aFlags <= KLogFlagsMask, User::Invariant()); sl@0: iFlags = (TLogFlags)(iFlags & ~aFlags); sl@0: } sl@0: sl@0: //********************************** sl@0: // CLogBase sl@0: //********************************** sl@0: sl@0: inline const CResourceFile* CLogBase::ResourceFile() const sl@0: { sl@0: return iResourceFile; sl@0: } sl@0: sl@0: inline CLogBase& CLogWrapper::Log() sl@0: /** Gets a reference to the Log Engine object. sl@0: sl@0: @return If the Log Engine is installed, this is a reference to a CLogClient sl@0: object. If there is no Log Engine, this is a reference to an instance of the sl@0: Log Engine base class, CLogBase. sl@0: @see CLogClient */ sl@0: { sl@0: return *iBase; sl@0: }