summaryrefslogtreecommitdiff
path: root/include/mbgl/util/string.hpp
diff options
context:
space:
mode:
authorKonstantin Käfer <mail@kkaefer.com>2014-07-16 18:53:56 -0700
committerKonstantin Käfer <mail@kkaefer.com>2014-07-16 18:53:56 -0700
commit4ea281c750c5afcc68f2832bb42d98a1cbce6735 (patch)
tree60bc7d3ccba2c54859e2e023997cc027cc67aea7 /include/mbgl/util/string.hpp
parentc1a64dc5fa73b54cc5de77629781dfc74302a1e7 (diff)
downloadqtlocation-mapboxgl-4ea281c750c5afcc68f2832bb42d98a1cbce6735.tar.gz
rename llmr => mbgl
Diffstat (limited to 'include/mbgl/util/string.hpp')
-rw-r--r--include/mbgl/util/string.hpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/include/mbgl/util/string.hpp b/include/mbgl/util/string.hpp
new file mode 100644
index 0000000000..f17d55cec3
--- /dev/null
+++ b/include/mbgl/util/string.hpp
@@ -0,0 +1,24 @@
+#ifndef MBGL_UTIL_STRING
+#define MBGL_UTIL_STRING
+
+#include <string>
+
+namespace mbgl {
+namespace util {
+
+template<size_t max, typename... Args>
+inline std::string sprintf(const char *msg, Args... args) {
+ char res[max];
+ int len = snprintf(res, sizeof(res), msg, args...);
+ return std::string(res, len);
+}
+
+template<size_t max, typename... Args>
+inline std::string sprintf(const std::string &msg, Args... args) {
+ return sprintf<max>(msg.c_str(), args...);
+}
+
+}
+}
+
+#endif