further work on DrawingPage

This commit is contained in:
yorikvanhavre 2011-12-23 19:15:14 -02:00
parent eb2e4a7a73
commit a7053861b5
2 changed files with 34 additions and 1 deletions

View File

@ -56,6 +56,7 @@ FeaturePage::FeaturePage(void)
ADD_PROPERTY_TYPE(PageResult ,(0),group,App::Prop_Output,"Resulting SVG document of that page");
ADD_PROPERTY_TYPE(Template ,(""),group,App::Prop_None ,"Template for the page");
ADD_PROPERTY_TYPE(EditableTexts,(""),group,App::Prop_None,"Substitution values for the editable strings in the template");
}
FeaturePage::~FeaturePage()
@ -129,6 +130,38 @@ App::DocumentObjectExecReturn *FeaturePage::execute(void)
file.close();
ofile.close();
// checking for freecad editable texts
boost::regex e ("<text.*?freecad:editable=\"(.*?)\".*?<tspan.*?>(.*?)</tspan>",boost::regex_constants::icase);
// reading file contents
ifstream tfile (tempName.c_str());
string tline;
string fragment;
while (!tfile.eof()) {
getline (tfile,tline);
fragment += tline;
fragment += "--endOfLine--";
}
tfile.close();
//printf(fragment.c_str());
string::const_iterator start, end;
start = fragment.begin();
end = fragment.end();
//boost::smatch what;
boost::match_results<std::string::const_iterator> what;
cout << "Stored strings: " << EditableTexts.getValue();
while (boost::regex_search(start,end,what,e)) {
//cout << "match" << what.str() << endl;
cout << "new match:" << what[1] << " = " << what[2] << endl;
start = what[0].second;
}
PageResult.setValue(tempName.c_str());
//const char* text = "lskdfjlsd";

View File

@ -47,7 +47,7 @@ public:
App::PropertyFileIncluded PageResult;
App::PropertyFile Template;
App::PropertyStringList EditableTexts;
/** @name methods overide Feature */
//@{