XPlor/libs/xassets/xmenulist.cpp
2025-09-10 21:58:26 -04:00

72 lines
1.1 KiB
C++

#include "xmenulist.h"
XMenuList::XMenuList()
: XAsset()
, mName(new XString())
, mMenuCount(0)
, mMenus(QVector<XMenuDef*>())
{
SetType(ASSET_TYPE_MENULIST);
XAsset::SetName("Menu List");
}
XMenuList::~XMenuList()
{
for (int i = 0; i < mMenus.size(); i++)
{
delete mMenus[i];
}
delete mName;
}
void XMenuList::SetName(XString *aName)
{
mName = aName;
}
XString *XMenuList::GetName() const
{
return mName;
}
int XMenuList::GetMenuCount() const
{
return mMenuCount;
}
void XMenuList::SetMenuEntry(int aIndex, XMenuDef *aMenuDef)
{
mMenus[aIndex] = aMenuDef;
}
XMenuDef *XMenuList::GetMenuEntry(int aIndex) const
{
return mMenus[aIndex];
}
void XMenuList::Clear()
{
for (int i = 0; i < mMenus.size(); i++)
{
delete mMenus[i];
}
mName->Clear();
mMenuCount = 0;
mMenus.clear();
}
void XMenuList::ParseData(XDataStream *aStream)
{
mName->ParsePtr(aStream, false);
*aStream
>> mMenuCount;
for (int i = 0; i < mMenuCount; i++)
{
//XMenuDef* newMenu = new XMenuDef();
}
}