ot_stack.cpp
来自「在手机操作系统symbina上使用的一个脚本扩展语言的代码实现,可以参考用于自己」· C++ 代码 · 共 56 行
CPP
56 行
// OT_STACK.CPP
//
// Copyright (c) 1997-1999 Symbian Ltd. All rights reserved.
//
#include "ot_std.h"
////////////////////////////////////////////////////////////////
//
// CTranStackBase
//
////////////////////////////////////////////////////////////////
EXPORT_C void CTranStackBase::Drop()
//
// Drops the last item off the stack
//
{
Delete(Index(0),1);
}
EXPORT_C const TAny* CTranStackBase::Peek(TInt aDepth) const
//
//Pointer to item down the stack
//
{
return At(Index(aDepth));
}
EXPORT_C void CTranStackBase::Pick(TAny* aPtr,TInt aDepth)
//
// Temove an itenm from the middle of the stack
//
{
Mem::Copy(aPtr,Peek(aDepth),Length());
Delete(Index(aDepth),1);
}
TUint CTranStackBase::Index(TInt aDepth) const
//
// Converst a stack depth into an array index.
// This would be where to have an underflow panic, if separate from the
// EArray.. bounds checking panic
//
{
return Count()-(aDepth+1);
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?