libcmo21/LibCmo/CK2/ObjImpls/CKGroup.hpp
2023-08-31 21:54:25 +08:00

54 lines
1.3 KiB
C++

#pragma once
#include "../../VTAll.hpp"
#include "CKBeObject.hpp"
namespace LibCmo::CK2::ObjImpls {
class CKGroup : public CKBeObject {
public:
CKGroup(CKContext* ctx, CK_ID ckid, CKSTRING name) :
CKBeObject(ctx, ckid, name),
m_ObjectArray(),
m_GroupIndex() // todo: allocate group id
{}
virtual ~CKGroup() {
// todo: free allocated group id
}
LIBCMO_DISABLE_COPY_MOVE(CKGroup);
virtual CK_CLASSID GetClassID(void) override {
return CK_CLASSID::CKCID_GROUP;
}
//virtual void PreSave(CKFileVisitor* file, CKDWORD flags) override;
virtual bool Save(CKStateChunk* chunk, CKFileVisitor* file, CKDWORD flags) override;
virtual bool Load(CKStateChunk* chunk, CKFileVisitor* file) override;
//virtual void PostLoad() override;
CKDWORD GetGroupIndex();
// ===== Insert =====
CKERROR AddObject(CKBeObject *o);
CKERROR AddObjectFront(CKBeObject *o);
CKERROR InsertObjectAt(CKBeObject *o, CKDWORD pos);
// ===== Remove =====
CKBeObject* RemoveObject(CKDWORD pos);
void RemoveObject(CKBeObject *obj);
void Clear();
// ===== Order =====
void MoveObjectUp(CKBeObject *o);
void MoveObjectDown(CKBeObject *o);
// ===== Access =====
CKObject* GetObject(CKDWORD pos);
CKDWORD GetObjectCount();
protected:
XContainer::XObjectPointerArray m_ObjectArray;
CKDWORD m_GroupIndex;
};
}