41 position = paramString.find(searchString);
49 const char paramIndicator =
'#';
50 const char commentIndicator =
'%';
64 if (stringBuffer[stringBuffer.length() - 1] == 13) {
65 stringBuffer.replace(stringBuffer.length() - 1, 1,
"");
68 lines_.push_back(stringBuffer );
75 std::vector<std::string>::iterator iter =
lines_.begin();
76 while (iter !=
lines_.end()) {
77 while ((*iter)[0] == commentIndicator && (*iter)[1] == commentIndicator)
80 if ((*iter)[0] == paramIndicator) {
81 std::vector<std::string>::iterator iter2 = iter;
86 while (iter2 !=
lines_.end()) {
87 if ((*iter2)[0] == paramIndicator && (*iter2)[1] == paramIndicator) {
95 std::vector<std::string>::iterator tmpIter = iter2;
99 if (!((*tmpIter)[0] == paramIndicator && (*tmpIter)[1] == paramIndicator))
107 if (iter2 ==
lines_.end())
112 lines_.erase(iter, iter2);
122 while (iter !=
lines_.end()) {
123 if ((*iter).empty() || (*iter).length() == 0 || (*iter) ==
" ")
135 std::vector<std::string>::iterator iter =
lines_.begin();
138 while (iter !=
lines_.end()) {
152 std::vector<std::string>::iterator iter =
lines_.begin();
153 while (iter !=
lines_.end()) {
167 std::vector<std::string>::iterator iter =
lines_.begin();
170 while (iter !=
lines_.end()) {
172 if ((*iter).find(atLine) != std::string::npos) {
174 iter =
lines_.erase(iter);
189 std::vector<std::string>
temp =
_file.returnLines();
203 std::vector<std::string>::const_iterator iter =
lines_.begin();
204 while (iter !=
lines_.end()) {
213 std::cout <<
"Enter parametermap" << std::endl;
215 std::map<std::string, std::string>::const_iterator iter =
parameterMap_.begin();
218 std::cout << (*iter).first <<
": " << (*iter).second << std::endl;
231 if (
int pos1 =
str.find(
"$(") != std::string::npos &&
str.substr(0, 2) !=
"--") {
232 int pos2 =
str.find(
')');
255 std::vector<std::string>
temp;
256 std::vector<std::string>::const_iterator iter =
lines_.begin();
259 while (iter !=
lines_.end()) {
270 for (
unsigned int i = 0;
i <
file.lines_.size();
i++) {
278 std::vector<std::string>::iterator iter =
lines_.begin();
279 while (iter !=
lines_.end()) {
283 if (
position != std::string::npos) {
293 std::vector<std::string>::iterator iter =
lines_.begin();
295 while (iter !=
lines_.end()) {
296 if ((*iter).empty() || (*iter).length() == 0 || (*iter) ==
" ")
318 std::size_t
pos =
temp.find(
' ');
320 if (
pos != std::string::npos) {
336 std::vector<std::string> operators;
338 operators.push_back(
"AND");
339 operators.push_back(
"OR");
340 operators.push_back(
"NOT");
341 operators.push_back(
"(");
342 operators.push_back(
")");
344 for (
unsigned int i = 0;
i < operators.size();
i++) {
353 std::vector<std::string>::const_iterator iter =
lines_.begin();
354 std::ostringstream
buffer;
356 while (iter !=
lines_.end()) {
357 buffer << (*iter) << std::endl;
std::map< std::string, std::string > parameterMap_
containing the header information of internal files
static const bool findAndReplaceString(std::string ¶mString, const std::string &searchString, const std::string &replaceString)
replaces searchString with replaceString at it's first occurance in string
bool substitute(const std::string &searchString, const std::string &replaceString)
replaces searchString with replaceString
std::string lines2String() const
returns a string with the content of vector lines
bool save(const std::string &fileName)
saves the content of the template file to a local file (the content of parameterMap_ will not be save...
std::vector< std::string > getSubstitutionParametersFromTemplate() const
returns a vector with all substitution parameters that are found in the template file ...
void getConditionsFromAlgo(std::string condString, std::vector< std::string > &result) const
extracts all conditions from a algorithm
void replaceString(std::string &demangledName, std::string const &from, std::string const &to)
bool removeLineWithContent(const std::string &str)
removes all lines that contain the str
L1GtVhdlTemplateFile()
standard constructor
void print() const
prints the content of the VHDL File (only lines_)
std::vector< std::string > returnLines() const
returns a string vector with the current content of the VHDL File
void append(const std::string &str)
adds a line at the end of the the file with the content of str
std::string getInternalParameter(const std::string &indentifier)
returns a parameter of a internal template file
bool insert(const std::string &atLine, const std::vector< std::string > &content)
replaces the whole line containing atLine and inserts content instead of it
std::vector< std::string > lines_
containing the content of the VHDL file
std::map< std::string, std::string > returnParameterMap() const
returns parameter map
bool isBlank(const char &chr) const
checks weather a char is a blank
bool split(const std::string ¶m, std::vector< std::string > &result) const
seperates a string at all blanks and saves the elements in result
static int position[264][3]
void printParameterMap() const
prints the parameter map
bool extractParametersFromString(const std::string &str, std::vector< std::string > ¶meters) const
bool removeEmptyLines()
deletes all empty lines in a template file
bool open(const std::string &fileName, bool internal=false)
opens a template file. If the header information shall be parsed intern has to be set to true ...