📄 typelist.h
字号:
/*
*typelist.h
*----------
*typelist类,不需要修改此文件
*/
#ifndef _H_TypeList
#define _H_TypeList
#include "utility.h"
class Type;
class TypeList {
private:
Type * types[MaxDecla];
int loc;
public:
// Create a new empty list
TypeList() {loc=0;}
// Returns count of elements currently in list
int NumElements()
{ return loc;}
// Returns declaration at index in list. Indexing is 0-based.
// Raises an assert if index is out of range.
Type *Nth(int index)
{ Assert(index >= 0 && index < loc);
return types[index];}
// Inserts declaration at index, shuffling over others
// Raises assert if index out of range
void InsertAt(Type *d, int index)
{ Assert(index >= 0 && index <= loc);
for(int i=loc+1;i>index;i--)
types[i]=types[i-1];
types[index]=d;
loc++;
}
// Adds declaration to list end
void Append(Type *d)
{
types[loc]=d;
loc++;
}
// Removes declaration at index, shuffling down others
// Raises assert if index out of range
void RemoveAt(int index)
{ Assert(index >= 0 && index < loc);
for(int i=index;i<loc;i++)
types[i]=types[i+1];
loc--;
}
};
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -