49 lines
956 B
C++
Executable File
49 lines
956 B
C++
Executable File
|
|
|
|
|
|
#include "function_reply_object.h"
|
|
#include <QtCore/QString>
|
|
#include <QtCore/QCoreApplication>
|
|
|
|
namespace Core
|
|
{
|
|
|
|
FunctionReplyObject &FunctionReplyObject::arg(qint64 val)
|
|
{
|
|
m_args.push_back(std::to_string(val));
|
|
return *this;
|
|
}
|
|
|
|
FunctionReplyObject &FunctionReplyObject::arg(const std::string &str)
|
|
{
|
|
m_args.push_back(str);
|
|
return *this;
|
|
}
|
|
|
|
FunctionReplyObject &FunctionReplyObject::arg(const QString &str)
|
|
{
|
|
m_args.push_back(str.toStdString());
|
|
return *this;
|
|
}
|
|
|
|
std::string FunctionReplyObject::operator()() const
|
|
{
|
|
if (m_args.empty())
|
|
return m_str;
|
|
|
|
QString ret(QString::fromStdString(m_str));
|
|
for (const std::string &s : m_args)
|
|
ret = ret.arg(QString::fromStdString(s));
|
|
return ret.toStdString();
|
|
}
|
|
|
|
QString FunctionReplyObject::translated() const
|
|
{
|
|
QString ret(QCoreApplication::translate("dds", m_str.c_str()));
|
|
for (const std::string &s : m_args)
|
|
ret = ret.arg(QString::fromStdString(s));
|
|
return ret;
|
|
}
|
|
|
|
}
|