SWC-DB
v0.5.12 C++ documentations
SWC-DB© (Super Wide Column Database) - High Performance Scalable Database (https://github.com/kashirin-alex/swc-db)
String.h
Go to the documentation of this file.
1
/*
2
* SWC-DB© Copyright since 2019 Alex Kashirin <kashirin.alex@gmail.com>
3
* License details at <https://github.com/kashirin-alex/swc-db/#license>
4
*/
5
6
7
#ifndef swcdb_core_String_h
8
#define swcdb_core_String_h
9
10
11
#include <string>
12
#include <sstream>
13
14
15
namespace
SWC
{
16
17
24
std::string
format
(
const
char
* fmt, ...)
25
__attribute__
((
format
(printf, 1, 2)));
26
27
SWC_PRAGMA_DIAGNOSTIC_PUSH
28
SWC_PRAGMA_DIAGNOSTIC_IGNORED
("-Wformat-nonliteral")
29
std::
string
format_unsafe(const
char
* fmt, ...);
30
SWC_PRAGMA_DIAGNOSTIC_POP
31
32
33
template <typename SequenceT>
34
std::
string
format_list
(const SequenceT &seq, const
char
*sep = ", ") {
35
if
(seq.empty())
36
return
"[]"
;
37
38
auto
it = seq.cbegin();
39
auto
end = seq.cend();
40
41
std::ostringstream out;
42
out <<
'['
;
43
more:
44
out << *it;
45
if
(++it != end) {
46
out << sep;
47
goto
more;
48
}
49
out <<
']'
;
50
51
return
out.str();
52
}
53
54
58
}
59
60
#ifdef SWC_IMPL_SOURCE
61
#include "
swcdb/core/String.cc
"
62
#endif
63
64
#endif // swcdb_core_String_h
SWC
The SWC-DB C++ namespace 'SWC'.
Definition:
main.cc:12
SWC::SWC_PRAGMA_DIAGNOSTIC_IGNORED
SWC_PRAGMA_DIAGNOSTIC_PUSH SWC_PRAGMA_DIAGNOSTIC_IGNORED("-Wformat-nonliteral") std
Definition:
String.cc:34
String.cc
SWC::format
std::string format(const char *fmt,...) __attribute__((format(printf
Definition:
String.cc:17
SWC::format_list
std::string SWC_PRAGMA_DIAGNOSTIC_PUSH SWC_PRAGMA_DIAGNOSTIC_IGNORED("-Wformat-nonliteral") std SWC_PRAGMA_DIAGNOSTIC_POP std::string format_list(const SequenceT &seq, const char *sep=", ")
Definition:
String.h:34
__attribute__
const char * __attribute__((const)) swcdb_version() noexcept
include
swcdb
core
String.h
Generated on Sat Jun 3 2023 18:00:06 for SWC-DB by
1.8.20