mirror of
				https://projects.vdr-developer.org/git/vdr-plugin-skindesigner.git
				synced 2023-10-19 15:58:31 +00:00 
			
		
		
		
	fixed bug that global tokens were not parsed correctly
This commit is contained in:
		
							
								
								
									
										1
									
								
								HISTORY
									
									
									
									
									
								
							
							
						
						
									
										1
									
								
								HISTORY
									
									
									
									
									
								
							| @@ -190,3 +190,4 @@ Version 0.2.0 | ||||
|  | ||||
| Version 0.2.1 | ||||
|  | ||||
| - fixed bug that global tokens were not parsed correctly | ||||
|   | ||||
| @@ -73,12 +73,15 @@ void cGlobals::ReplaceIntVars(string &value) { | ||||
|         stringstream sToken; | ||||
|         sToken << "{" << it->first << "}"; | ||||
|         string token = sToken.str(); | ||||
|         size_t foundToken = value.find(token); | ||||
|         if (foundToken != string::npos) { | ||||
|             stringstream st; | ||||
|             st << it->second; | ||||
|             value = value.replace(foundToken, token.size(), st.str()); | ||||
|         } | ||||
|         size_t foundToken = string::npos; | ||||
|         do { | ||||
|             foundToken = value.find(token); | ||||
|             if (foundToken != string::npos) { | ||||
|                 stringstream st; | ||||
|                 st << it->second; | ||||
|                 value = value.replace(foundToken, token.size(), st.str()); | ||||
|             } | ||||
|         } while (foundToken != string::npos); | ||||
|     } | ||||
| } | ||||
|  | ||||
| @@ -107,18 +110,21 @@ void cGlobals::ReplaceDoubleVars(string &value) { | ||||
|         stringstream sToken; | ||||
|         sToken << "{" << it->first << "}"; | ||||
|         string token = sToken.str(); | ||||
|         size_t foundToken = value.find(token); | ||||
|         if (foundToken != string::npos) { | ||||
|             stringstream st; | ||||
|             st << it->second; | ||||
|             string doubleVal = st.str(); | ||||
|             if (config.replaceDecPoint) { | ||||
|                 if (doubleVal.find_first_of('.') != string::npos) { | ||||
|                     std::replace( doubleVal.begin(), doubleVal.end(), '.', config.decPoint); | ||||
|         size_t foundToken = string::npos; | ||||
|         do { | ||||
|             foundToken = value.find(token); | ||||
|             if (foundToken != string::npos) { | ||||
|                 stringstream st; | ||||
|                 st << it->second; | ||||
|                 string doubleVal = st.str(); | ||||
|                 if (config.replaceDecPoint) { | ||||
|                     if (doubleVal.find_first_of('.') != string::npos) { | ||||
|                         std::replace( doubleVal.begin(), doubleVal.end(), '.', config.decPoint); | ||||
|                     } | ||||
|                 } | ||||
|                 value = value.replace(foundToken, token.size(), doubleVal); | ||||
|             } | ||||
|             value = value.replace(foundToken, token.size(), doubleVal); | ||||
|         } | ||||
|         } while (foundToken != string::npos); | ||||
|     }     | ||||
| } | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user