mirror of
https://github.com/mudita/MuditaOS.git
synced 2026-01-24 22:08:33 -05:00
Introduce a new way to handle query responses allowing to deal with races: - bind reponse with request, - handle responses with an observer-like interface. Signed-off-by: Marcin Smoczyński <smoczynski.marcin@gmail.com>
58 lines
1.3 KiB
C++
58 lines
1.3 KiB
C++
#pragma once
|
|
|
|
#include <memory>
|
|
|
|
namespace db
|
|
{
|
|
|
|
class Query;
|
|
class QueryResult;
|
|
|
|
class Interface
|
|
{
|
|
public:
|
|
virtual std::unique_ptr<db::QueryResult> runQuery(std::shared_ptr<db::Query> query);
|
|
|
|
enum class Name
|
|
{
|
|
Settings,
|
|
SMS,
|
|
SMSThread,
|
|
SMSTemplate,
|
|
Contact,
|
|
Alarms,
|
|
Notes,
|
|
Calllog,
|
|
CountryCodes,
|
|
Notifications
|
|
};
|
|
};
|
|
}; // namespace db
|
|
|
|
constexpr const char *c_str(enum db::Interface::Name db)
|
|
{
|
|
switch (db) {
|
|
case db::Interface::Name::Settings:
|
|
return "Settings";
|
|
case db::Interface::Name::SMS:
|
|
return "SMS";
|
|
case db::Interface::Name::SMSThread:
|
|
return "SMSThread";
|
|
case db::Interface::Name::SMSTemplate:
|
|
return "SMSTemplate";
|
|
case db::Interface::Name::Contact:
|
|
return "Contact";
|
|
case db::Interface::Name::Alarms:
|
|
return "Alarms";
|
|
case db::Interface::Name::Notes:
|
|
return "Notes";
|
|
case db::Interface::Name::Calllog:
|
|
return "Callog";
|
|
case db::Interface::Name::CountryCodes:
|
|
return "CountryCodes";
|
|
case db::Interface::Name::Notifications:
|
|
return "Notifications";
|
|
};
|
|
return "";
|
|
}
|