Nokia N97 SDK
Example Applications Guide

shape.cpp

00001 /*
00002 * ==============================================================================
00003 *  Name        : shape.cpp
00004 *  Part of     : GuiEngine
00005 *  Interface   :
00006 *  Description :
00007 *  Version     :
00008 *
00009 *  Copyright (c) 2004 - 2006 Nokia Corporation.
00010 *  This material, including documentation and any related
00011 *  computer programs, is protected by copyright controlled by
00012 *  Nokia Corporation.
00013 * ==============================================================================
00014 */
00015 
00016 
00017 // INCLUDE FILES
00018 #include "shape.h"
00019 
00020 
00021 using namespace NShapes;
00022 
00023 
00024 // ========================== OTHER EXPORTED FUNCTIONS =========================
00025 
00026 // -----------------------------------------------------------------------------
00027 // TShape::TShape()
00028 // C++ default constructor can NOT contain any code, that might leave.
00029 // -----------------------------------------------------------------------------
00030 //
00031 EXPORT_C TShape::TShape( TShapeType aShapeType, const TPoint& aOrigin ):
00032                                                 iShapeType( aShapeType ),
00033                                                 iOrigin( aOrigin )
00034     {
00035     // Constructor that creates the shape at a specific point
00036     // No implementation required
00037     }
00038 
00039 // -----------------------------------------------------------------------------
00040 // TShape::ReadShapeTypeL()
00041 // Static method that reads the type of the next shape from a stream
00042 // -----------------------------------------------------------------------------
00043 //
00044 EXPORT_C TShapeType TShape::ReadShapeTypeL( RReadStream& aStream )
00045     {
00046     return static_cast<TShapeType>( aStream.ReadInt32L() );
00047     }
00048 // -----------------------------------------------------------------------------
00049 // TShape::ExternalizeL()
00050 // Virtual method that writes the shape to the specified write stream.
00051 // -----------------------------------------------------------------------------
00052 //
00053 EXPORT_C void TShape::ExternalizeL( RWriteStream& aStream ) const
00054     {
00055     aStream.WriteInt32L( iShapeType );
00056     aStream.WriteInt32L( iOrigin.iX );
00057     aStream.WriteInt32L( iOrigin.iY );
00058     }
00059 
00060 // -----------------------------------------------------------------------------
00061 // TShape::InternalizeL()
00062 // Virtual method that reads the shape from the specified  read stream.
00063 // -----------------------------------------------------------------------------
00064 //
00065 EXPORT_C void TShape::InternalizeL( RReadStream& aStream )
00066     {
00067     //  iShapeType has already been read
00068     iOrigin.iX = aStream.ReadInt32L();
00069     iOrigin.iY = aStream.ReadInt32L();
00070     }
00071 
00072 
00073 // End of File

© Nokia 2009

Back to top