| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 // This file defines utility functions for replacing template expressions. |
| 6 // For example "Hello ${name}" could have ${name} replaced by the user's name. |
| 7 |
| 8 #ifndef UI_BASE_TEMPLATE_EXPRESSIONS_H_ |
| 9 #define UI_BASE_TEMPLATE_EXPRESSIONS_H_ |
| 10 |
| 11 #include <map> |
| 12 #include <string> |
| 13 |
| 14 #include "base/strings/utf_string_conversions.h" |
| 15 #include "ui/base/ui_base_export.h" |
| 16 |
| 17 namespace ui { |
| 18 |
| 19 // Replace ${foo} in the format string with the value for the foo key in |
| 20 // |subst|. Additionally, any number of consecutive '$' characters is replaced |
| 21 // by that number less one. Eg $$ becomes $, $$$ becomes $$, etc. |
| 22 UI_BASE_EXPORT std::string ReplaceTemplateExpressions( |
| 23 base::StringPiece format_string, |
| 24 const std::map<base::StringPiece, std::string>& substitutions); |
| 25 UI_BASE_EXPORT base::string16 ReplaceTemplateExpressions( |
| 26 const base::string16& format_string, |
| 27 const std::map<base::string16, base::string16>& substitutions); |
| 28 UI_BASE_EXPORT std::string ReplaceTemplateExpressions( |
| 29 const std::string& format_string, |
| 30 const std::map<std::string, std::string>& substitutions); |
| 31 |
| 32 } // namespace ui |
| 33 |
| 34 #endif // UI_BASE_TEMPLATE_EXPRESSIONS_H_ |
| OLD | NEW |