1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/persistentdata/loggingservices/eventlogger/LogWrap/inc/LOGWRAP.INL Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,366 @@
1.4 +// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
1.5 +// All rights reserved.
1.6 +// This component and the accompanying materials are made available
1.7 +// under the terms of "Eclipse Public License v1.0"
1.8 +// which accompanies this distribution, and is available
1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.10 +//
1.11 +// Initial Contributors:
1.12 +// Nokia Corporation - initial contribution.
1.13 +//
1.14 +// Contributors:
1.15 +//
1.16 +// Description:
1.17 +// CLogEvent
1.18 +//
1.19 +//
1.20 +
1.21 +inline TLogId CLogEvent::Id() const
1.22 +/** Gets the unique event ID associated with this log event.
1.23 +
1.24 +Unique event IDs are allocated by the Log Engine when an event is added to
1.25 +the log.
1.26 +
1.27 +@return The unique event ID.
1.28 +@see CLogClient::GetEvent()
1.29 +@see CLogClient::AddEvent()
1.30 +@see CLogClient::ChangeEvent()
1.31 +@see CLogClient::DeleteEvent() */
1.32 + {
1.33 + return iId;
1.34 + }
1.35 +
1.36 +inline void CLogEvent::SetId(TLogId aId)
1.37 +/** Sets the unique event ID.
1.38 +
1.39 +@param aId The unique event ID. */
1.40 + {
1.41 + iId = aId;
1.42 + }
1.43 +
1.44 +inline TUid CLogEvent::EventType() const
1.45 +/** Gets the type of this log event. Event types are identified by a UID.
1.46 +
1.47 +@return The event type UID.
1.48 +@see CLogEvent::Description() */
1.49 + {
1.50 + return iEventType;
1.51 + }
1.52 +
1.53 +inline void CLogEvent::SetEventType(TUid aId)
1.54 +/** Sets the type of this log event. Event types are identified by a UID.
1.55 +
1.56 +@param aId The event type UID.
1.57 +@see CLogEvent::Description() */
1.58 + {
1.59 + iEventType = aId;
1.60 + }
1.61 +
1.62 +inline const TDesC& CLogEvent::RemoteParty() const
1.63 +/** Gets the remote party associated with this event.
1.64 +
1.65 +@return A reference to a non-modifiable descriptor containing the remote party. */
1.66 + {
1.67 + return *iRemoteParty;
1.68 + }
1.69 +
1.70 +inline void CLogEvent::SetRemoteParty(const TDesC& aRemote)
1.71 +/** Sets the remote party associated with this event. This describes the destination
1.72 +of an outgoing event or the source of an incoming event.
1.73 +
1.74 +The remote party is represented by a string.
1.75 +
1.76 +The string is copied into a pre-allocated heap descriptor that has a maximum
1.77 +length of KLogMaxRemoteLength. If the length of the specified descriptor is
1.78 +greater than KLogMaxRemoteLength, then the data is truncated.
1.79 +
1.80 +@param aRemote The remote party. */
1.81 + {
1.82 + TPtr ptr(iRemoteParty->Des());
1.83 + iRemoteParty->Des().Copy(aRemote.Ptr(), Min(aRemote.Length(), ptr.MaxLength()));
1.84 + }
1.85 +
1.86 +inline const TDesC& CLogEvent::Direction() const
1.87 +/** Gets the direction of the call represented by this event. The direction of
1.88 +a call means incoming, outgoing etc.
1.89 +
1.90 +The direction is represented by a string.
1.91 +
1.92 +@return A reference to a non-modifiable descriptor containing the string representing
1.93 +the direction of the call. */
1.94 + {
1.95 + return *iDirection;
1.96 + }
1.97 +
1.98 +inline void CLogEvent::SetDirection(const TDesC& aDirection)
1.99 +/** Sets the direction of the call represented by this event. The direction of
1.100 +a call means incoming, outgoing etc.
1.101 +
1.102 +The direction is represented by a string. Standard strings are available in
1.103 +the log wrapper resource file and can be accessed through the resource IDs:
1.104 +R_LOG_DIR_IN, R_LOG_DIR_OUT, R_LOG_DIR_IN_ALT, R_LOG_DIR_OUT_ALT, R_LOG_DIR_FETCHED
1.105 +and R_LOG_DIR_MISSED.
1.106 +
1.107 +The string is copied into a pre-allocated heap descriptor that has a maximum
1.108 +length of KLogMaxDirectionLength. If the length of the specified descriptor
1.109 +is greater than KLogMaxDirectionLength, then the data is truncated.
1.110 +
1.111 +@param aDirection The readable name.
1.112 +@see CLogClient::GetString() */
1.113 + {
1.114 + TPtr ptr(iDirection->Des());
1.115 + ptr.Copy(aDirection.Ptr(), Min(aDirection.Length(), ptr.MaxLength()));
1.116 + }
1.117 +
1.118 +inline const TTime& CLogEvent::Time() const
1.119 +/** Gets the UTC time that this event was created.
1.120 +
1.121 +@return The time of the event. */
1.122 + {
1.123 + return iTime;
1.124 + }
1.125 +
1.126 +inline void CLogEvent::SetTime(const TTime& aTime)
1.127 +/** Sets the UTC time that this event was created.
1.128 +
1.129 +Note that this field is used when ordering events in a view; changing this
1.130 +value may change the position of the event in a view.
1.131 +
1.132 +@param aTime The UTC time of the event. */
1.133 + {
1.134 + iTime = aTime;
1.135 + }
1.136 +
1.137 +inline TLogDurationType CLogEvent::DurationType() const
1.138 +/** Gets the duration type.
1.139 +
1.140 +This applies meaning to the idea of a duration.
1.141 +
1.142 +The duration type is implemented as a UI variant-specific enumeration. The
1.143 +following duration types are generic: KLogDurationNone, KLogDurationValid
1.144 +and KLogDurationData.
1.145 +
1.146 +@return The duration type. */
1.147 + {
1.148 + return iDurationType;
1.149 + }
1.150 +
1.151 +inline void CLogEvent::SetDurationType(TLogDurationType aDurationType)
1.152 +/** Sets the duration type. This applies meaning to the idea of a duration.
1.153 +
1.154 +@param aDurationType The duration type. */
1.155 + {
1.156 + iDurationType = aDurationType;
1.157 + }
1.158 +
1.159 +inline TLogDuration CLogEvent::Duration() const
1.160 +/** Gets the duration of the event.
1.161 +
1.162 +@return The duration of the event, expressed as the number of seconds since
1.163 +the time of the event. */
1.164 + {
1.165 + return iDuration;
1.166 + }
1.167 +
1.168 +inline void CLogEvent::SetDuration(TLogDuration aDuration)
1.169 +/** Sets the duration of the event.
1.170 +
1.171 +@param aDuration The duration of the event, expressed as the number of seconds
1.172 +since the time of the event. */
1.173 + {
1.174 + iDuration = aDuration;
1.175 + }
1.176 +
1.177 +inline const TDesC& CLogEvent::Status() const
1.178 +/** Gets the delivery status of this event.
1.179 +
1.180 +@return A reference to a non-modifiable descriptor containing the delivery
1.181 +status. */
1.182 + {
1.183 + return *iStatus;
1.184 + }
1.185 +
1.186 +inline void CLogEvent::SetStatus(const TDesC& aStatus)
1.187 +/** Sets the delivery status of this event.
1.188 +
1.189 +The delivery status is represented by a string. Standard strings are available
1.190 +in the log wrapper resource file and can be accessed through the resource
1.191 +IDs: R_LOG_DEL_PENDING, R_LOG_DEL_SENT, R_LOG_DEL_FAILED, R_LOG_DEL_NONE,
1.192 +R_LOG_DEL_DONE and R_LOG_DEL_NOT_SENT.
1.193 +
1.194 +The string is copied into a pre-allocated heap descriptor that has a maximum
1.195 +length of KLogMaxStatusLength. If the length of the specified descriptor is
1.196 +greater than KLogMaxStatusLength, then the data is truncated.
1.197 +
1.198 +@param aStatus The delivery status.
1.199 +@see CLogClient::GetString() */
1.200 + {
1.201 + TPtr ptr(iStatus->Des());
1.202 + ptr.Copy(aStatus.Ptr(), Min(aStatus.Length(), ptr.MaxLength()));
1.203 + }
1.204 +
1.205 +inline const TDesC& CLogEvent::Subject() const
1.206 +/** Gets the subject of this event.
1.207 +
1.208 +@return A reference to a non-modifiable descriptor containing the subject. */
1.209 + {
1.210 + return *iSubject;
1.211 + }
1.212 +
1.213 +inline void CLogEvent::SetSubject(const TDesC& aSubject)
1.214 +/** Sets the subject of this event.
1.215 +
1.216 +The subject is represented by a string.
1.217 +
1.218 +The string is copied into a pre-allocated heap descriptor that has a maximum
1.219 +length of KLogMaxSubjectLength. If the length of the specified descriptor
1.220 +is greater than KLogMaxSubjectLength, then the data is truncated.
1.221 +
1.222 +@param aSubject The subject. */
1.223 + {
1.224 + TPtr ptr(iSubject->Des());
1.225 + ptr.Copy(aSubject.Ptr(), Min(aSubject.Length(), ptr.MaxLength()));
1.226 + }
1.227 +
1.228 +inline const TDesC& CLogEvent::Number() const
1.229 +/** Gets the phone number associated with the event.
1.230 +
1.231 +@return A reference to a non-modifiable descriptor containing the phone number. */
1.232 + {
1.233 + return *iNumber;
1.234 + }
1.235 +
1.236 +inline void CLogEvent::SetNumber(const TDesC& aNumber)
1.237 +/** Sets the phone number associated with this event. This is used when the number
1.238 +cannot be stored in any other field.
1.239 +
1.240 +The number is specified as a string and is copied into a pre-allocated heap
1.241 +descriptor that has a maximum length of KLogMaxNumberLength. If the length
1.242 +of the specified descriptor is greater than KLogMaxNumberLength, then the
1.243 +number is truncated.
1.244 +
1.245 +@param aNumber The number. */
1.246 + {
1.247 + TPtr ptr(iNumber->Des());
1.248 + ptr.Copy(aNumber.Ptr(), Min(aNumber.Length(), ptr.MaxLength()));
1.249 + }
1.250 +
1.251 +inline TLogContactItemId CLogEvent::Contact() const
1.252 +/** Gets the contact ID associated with the event.
1.253 +
1.254 +@return The contact ID. */
1.255 + {
1.256 + return iContact;
1.257 + }
1.258 +
1.259 +inline void CLogEvent::SetContact(TLogContactItemId aContact)
1.260 +/** Sets the contact ID associated with the event.
1.261 +
1.262 +@param aContact The contact ID. */
1.263 + {
1.264 + iContact = aContact;
1.265 + }
1.266 +
1.267 +inline TLogLink CLogEvent::Link() const
1.268 +/** Gets the link value.
1.269 +
1.270 +@return The link value. */
1.271 + {
1.272 + return iLink;
1.273 + }
1.274 +
1.275 +inline void CLogEvent::SetLink(TLogLink aLink)
1.276 +/** Sets the link value.
1.277 +
1.278 +The link can be used to relate this event to an entity in another application.
1.279 +For example, it can be used to associate the event with the call ID or the
1.280 +message ID for emails and faxes.
1.281 +
1.282 +@param aLink The link value. */
1.283 + {
1.284 + iLink = aLink;
1.285 + }
1.286 +
1.287 +inline const TDesC& CLogEvent::Description() const
1.288 +/** Gets the human readable name describing the event type.
1.289 +
1.290 +Note that this is set automatically by the Log Engine.
1.291 +
1.292 +@return A reference to a non-modifiable descriptor containing the readable
1.293 +name. */
1.294 + {
1.295 + return *iDescription;
1.296 + }
1.297 +
1.298 +inline void CLogEvent::SetDescription(const TDesC& aDescription)
1.299 + {
1.300 + TPtr ptr(iDescription->Des());
1.301 + ptr.Copy(aDescription.Ptr(), Min(aDescription.Length(), ptr.MaxLength()));
1.302 + }
1.303 +
1.304 +inline const TDesC8& CLogEvent::Data() const
1.305 +/** Gets event specific data.
1.306 +
1.307 +@return A reference to a non-modifiable descriptor containing the data that
1.308 +is specific to the event.KNullDesC8, if there is no data. */
1.309 + {
1.310 + if (iData)
1.311 + return *iData;
1.312 + else
1.313 + return KNullDesC8;
1.314 + }
1.315 +
1.316 +inline TLogFlags CLogEvent::Flags() const
1.317 +/** Gets the flags set for this event.
1.318 +
1.319 +@return The flags. */
1.320 + {
1.321 + return iFlags;
1.322 + }
1.323 +
1.324 +inline void CLogEvent::SetFlags(TLogFlags aFlags)
1.325 +/** Sets the specified flags for this event.
1.326 +
1.327 +The function does not change any of the other flag bit settings.
1.328 +
1.329 +Only the low order 4 bits are stored in the Log Engine Database; the constant
1.330 +KLogFlagsMask can be used as a mask.
1.331 +
1.332 +@param aFlags The flags to be set. */
1.333 + {
1.334 + __ASSERT_DEBUG(aFlags <= KLogFlagsMask, User::Invariant());
1.335 + iFlags = (TLogFlags)(iFlags | aFlags);
1.336 + }
1.337 +
1.338 +inline void CLogEvent::ClearFlags(TLogFlags aFlags)
1.339 +/** Clears the specified flags for this event.
1.340 +
1.341 +The function does not change any of the other flag bit settings.
1.342 +
1.343 +The constant KLogFlagsMask may be used to clear all the flags in an event.
1.344 +
1.345 +@param aFlags The flags to be cleared. */
1.346 + {
1.347 + __ASSERT_DEBUG(aFlags <= KLogFlagsMask, User::Invariant());
1.348 + iFlags = (TLogFlags)(iFlags & ~aFlags);
1.349 + }
1.350 +
1.351 +//**********************************
1.352 +// CLogBase
1.353 +//**********************************
1.354 +
1.355 +inline const CResourceFile* CLogBase::ResourceFile() const
1.356 + {
1.357 + return iResourceFile;
1.358 + }
1.359 +
1.360 +inline CLogBase& CLogWrapper::Log()
1.361 +/** Gets a reference to the Log Engine object.
1.362 +
1.363 +@return If the Log Engine is installed, this is a reference to a CLogClient
1.364 +object. If there is no Log Engine, this is a reference to an instance of the
1.365 +Log Engine base class, CLogBase.
1.366 +@see CLogClient */
1.367 + {
1.368 + return *iBase;
1.369 + }