epoc32/include/logwrap.inl
branchSymbian2
changeset 2 2fe1408b6811
parent 0 061f57f2323e
child 4 837f303aceeb
equal deleted inserted replaced
1:666f914201fb 2:2fe1408b6811
     1 logwrap.inl
     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 the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // CLogEvent
       
    15 // 
       
    16 //
       
    17 
       
    18 inline TLogId CLogEvent::Id() const
       
    19 /** Gets the unique event ID associated with this log event.
       
    20 
       
    21 Unique event IDs are allocated by the Log Engine when an event is added to 
       
    22 the log.
       
    23 
       
    24 @return The unique event ID.
       
    25 @see CLogClient::GetEvent()
       
    26 @see CLogClient::AddEvent()
       
    27 @see CLogClient::ChangeEvent()
       
    28 @see CLogClient::DeleteEvent() */
       
    29 	{
       
    30 	return iId;
       
    31 	}
       
    32 
       
    33 inline void CLogEvent::SetId(TLogId aId)
       
    34 /** Sets the unique event ID.
       
    35 
       
    36 @param aId The unique event ID. */
       
    37 	{
       
    38 	iId = aId;
       
    39 	}
       
    40 
       
    41 inline TUid CLogEvent::EventType() const
       
    42 /** Gets the type of this log event. Event types are identified by a UID.
       
    43 
       
    44 @return The event type UID.
       
    45 @see CLogEvent::Description() */
       
    46 	{
       
    47 	return iEventType;
       
    48 	}
       
    49 
       
    50 inline void CLogEvent::SetEventType(TUid aId)
       
    51 /** Sets the type of this log event. Event types are identified by a UID.
       
    52 
       
    53 @param aId The event type UID.
       
    54 @see CLogEvent::Description() */
       
    55 	{
       
    56 	iEventType = aId;
       
    57 	}
       
    58 
       
    59 inline const TDesC& CLogEvent::RemoteParty() const
       
    60 /** Gets the remote party associated with this event.
       
    61 
       
    62 @return A reference to a non-modifiable descriptor containing the remote party. */
       
    63 	{
       
    64 	return *iRemoteParty;
       
    65 	}
       
    66 
       
    67 inline void CLogEvent::SetRemoteParty(const TDesC& aRemote)
       
    68 /** Sets the remote party associated with this event. This describes the destination 
       
    69 of an outgoing event or the source of an incoming event.
       
    70 
       
    71 The remote party is represented by a string.
       
    72 
       
    73 The string is copied into a pre-allocated heap descriptor that has a maximum 
       
    74 length of KLogMaxRemoteLength. If the length of the specified descriptor is 
       
    75 greater than KLogMaxRemoteLength, then the data is truncated.
       
    76 
       
    77 @param aRemote The remote party. */
       
    78 	{
       
    79 	TPtr ptr(iRemoteParty->Des());
       
    80 	iRemoteParty->Des().Copy(aRemote.Ptr(), Min(aRemote.Length(), ptr.MaxLength()));
       
    81 	}
       
    82 
       
    83 inline const TDesC& CLogEvent::Direction() const
       
    84 /** Gets the direction of the call represented by this event. The direction of 
       
    85 a call means incoming, outgoing etc.
       
    86 
       
    87 The direction is represented by a string.
       
    88 
       
    89 @return A reference to a non-modifiable descriptor containing the string representing 
       
    90 the direction of the call. */
       
    91 	{
       
    92 	return *iDirection;
       
    93 	}
       
    94 
       
    95 inline void CLogEvent::SetDirection(const TDesC& aDirection)
       
    96 /** Sets the direction of the call represented by this event. The direction of 
       
    97 a call means incoming, outgoing etc.
       
    98 
       
    99 The direction is represented by a string. Standard strings are available in 
       
   100 the log wrapper resource file and can be accessed through the resource IDs: 
       
   101 R_LOG_DIR_IN, R_LOG_DIR_OUT, R_LOG_DIR_IN_ALT, R_LOG_DIR_OUT_ALT, R_LOG_DIR_FETCHED 
       
   102 and R_LOG_DIR_MISSED.
       
   103 
       
   104 The string is copied into a pre-allocated heap descriptor that has a maximum 
       
   105 length of KLogMaxDirectionLength. If the length of the specified descriptor 
       
   106 is greater than KLogMaxDirectionLength, then the data is truncated.
       
   107 
       
   108 @param aDirection The readable name.
       
   109 @see CLogClient::GetString() */
       
   110 	{
       
   111 	TPtr ptr(iDirection->Des());
       
   112 	ptr.Copy(aDirection.Ptr(), Min(aDirection.Length(), ptr.MaxLength()));
       
   113 	}
       
   114 
       
   115 inline const TTime& CLogEvent::Time() const
       
   116 /** Gets the UTC time that this event was created.
       
   117 
       
   118 @return The time of the event. */
       
   119 	{
       
   120 	return iTime;
       
   121 	}
       
   122 
       
   123 inline void CLogEvent::SetTime(const TTime& aTime)
       
   124 /** Sets the UTC time that this event was created.
       
   125 
       
   126 Note that this field is used when ordering events in a view; changing this 
       
   127 value may change the position of the event in a view.
       
   128 
       
   129 @param aTime The UTC time of the event. */
       
   130 	{
       
   131 	iTime = aTime;
       
   132 	}
       
   133 
       
   134 inline TLogDurationType CLogEvent::DurationType() const
       
   135 /** Gets the duration type.
       
   136 
       
   137 This applies meaning to the idea of a duration. 
       
   138 
       
   139 The duration type is implemented as a UI variant-specific enumeration. The 
       
   140 following duration types are generic: KLogDurationNone, KLogDurationValid 
       
   141 and KLogDurationData.
       
   142 
       
   143 @return The duration type. */
       
   144 	{
       
   145 	return iDurationType;
       
   146 	}
       
   147 
       
   148 inline void CLogEvent::SetDurationType(TLogDurationType aDurationType)
       
   149 /** Sets the duration type. This applies meaning to the idea of a duration.
       
   150 
       
   151 @param aDurationType The duration type. */
       
   152 	{
       
   153 	iDurationType = aDurationType;
       
   154 	}
       
   155 
       
   156 inline TLogDuration CLogEvent::Duration() const
       
   157 /** Gets the duration of the event.
       
   158 
       
   159 @return The duration of the event, expressed as the number of seconds since 
       
   160 the time of the event. */
       
   161 	{
       
   162 	return iDuration;
       
   163 	}
       
   164 
       
   165 inline void CLogEvent::SetDuration(TLogDuration aDuration)
       
   166 /** Sets the duration of the event.
       
   167 
       
   168 @param aDuration The duration of the event, expressed as the number of seconds 
       
   169 since the time of the event. */
       
   170 	{
       
   171 	iDuration = aDuration;
       
   172 	}
       
   173 
       
   174 inline const TDesC& CLogEvent::Status() const
       
   175 /** Gets the delivery status of this event.
       
   176 
       
   177 @return A reference to a non-modifiable descriptor containing the delivery 
       
   178 status. */
       
   179 	{
       
   180 	return *iStatus;
       
   181 	}
       
   182 
       
   183 inline void CLogEvent::SetStatus(const TDesC& aStatus)
       
   184 /** Sets the delivery status of this event.
       
   185 
       
   186 The delivery status is represented by a string. Standard strings are available 
       
   187 in the log wrapper resource file and can be accessed through the resource 
       
   188 IDs: R_LOG_DEL_PENDING, R_LOG_DEL_SENT, R_LOG_DEL_FAILED, R_LOG_DEL_NONE, 
       
   189 R_LOG_DEL_DONE and R_LOG_DEL_NOT_SENT.
       
   190 
       
   191 The string is copied into a pre-allocated heap descriptor that has a maximum 
       
   192 length of KLogMaxStatusLength. If the length of the specified descriptor is 
       
   193 greater than KLogMaxStatusLength, then the data is truncated.
       
   194 
       
   195 @param aStatus The delivery status.
       
   196 @see CLogClient::GetString() */
       
   197 	{
       
   198 	TPtr ptr(iStatus->Des());
       
   199 	ptr.Copy(aStatus.Ptr(), Min(aStatus.Length(), ptr.MaxLength()));
       
   200 	}
       
   201 
       
   202 inline const TDesC& CLogEvent::Subject() const
       
   203 /** Gets the subject of this event.
       
   204 
       
   205 @return A reference to a non-modifiable descriptor containing the subject. */
       
   206 	{
       
   207 	return *iSubject;
       
   208 	}
       
   209 
       
   210 inline void CLogEvent::SetSubject(const TDesC& aSubject)
       
   211 /** Sets the subject of this event.
       
   212 
       
   213 The subject is represented by a string.
       
   214 
       
   215 The string is copied into a pre-allocated heap descriptor that has a maximum 
       
   216 length of KLogMaxSubjectLength. If the length of the specified descriptor 
       
   217 is greater than KLogMaxSubjectLength, then the data is truncated.
       
   218 
       
   219 @param aSubject The subject. */
       
   220 	{
       
   221 	TPtr ptr(iSubject->Des());
       
   222 	ptr.Copy(aSubject.Ptr(), Min(aSubject.Length(), ptr.MaxLength()));
       
   223 	}
       
   224 
       
   225 inline const TDesC& CLogEvent::Number() const
       
   226 /** Gets the phone number associated with the event.
       
   227 
       
   228 @return A reference to a non-modifiable descriptor containing the phone number. */
       
   229 	{
       
   230 	return *iNumber;
       
   231 	}
       
   232 
       
   233 inline void CLogEvent::SetNumber(const TDesC& aNumber)
       
   234 /** Sets the phone number associated with this event. This is used when the number 
       
   235 cannot be stored in any other field.
       
   236 
       
   237 The number is specified as a string and is copied into a pre-allocated heap 
       
   238 descriptor that has a maximum length of KLogMaxNumberLength. If the length 
       
   239 of the specified descriptor is greater than KLogMaxNumberLength, then the 
       
   240 number is truncated.
       
   241 
       
   242 @param aNumber The number. */
       
   243 	{
       
   244 	TPtr ptr(iNumber->Des());
       
   245 	ptr.Copy(aNumber.Ptr(), Min(aNumber.Length(), ptr.MaxLength()));
       
   246 	}
       
   247 
       
   248 inline TLogContactItemId  CLogEvent::Contact() const
       
   249 /** Gets the contact ID associated with the event.
       
   250 
       
   251 @return The contact ID. */
       
   252 	{
       
   253 	return iContact;
       
   254 	}
       
   255 
       
   256 inline void CLogEvent::SetContact(TLogContactItemId  aContact)
       
   257 /** Sets the contact ID associated with the event.
       
   258 
       
   259 @param aContact The contact ID. */
       
   260 	{
       
   261 	iContact = aContact;
       
   262 	}
       
   263 
       
   264 inline TLogLink CLogEvent::Link() const
       
   265 /** Gets the link value.
       
   266 
       
   267 @return The link value. */
       
   268 	{
       
   269 	return iLink;
       
   270 	}
       
   271 
       
   272 inline void CLogEvent::SetLink(TLogLink aLink)
       
   273 /** Sets the link value.
       
   274 
       
   275 The link can be used to relate this event to an entity in another application. 
       
   276 For example, it can be used to associate the event with the call ID or the 
       
   277 message ID for emails and faxes.
       
   278 
       
   279 @param aLink The link value. */
       
   280 	{
       
   281 	iLink = aLink;
       
   282 	}
       
   283 
       
   284 inline const TDesC& CLogEvent::Description() const
       
   285 /** Gets the human readable name describing the event type.
       
   286 
       
   287 Note that this is set automatically by the Log Engine.
       
   288 
       
   289 @return A reference to a non-modifiable descriptor containing the readable 
       
   290 name. */
       
   291 	{
       
   292 	return *iDescription;
       
   293 	}
       
   294 
       
   295 inline void CLogEvent::SetDescription(const TDesC& aDescription)
       
   296 	{
       
   297 	TPtr ptr(iDescription->Des());
       
   298 	ptr.Copy(aDescription.Ptr(), Min(aDescription.Length(), ptr.MaxLength()));
       
   299 	}
       
   300 
       
   301 inline const TDesC8& CLogEvent::Data() const
       
   302 /** Gets event specific data.
       
   303 
       
   304 @return A reference to a non-modifiable descriptor containing the data that 
       
   305 is specific to the event.KNullDesC8, if there is no data. */
       
   306 	{
       
   307 	if (iData)
       
   308 		return *iData;
       
   309 	else
       
   310 		return KNullDesC8;
       
   311 	}
       
   312 
       
   313 inline TLogFlags CLogEvent::Flags() const
       
   314 /** Gets the flags set for this event.
       
   315 
       
   316 @return The flags. */
       
   317 	{
       
   318 	return iFlags;
       
   319 	}
       
   320 
       
   321 inline void CLogEvent::SetFlags(TLogFlags aFlags)
       
   322 /** Sets the specified flags for this event.
       
   323 
       
   324 The function does not change any of the other flag bit settings.
       
   325 
       
   326 Only the low order 4 bits are stored in the Log Engine Database; the constant 
       
   327 KLogFlagsMask can be used as a mask.
       
   328 
       
   329 @param aFlags The flags to be set. */
       
   330 	{
       
   331 	__ASSERT_DEBUG(aFlags <= KLogFlagsMask, User::Invariant());
       
   332 	iFlags = (TLogFlags)(iFlags | aFlags);
       
   333 	}
       
   334 
       
   335 inline void CLogEvent::ClearFlags(TLogFlags aFlags)
       
   336 /** Clears the specified flags for this event.
       
   337 
       
   338 The function does not change any of the other flag bit settings.
       
   339 
       
   340 The constant KLogFlagsMask may be used to clear all the flags in an event.
       
   341 
       
   342 @param aFlags The flags to be cleared. */
       
   343 	{
       
   344 	__ASSERT_DEBUG(aFlags <= KLogFlagsMask, User::Invariant());
       
   345 	iFlags = (TLogFlags)(iFlags & ~aFlags); 
       
   346 	}
       
   347 
       
   348 //**********************************
       
   349 // CLogBase
       
   350 //**********************************
       
   351 
       
   352 inline const CResourceFile* CLogBase::ResourceFile() const
       
   353 	{
       
   354 	return iResourceFile;
       
   355 	}
       
   356 
       
   357 inline CLogBase& CLogWrapper::Log()
       
   358 /** Gets a reference to the Log Engine object.
       
   359 
       
   360 @return If the Log Engine is installed, this is a reference to a CLogClient 
       
   361 object. If there is no Log Engine, this is a reference to an instance of the 
       
   362 Log Engine base class, CLogBase.
       
   363 @see CLogClient */
       
   364 	{
       
   365 	return *iBase;
       
   366 	}