42 size_t opening=txt.find(
"<<");
45 while (opening!=std::string::npos){
46 closing=txt.find(
">>",opening+1);
47 std::string tagName=txt.substr(opening+2,closing-opening-2);
49 opening=txt.find(
"<<",closing+1);
63 std::string
stencil::getTemplate (std::string& Template, std::string& ID, std::map<std::string,std::string>& UserValues){
65 std::string FilledOutModel =
states;
66 size_t beginposition=FilledOutModel.find(
"<<");
69 while (beginposition!=std::string::npos){
70 endposition=FilledOutModel.find(
">>",beginposition+1);
75 std::string tagName=FilledOutModel.substr(beginposition+2,endposition-beginposition-2);
76 std::string ValueToFill = UserValues[tagName];
77 FilledOutModel.replace(beginposition,(endposition+2-beginposition),ValueToFill);
78 beginposition=FilledOutModel.find(
"<<",endposition+1);
81 beginposition=FilledOutModel.find(
"((");
83 while (beginposition!=std::string::npos){
84 endposition=FilledOutModel.find(
"))",beginposition+1);
86 std::string tagName=FilledOutModel.substr(beginposition+2,endposition-beginposition-2);
87 std::string ValueToFill = tagName + ID;
88 FilledOutModel.replace(beginposition,(endposition+2-beginposition),ValueToFill);
89 beginposition=FilledOutModel.find(
"((",endposition+1);
91 return FilledOutModel;
101 std::map<std::string,stencil*>::iterator it;
103 std::string key = (*it).first;
112 std::string copyofpassedstring = model_temp;
113 size_t model_end_position=model_temp.find(
"TEMPLATE: ",10);
114 size_t model_start_position=0;
115 std::string modelstring =
"";
116 std::string stenName;
117 size_t stenNameStart = 10;
119 while (model_start_position!=std::string::npos){
121 if (stencil_to_push==NULL){
122 std::cerr <<
"OUT OF MEMORY\nFile" << __FILE__ <<
"Line:\t"<< __LINE__ << std::endl;
126 model_end_position=copyofpassedstring.find(
"TEMPLATE: ",(model_start_position + 10)) - 1;
128 modelstring=model_temp.substr(model_start_position,model_end_position - model_start_position);
130 stenNameEnd=modelstring.find(
"\n");
132 stenName=model_temp.substr(stenNameStart,stenNameEnd-stenNameStart);
134 stencil_to_push->
parse(modelstring);
136 temps[stenName] = stencil_to_push;
137 model_start_position=model_end_position + 1;
157 std::string FilledOutModel =
temps[Template]->getTemplate(Template,ID,UserVals);
158 return FilledOutModel;