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

Method processTemplate

plugins/plugin_utils/plugin_HTTP.cpp:948–989  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

946}
947
948void Templateiser::processTemplate(std::string& code, const std::string& templateText) {
949 std::string::const_iterator templateItr = templateText.begin();
950
951 while (templateItr != templateText.end()) {
952 if (*templateItr != '[') {
953 code += *templateItr;
954 templateItr++;
955 }
956 else {
957 templateItr++;
958
959 if (templateItr == templateText.end()) {
960 code += '[';
961 }
962 else {
963 switch (*templateItr) {
964 default: // it's not a code, so just let the next loop hit it and output it
965 break;
966
967 case '$':
968 replaceVar(code, ++templateItr, templateText);
969 break;
970
971 case '*':
972 processLoop(code, ++templateItr, templateText);
973 break;
974
975 case '?':
976 processIF(code, ++templateItr, templateText);
977 break;
978 case '-':
979 case '#': // treat metadata as comments when parsing
980 processComment(code, ++templateItr, templateText);
981 break;
982 case '!':
983 processInclude(code, ++templateItr, templateText);
984 break;
985 }
986 }
987 }
988 }
989}
990
991void Templateiser::getTemplateMetaData(TemplateMetaData& metadata, const std::string& templateText) {
992 size_t pos = 0;

Callers 5

doStatReportMethod · 0.80
doPlayerReportMethod · 0.80
doFlagReportMethod · 0.80
handleAuthedRequestMethod · 0.80
generatePageMethod · 0.80

Calls 2

beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected