libcmo21/Unvirt/UnvirtContext.hpp

58 lines
1.4 KiB
C++
Raw Normal View History

2023-08-27 12:30:12 +08:00
#pragma once
#include "AccessibleValue.hpp"
#include "TerminalHelper.hpp"
#include "StructFormatter.hpp"
#include "CmdHelper.hpp"
#include <VTAll.hpp>
#include <CK2/CKContext.hpp>
#include <CK2/CKFile.hpp>
#include <cstdio>
#include <iostream>
namespace Unvirt::Context {
class UnvirtContext {
public:
UnvirtContext();
~UnvirtContext();
LIBCMO_DISABLE_COPY_MOVE(UnvirtContext);
void Run();
protected:
enum class ViewPart {
Objects, Managers
};
void PrintCommonError(const char* u8_fmt, ...);
void ProcLoad(bool is_deep, const CmdHelper::ArgumentsMap& amap);
void ProcUnLoad(const CmdHelper::ArgumentsMap& amap);
void ProcInfo(const CmdHelper::ArgumentsMap& amap);
void ProcLs(ViewPart parts, const CmdHelper::ArgumentsMap& amap);
void ProcData(ViewPart parts, const CmdHelper::ArgumentsMap& amap);
void ProcChunk(ViewPart parts, const CmdHelper::ArgumentsMap& amap);
void ProcItems(const CmdHelper::ArgumentsMap& amap);
void ProcEncoding(const CmdHelper::ArgumentsMap& amap);
void ProcTemp(const CmdHelper::ArgumentsMap& amap);
void ProcExit(const CmdHelper::ArgumentsMap& amap);
protected:
bool HasOpenedFile();
void ClearDocument();
void PrintContextMsg(LibCmo::CK2::CKSTRING msg);
CmdHelper::CommandRoot m_Root;
CmdHelper::HelpDocument* m_Help;
CmdHelper::CmdSplitter m_Splitter;
size_t m_PageLen;
bool m_OrderExit;
LibCmo::CK2::CKContext* m_Ctx;
LibCmo::CK2::CKFileReader* m_FileReader;
};
}