41 lines
1.1 KiB
C++
41 lines
1.1 KiB
C++
//SPDX-FileCopyrightText: 2024 Yury Gubich <blue@macaw.me>
|
|
//SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
#include "currency.h"
|
|
|
|
DB::Currency::Currency ():
|
|
id(0),
|
|
code(),
|
|
title(),
|
|
manual(false),
|
|
icon()
|
|
{}
|
|
|
|
DB::Currency::Currency (const std::vector<std::any>& vec):
|
|
id(std::any_cast<uint32_t>(vec[0])),
|
|
code(std::any_cast<const std::string&>(vec[1])),
|
|
title(std::any_cast<const std::string&>(vec[2])),
|
|
manual(std::any_cast<uint8_t>(vec[3])),
|
|
icon(std::any_cast<const std::string&>(vec[4]))
|
|
{}
|
|
|
|
void DB::Currency::parse (const std::vector<std::any>& vec) {
|
|
id = std::any_cast<uint32_t>(vec[0]);
|
|
code = std::any_cast<const std::string&>(vec[1]);
|
|
title = std::any_cast<const std::string&>(vec[2]);
|
|
manual = std::any_cast<uint8_t>(vec[3]);
|
|
icon = std::any_cast<const std::string&>(vec[4]);
|
|
}
|
|
|
|
nlohmann::json DB::Currency::toJSON () const {
|
|
nlohmann::json result = nlohmann::json::object();
|
|
|
|
result["id"] = id;
|
|
result["code"] = code;
|
|
result["title"] = title;
|
|
result["manual"] = manual;
|
|
result["icon"] = icon;
|
|
|
|
return result;
|
|
}
|