Kiln » TortoiseHg » TortoiseHg
Clone URL:  
Pushed to one repository · View In Graph Contained in 0.8, 0.8.1, and 0.8.2

shellext: remove unused ReplaceParams

Changeset 2f70efc4a754

Parent 2b7189079f30

by Adrian Buehlmann

Changes to 2 files · Browse files at 2f70efc4a754 Showing diff from parent 2b7189079f30 Diff from another changeset...

 
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
 
218
219
220
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
@@ -218,83 +218,3 @@
 }    #endif - - -// Replace parameters (%something) -std::string ReplaceParams(const std::string& str, - const std::map<std::string, std::string> params) -{ - std::stringstream result; - unsigned int i = 0; - char c; - int state = 0; - unsigned int var_start = 0; - bool hasMore; - while (i < str.length()) - { - c = str[i]; - hasMore = (i < str.length() - 1); - switch(state) - { - // Normal processing - case 0: - { - if (c == '%' && hasMore) - { - var_start = i + 1; - state = 1; - } - else - { - result << c; - } - break; - } - - // Found '%' - case 1: - { - if ((c == '_' || isalnum(c)) && hasMore) - { - // do nothing - } - else - { - // replace variable - if (var_start < i) - { - std::string var = str.substr(var_start, i - var_start); - std::map<std::string, std::string>::const_iterator it = - params.find(var); - if (it != params.end()) - { - result << it->second; - } - else - { - result << '%' << var; - } - } - else - { - result << '%'; - } - result << c; - if (c != '%') - { - state = 0; - } - } - break; - } - - // should never get here - default: - ASSERT(false); - } - i++; - } - - return result.str(); -} -
 
106
107
108
109
110
111
112
113
114
115
 
106
107
108
 
 
 
 
109
110
111
@@ -106,10 +106,6 @@
 wxString ExpandEnvStrings(const wxString& str);  #endif   -// Replace parameters (%something) -std::string ReplaceParams(const std::string& str, - const std::map<std::string, std::string> params); -  // comparison function object  class less_nocase  {