#include "parser.h"
#include "stg/common.h"
-#include "stg/optional.h"
#include <string>
+#include <optional>
namespace STG
{
{
public:
explicit FACTORY(const Admins & admins) : m_admins(admins) {}
- virtual BASE_PARSER * create(const Admin & admin) { return new GET_ADMINS(admin, m_admins); }
+ BASE_PARSER * create(const Admin & admin) override { return new GET_ADMINS(admin, m_admins); }
static void Register(REGISTRY & registry, const Admins & admins)
{ registry[ToLower(tag)] = new FACTORY(admins); }
private:
private:
const Admins & m_admins;
- void CreateAnswer();
+ void CreateAnswer() override;
};
class ADD_ADMIN: public BASE_PARSER
{
public:
explicit FACTORY(Admins & admins) : m_admins(admins) {}
- virtual BASE_PARSER * create(const Admin & admin) { return new ADD_ADMIN(admin, m_admins); }
+ BASE_PARSER * create(const Admin & admin) override { return new ADD_ADMIN(admin, m_admins); }
static void Register(REGISTRY & registry, Admins & admins)
{ registry[ToLower(tag)] = new FACTORY(admins); }
private:
ADD_ADMIN(const Admin & admin, Admins & admins)
: BASE_PARSER(admin, tag), m_admins(admins) {}
- int Start(void * data, const char * el, const char ** attr);
+ int Start(void * data, const char * el, const char ** attr) override;
private:
std::string m_admin;
Admins & m_admins;
- void CreateAnswer();
+ void CreateAnswer() override;
};
class DEL_ADMIN: public BASE_PARSER
{
public:
explicit FACTORY(Admins & admins) : m_admins(admins) {}
- virtual BASE_PARSER * create(const Admin & admin) { return new DEL_ADMIN(admin, m_admins); }
+ BASE_PARSER * create(const Admin & admin) override { return new DEL_ADMIN(admin, m_admins); }
static void Register(REGISTRY & registry, Admins & admins)
{ registry[ToLower(tag)] = new FACTORY(admins); }
private:
DEL_ADMIN(const Admin & admin, Admins & admins)
: BASE_PARSER(admin, tag), m_admins(admins) {}
- int Start(void * data, const char * el, const char ** attr);
+ int Start(void * data, const char * el, const char ** attr) override;
private:
std::string m_admin;
Admins & m_admins;
- void CreateAnswer();
+ void CreateAnswer() override;
};
class CHG_ADMIN: public BASE_PARSER
{
public:
explicit FACTORY(Admins & admins) : m_admins(admins) {}
- virtual BASE_PARSER * create(const Admin & admin) { return new CHG_ADMIN(admin, m_admins); }
+ BASE_PARSER * create(const Admin & admin) override { return new CHG_ADMIN(admin, m_admins); }
static void Register(REGISTRY & registry, Admins & admins)
{ registry[ToLower(tag)] = new FACTORY(admins); }
private:
CHG_ADMIN(const Admin & admin, Admins & admins)
: BASE_PARSER(admin, tag), m_admins(admins) {}
- int Start(void * data, const char * el, const char ** attr);
+ int Start(void * data, const char * el, const char ** attr) override;
private:
std::string login;
- Optional<std::string> password;
- Optional<std::string> privAsString;
+ std::optional<std::string> password;
+ std::optional<std::string> privAsString;
Admins & m_admins;
- void CreateAnswer();
+ void CreateAnswer() override;
};
} // namespace PARSER