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