shoppingitem.cpp

来自「Symbian 的购物程序 shoppinglist-vc」· C++ 代码 · 共 133 行

CPP
133
字号
/*  Copyright (c) 2004, Nokia. All rights reserved */

// INCLUDE FILES
#include <s32file.h>
#include <e32std.h>
#include "shoppingitem.h"

// ================= MEMBER FUNCTIONS =======================

// ---------------------------------------------------------
// CShoppingItem::NewL()
// Creates an instance of the CShoppingItem class.
// ---------------------------------------------------------
//
CShoppingItem* CShoppingItem::NewL()
    {
    CShoppingItem* self = CShoppingItem::NewLC();
    CleanupStack::Pop( self );
    return self;
    }

// ---------------------------------------------------------
// CShoppingItem::NewLC()
// Creates an instance of the CShoppingItem class.
// ---------------------------------------------------------
//
CShoppingItem* CShoppingItem::NewLC()
    {
    CShoppingItem* self = new ( ELeave ) CShoppingItem;
    CleanupStack::PushL( self );
    self->ConstructL();
    return self;
    }

// ---------------------------------------------------------
// CShoppingItem::CShoppingItem()
// Constructor
// ---------------------------------------------------------
//
CShoppingItem::CShoppingItem()
    {
    // No implementation required
    }

// ---------------------------------------------------------
// CShoppingItem::~CShoppingItem()
// Destructor
// ---------------------------------------------------------
//
CShoppingItem::~CShoppingItem()
    {
    delete iName;
    iName = NULL;
    }

// ---------------------------------------------------------
// CShoppingItem::ConstructL()
// 2nd phase construction.
// ---------------------------------------------------------
//
void CShoppingItem::ConstructL()
    {
    // No implementation required
    }

// ---------------------------------------------------------
// CShoppingItem::ExternalizeL()
// 2nd phase construction.
// ---------------------------------------------------------
//
void CShoppingItem::ExternalizeL( RWriteStream& aStream ) const
    {
    if ( iName )
        {
        aStream << *iName;
        }
    else
        {
        aStream << KNullDesC;
        }
    aStream.WriteInt32L( iFlags );
    }

// ---------------------------------------------------------
// CShoppingItem::InternalizeL()
// 2nd phase construction.
// ---------------------------------------------------------
//
void CShoppingItem::InternalizeL( RReadStream& aStream )
    {
    delete iName;
    iName = HBufC::NewL( aStream, KMaxTInt );
    iFlags = aStream.ReadInt32L();
    }

// ---------------------------------------------------------
// CShoppingItem::SetNameL()
// ---------------------------------------------------------
//
void CShoppingItem::SetNameL( HBufC* aValue )
    {
    delete iName;
    iName = aValue;
    }

// ---------------------------------------------------------
// CShoppingItem::Name()
// ---------------------------------------------------------
//
HBufC* CShoppingItem::Name() const
    {
    return iName;
    }

// ---------------------------------------------------------
// CShoppingItem::SetFlags()
// ---------------------------------------------------------
//
void CShoppingItem::SetFlags( TUint aValue )
    {
    iFlags = aValue;
    }

// ---------------------------------------------------------
// CShoppingItem::Flags()
// ---------------------------------------------------------
//
TUint CShoppingItem::Flags() const
    {
    return iFlags;
    }

// End of File

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?