MCPcopy Create free account
hub / github.com/BZFlag-Dev/bzflag / getTemplateMetaData

Method getTemplateMetaData

plugins/plugin_utils/plugin_HTTP.cpp:991–1009  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

989}
990
991void Templateiser::getTemplateMetaData(TemplateMetaData& metadata, const std::string& templateText) {
992 size_t pos = 0;
993 while (pos < templateText.size() && pos != std::string::npos) {
994 pos = find_first_substr(templateText, std::string("[#"), pos);
995 if (pos < templateText.size() && pos != std::string::npos) {
996 size_t start = pos;
997
998 pos = find_first_substr(templateText, std::string("]"), pos);
999 if (pos < templateText.size() && pos != std::string::npos) {
1000 std::string dataKey = getStringRange(templateText, start + 2, pos - 1);
1001
1002 std::vector<std::string> chunks = tokenize(dataKey, std::string(":"), 0, true);
1003 if (chunks.size() > 1) {
1004 metadata.add(chunks[0], chunks[1]);
1005 }
1006 }
1007 }
1008 }
1009}
1010
1011bool Templateiser::getTemplateFileMetaData(TemplateMetaData& metadata, const char* file) {
1012 if (!file) {

Callers

nothing calls this directly

Calls 5

find_first_substrFunction · 0.85
getStringRangeFunction · 0.85
tokenizeFunction · 0.70
sizeMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected