aboutsummaryrefslogtreecommitdiff
path: root/MemDriverWeb/minitmpl.cpp
diff options
context:
space:
mode:
authorToni Uhlig <matzeton@googlemail.com>2019-07-28 21:44:14 +0200
committerToni Uhlig <matzeton@googlemail.com>2019-07-28 21:44:14 +0200
commitb5ae90cc23068f20720cae9d0f27f0dcddf6c1cb (patch)
tree88b9855672c62c8b72b4b38e7a5f68932f5cfaa1 /MemDriverWeb/minitmpl.cpp
parente2591d1d2ef4b456540abf3167a5cf2547c665c4 (diff)
added KMemDriver Interface Thread, Status template callback
Diffstat (limited to 'MemDriverWeb/minitmpl.cpp')
-rw-r--r--MemDriverWeb/minitmpl.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/MemDriverWeb/minitmpl.cpp b/MemDriverWeb/minitmpl.cpp
index 3d7c34c..92ac44e 100644
--- a/MemDriverWeb/minitmpl.cpp
+++ b/MemDriverWeb/minitmpl.cpp
@@ -1,17 +1,20 @@
#include "pch.h"
#include "minitmpl.h"
-std::map<std::string, template_cb> TemplateString::template_callbacks;
+std::map<std::string, std::pair<template_cb, std::pair<bool, void *>>> TemplateString::template_callbacks;
std::string TemplateString::doTemplateStr() {
- size_t pos = 0;
+ size_t pos;
in_cache = str();
- out_cache.clear();
for (auto& key : template_callbacks) {
+ pos = 0;
while ((pos = in_cache.find(key.first, pos)) != std::string::npos) {
- in_cache.replace(pos, key.first.length(), key.second(out_cache));
- pos += out_cache.length();
+ in_cache.replace(pos, key.first.length(), key.second.first(out_cache, key.second.second.second));
+ if (!key.second.second.first ) {
+ pos += out_cache.length();
+ }
+ out_cache.clear();
}
}