#include "xitemkeyhandler.h"

XItemKeyHandler::XItemKeyHandler()
    : XAsset()
    , mKey(0)
    , mAction()
    , mNext(nullptr)
{
    
}

XItemKeyHandler::~XItemKeyHandler()
{
    
}

void XItemKeyHandler::ParseData(QDataStream *aStream)
{
    if (GetPtr() == -1)
    {
        *aStream >> mKey;

        mAction.ParsePtr(aStream, false);

        qint32 nextPtr;
        *aStream >> nextPtr;

        mAction.ParseData(aStream);

        if (nextPtr)
        {
            mNext = new XItemKeyHandler();
            mNext->ParseData(aStream);
        }
    }
}

void XItemKeyHandler::Clear()
{
    mKey = 0;
    mAction.Clear();
    mNext = nullptr;
}
