forked from ars3niy/tdlib-purple
-
Notifications
You must be signed in to change notification settings - Fork 8
/
format.h
29 lines (22 loc) · 715 Bytes
/
format.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#ifndef _FORMAT_H
#define _FORMAT_H
#include <string>
#include <purple.h>
#include "translate.h"
#include "config.h"
std::string formatMessage(const char *fmt, std::initializer_list<std::string> args);
std::string formatMessage(const char *fmt, const std::string &s);
template<typename T>
std::string formatMessage(const char *fmt, T arg)
{
return formatMessage(fmt, {std::to_string(arg)});
}
std::string formatDuration(int32_t seconds);
void purpleDebug(const char *fmt, std::initializer_list<std::string> args);
template<typename T>
void purpleDebug(const char *fmt, T arg)
{
std::string message = formatMessage(fmt, arg);
purple_debug_misc(config::pluginId, "%s\n", message.c_str());
}
#endif