102 lines
2.0 KiB
C++
102 lines
2.0 KiB
C++
#pragma once
|
|
#include "common.hpp"
|
|
|
|
class ComputerComponent
|
|
{
|
|
public:
|
|
ComputerComponent(string name) :m_name(name) {}
|
|
virtual void showInfo(string indent = "") = 0;
|
|
virtual bool isComposite();
|
|
virtual void startup(string indent = "");
|
|
virtual void shutdown(string indent = "");
|
|
|
|
protected:
|
|
string m_name;
|
|
};
|
|
|
|
class CPU :public ComputerComponent
|
|
{
|
|
public:
|
|
CPU(string name) :ComputerComponent(name) {}
|
|
void showInfo(string indent);
|
|
};
|
|
|
|
class MemoryCard :public ComputerComponent
|
|
{
|
|
public:
|
|
MemoryCard(string name) :ComputerComponent(name) {}
|
|
void showInfo(string indent);
|
|
};
|
|
|
|
class HardDisk :public ComputerComponent
|
|
{
|
|
public:
|
|
HardDisk(string name) :ComputerComponent(name) {}
|
|
void showInfo(string indent);
|
|
};
|
|
|
|
class GraphicsCard :public ComputerComponent
|
|
{
|
|
public:
|
|
GraphicsCard(string name) :ComputerComponent(name) {}
|
|
void showInfo(string indent);
|
|
};
|
|
|
|
class Battery :public ComputerComponent
|
|
{
|
|
public:
|
|
Battery(string name) :ComputerComponent(name) {}
|
|
void showInfo(string indent);
|
|
};
|
|
|
|
class Fan :public ComputerComponent
|
|
{
|
|
public:
|
|
Fan(string name) :ComputerComponent(name) {}
|
|
void showInfo(string indent);
|
|
};
|
|
|
|
class Displayer :public ComputerComponent
|
|
{
|
|
public:
|
|
Displayer(string name) :ComputerComponent(name) {}
|
|
void showInfo(string indent);
|
|
};
|
|
|
|
class ComputerCompsite :public ComputerComponent
|
|
{
|
|
public:
|
|
ComputerCompsite(string name) :ComputerComponent(name) {};
|
|
void showInfo(string indent);
|
|
bool isComposite();
|
|
|
|
void addComponent(ComputerComponent* component);
|
|
void removeComponent(ComputerComponent* component);
|
|
|
|
void startup(string indent);
|
|
void shutdown(string indent);
|
|
|
|
private:
|
|
vector<ComputerComponent*> m_components; // ×é³É³É·Ö
|
|
};
|
|
|
|
class Mainboard :public ComputerCompsite
|
|
{
|
|
public:
|
|
Mainboard(string name) :ComputerCompsite(name) {};
|
|
void showInfo(string indent);
|
|
};
|
|
|
|
class ComputerCase :public ComputerCompsite
|
|
{
|
|
public:
|
|
ComputerCase(string name) :ComputerCompsite(name) {};
|
|
void showInfo(string indent);
|
|
};
|
|
|
|
class Computer :public ComputerCompsite
|
|
{
|
|
public:
|
|
Computer(string name) :ComputerCompsite(name) {};
|
|
void showInfo(string indent);
|
|
}; |