os/persistentdata/loggingservices/eventlogger/LogCli/src/logpackage.cpp
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
sl@0
     1
// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
sl@0
     2
// All rights reserved.
sl@0
     3
// This component and the accompanying materials are made available
sl@0
     4
// under the terms of "Eclipse Public License v1.0"
sl@0
     5
// which accompanies this distribution, and is available
sl@0
     6
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0
     7
//
sl@0
     8
// Initial Contributors:
sl@0
     9
// Nokia Corporation - initial contribution.
sl@0
    10
//
sl@0
    11
// Contributors:
sl@0
    12
//
sl@0
    13
// Description:
sl@0
    14
// LogPackage.h
sl@0
    15
// 
sl@0
    16
//
sl@0
    17
sl@0
    18
#include "logpackage.h"
sl@0
    19
sl@0
    20
// Constants
sl@0
    21
const TInt KLogPackageGranuality = 0x200;
sl@0
    22
sl@0
    23
sl@0
    24
CLogPackage::CLogPackage()
sl@0
    25
: iPtr(NULL, 0)
sl@0
    26
	{
sl@0
    27
	}
sl@0
    28
sl@0
    29
EXPORT_C CLogPackage::~CLogPackage()
sl@0
    30
	{
sl@0
    31
	delete iBuffer;
sl@0
    32
	}
sl@0
    33
sl@0
    34
void CLogPackage::ConstructL()
sl@0
    35
	{
sl@0
    36
	iBuffer = CBufFlat::NewL(KLogPackageGranuality);
sl@0
    37
	}
sl@0
    38
sl@0
    39
EXPORT_C CLogPackage* CLogPackage::NewL()
sl@0
    40
	{
sl@0
    41
	CLogPackage* self = new(ELeave)CLogPackage;
sl@0
    42
	CleanupStack::PushL(self);
sl@0
    43
	self->ConstructL();
sl@0
    44
	CleanupStack::Pop(self);
sl@0
    45
	return self;
sl@0
    46
	}
sl@0
    47
sl@0
    48
EXPORT_C void CLogPackage::SetLogEventL(const CLogEvent& aEvent)
sl@0
    49
	{
sl@0
    50
	RBufWriteStream stream(*iBuffer);
sl@0
    51
	stream << aEvent;
sl@0
    52
	stream.CommitL();
sl@0
    53
	}
sl@0
    54
sl@0
    55
EXPORT_C void CLogPackage::GetLogEventL(CLogEvent& aEvent) const
sl@0
    56
	{
sl@0
    57
	RBufReadStream stream(*iBuffer);
sl@0
    58
	stream >> aEvent;
sl@0
    59
	}
sl@0
    60
sl@0
    61
EXPORT_C void CLogPackage::SetLogEventTypeL(const CLogEventType& aType)
sl@0
    62
	{
sl@0
    63
	RBufWriteStream stream(*iBuffer);
sl@0
    64
	stream << aType;
sl@0
    65
	stream.CommitL();
sl@0
    66
	}
sl@0
    67
sl@0
    68
EXPORT_C void CLogPackage::GetLogEventTypeL(CLogEventType& aType) const
sl@0
    69
	{
sl@0
    70
	RBufReadStream stream(*iBuffer);
sl@0
    71
	stream >> aType;
sl@0
    72
	}
sl@0
    73
sl@0
    74
EXPORT_C void CLogPackage::SetLogConfigL(const TLogConfig& aConfig)
sl@0
    75
	{
sl@0
    76
	RBufWriteStream stream(*iBuffer);
sl@0
    77
	stream << aConfig;
sl@0
    78
	stream.CommitL();
sl@0
    79
	}
sl@0
    80
sl@0
    81
EXPORT_C void CLogPackage::GetLogConfigL(TLogConfig& aConfig) const
sl@0
    82
	{
sl@0
    83
	RBufReadStream stream(*iBuffer);
sl@0
    84
	stream >> aConfig;
sl@0
    85
	}
sl@0
    86
sl@0
    87
EXPORT_C void CLogPackage::SetLogFilterListL(const CLogFilterList& aFilterList)
sl@0
    88
	{
sl@0
    89
	RBufWriteStream stream(*iBuffer);
sl@0
    90
	aFilterList.ExternalizeL(stream);
sl@0
    91
	stream.CommitL();
sl@0
    92
	}
sl@0
    93
sl@0
    94
EXPORT_C void CLogPackage::GetLogFilterListL(CLogFilterList& aFilterList) const
sl@0
    95
	{
sl@0
    96
	RBufReadStream stream(*iBuffer);
sl@0
    97
	aFilterList.InternalizeL(stream);
sl@0
    98
	}