bosseng.h

来自「《SymbianOSC手机应用开发》源码」· C头文件 代码 · 共 46 行

H
46
字号
// bosseng.h
//
// Copyright (c) 2000 Symbian Ltd.  All rights reserved.

#ifndef __BOSSENG_H
#define __BOSSENG_H

#include <e32std.h>
#include <s32stor.h>

class TBossPuzzle
	{
public:
	enum TMoveType { EUp, EDown, ELeft, ERight }; // types of move
public:
	// construct
	IMPORT_C TBossPuzzle();
	// initialize state
	IMPORT_C void SetFullyOrdered(); // all tiles in order
	IMPORT_C void SetBossOrdered(); // 14 and 15 swapped
	// inquiry
	IMPORT_C TBool IsFullyOrdered() const;
	IMPORT_C TBool IsBlank(TInt aRow, TInt aCol) const;
	IMPORT_C const TInt& Tile(TInt aRow, TInt aCol) const;
	IMPORT_C TInt& Tile(TInt aRow, TInt aCol);
	IMPORT_C void LocateTile(TInt aTileNumber, TInt& aRow, TInt& aCol) const;
	IMPORT_C void LocateBlank(TInt& aRow, TInt& aCol) const;
	// whether various moves are possible
	IMPORT_C TBool CanMove(TMoveType aMoveType) const;
	IMPORT_C TBool CanMove(TInt aRow, TInt aCol) const;
	IMPORT_C TMoveType CanMoveType(TInt aRow, TInt aCol) const;
	// moving - these functions panic if impossible
	IMPORT_C void Move(TMoveType aMoveType);
	IMPORT_C void Move(TInt aRow, TInt aCol);
	// stream persistence
	IMPORT_C void ExternalizeL(RWriteStream& aStream) const;
	IMPORT_C void InternalizeL(RReadStream& aStream);
	// store and restore
	IMPORT_C TStreamId StoreL(CStreamStore& aStore) const;
	IMPORT_C void RestoreL(const CStreamStore& aStore, TStreamId aStreamId);
private:
	TInt iTiles[16]; // simple C array for tiles
	};

#endif

⌨️ 快捷键说明

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