strlist.cpp
来自「XOSL 多操作系统管理工具 源代码 多系统引导工具」· C++ 代码 · 共 61 行
CPP
61 行
/*
* Extended Operating System Loader (XOSL)
* Copyright (c) 1999 by Geurt Vos
*
* This code is distributed under GNU General Public License (GPL)
*
* The full text of the license can be found in the GPL.TXT file,
* or at http://www.gnu.org
*/
#include <strlist.h>
static const char *EmptyString = "";
CStringList::CStringList(int Count)
{
int Item;
this->Count = Count;
Items = new TPCString[Count];
for (Item = 0; Item < Count; ++Item)
Items[Item].String = new CString;
}
CStringList::~CStringList()
{
int Item;
for (Item = 0; Item < Count; ++Item)
delete Items[Item].String;
delete Items;
}
void CStringList::Insert(int Index, const char *String)
{
if (Index >= Count)
return;
*Items[Index].String = String;
}
void CStringList::Delete(int Index)
{
if (Index >= Count)
return;
*Items[Index].String = EmptyString;
}
const char *CStringList::Get(int Index)
{
if (Index >= Count)
return EmptyString;
return *Items[Index].String;
}
void CStringList::Clear()
{
int Index;
for (Index = 0; Index < Count; ++Index)
*Items[Index].String = EmptyString;
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?