First public contribution.
1 // Copyright (c) 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 "Eclipse Public License v1.0"
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
21 This class manages a 16-bit resizable buffer and offers functions which can be used for constructing
23 AppendL(), and AppendNumL() can be used to append data to the end of the buffer.
24 RLogDynBuf instance will try to expand the buffer if there is not enough available space for the data to be appended.
26 The following code fragment shows how RLogDynBuf can be used:
28 const TInt KGranularity = 128;
30 buf.CreateLC(KGranularity);
31 buf.AppendL(_L("some data"));//AppendL() automatically expands the buffer if there is not enough place for the string
32 buf.AppendNumL(1234); //AppendNumL() automatically expands the buffer if there is not enough place for the string
33 buf.AppendL(_L("more data"));//AppendL() automatically expands the buffer if there is not enough place for the string
35 CleanupStack::PopAndDestroy(buf);
40 NONSHARABLE_CLASS(RLogDynBuf)
44 void CreateLC(TInt aGranularity);
46 inline const TDesC& DesC() const;
47 inline void SetLength(TInt aLength);
48 inline TInt Length() const;
49 void AppendL(const TDesC& aStr);
52 void DoAllocL(TInt aLen);
61 Initializes RLogDynBuf data memebrs with default values.
63 inline RLogDynBuf::RLogDynBuf() :
69 @return Non-modifiable 16-bit descriptor to the data in the buffer.
71 inline const TDesC& RLogDynBuf::DesC() const
77 Sets the length of the data represented by the buffer to the specified value.
79 @param aLength The new length of the buffer
81 inline void RLogDynBuf::SetLength(TInt aLength)
83 __ASSERT_DEBUG(aLength >= 0, User::Invariant());
84 iBuf.SetLength(aLength);
88 @return The length of the data in the buffer
90 inline TInt RLogDynBuf::Length() const