37 lines
775 B
C++
37 lines
775 B
C++
// SPDX-FileCopyrightText: 2024 Yury Gubich <blue@macaw.me>
|
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
#pragma once
|
|
|
|
#include <string>
|
|
#include <memory>
|
|
#include <vector>
|
|
|
|
#include "component/core.h"
|
|
#include "component/actor.h"
|
|
#include "connection/connection.h"
|
|
|
|
namespace Module {
|
|
|
|
class Module {
|
|
public:
|
|
typedef std::vector<std::string> Tokens;
|
|
|
|
protected:
|
|
Module(const std::shared_ptr<Core>& core, const std::shared_ptr<Connection>& connection);
|
|
|
|
public:
|
|
virtual ~Module() noexcept;
|
|
|
|
static Tokens split(const std::string& string, const std::string& delimiter = " ");
|
|
|
|
virtual void message(const std::shared_ptr<Actor>& actor, const Tokens& args) = 0;
|
|
|
|
protected:
|
|
std::shared_ptr<Core> core;
|
|
std::shared_ptr<Connection> connection;
|
|
|
|
};
|
|
|
|
}
|