XPlor/libs/xassets/xmenulist.cpp

72 lines
1.1 KiB
C++
Raw Normal View History

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