Chromium Code Reviews| Index: ui/base/template_expressions.h |
| diff --git a/ui/base/template_expressions.h b/ui/base/template_expressions.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..bc8b8e0558e37a8291d3e5aa91798ee753489682 |
| --- /dev/null |
| +++ b/ui/base/template_expressions.h |
| @@ -0,0 +1,29 @@ |
| +// Copyright 2015 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +// This file defines utility functions for replacing template expressions. |
| +// For example "Hello ${name}" could have ${name} replaced by the user's name. |
| + |
| +#ifndef UI_BASE_TEMPLATE_EXPRESSIONS_H_ |
| +#define UI_BASE_TEMPLATE_EXPRESSIONS_H_ |
| + |
| +#include <map> |
| +#include <string> |
| + |
| +#include "base/strings/string16.h" |
|
Dan Beam
2015/07/16 00:21:44
unneeded
Dan Beam
2015/07/17 01:57:18
ping
dschuyler
2015/07/17 02:31:39
Done.
|
| +#include "base/strings/string_piece.h" |
| +#include "ui/base/ui_base_export.h" |
| + |
| +namespace ui { |
| + |
| +// Replace ${foo} in the format string with the value for the foo key in |
| +// |subst|. If the key is not found in the |substitutions| that item will |
| +// be unaltered. |
| +UI_BASE_EXPORT std::string ReplaceTemplateExpressions( |
| + base::StringPiece format_string, |
| + const std::map<base::StringPiece, std::string>& substitutions); |
| + |
| +} // namespace ui |
| + |
| +#endif // UI_BASE_TEMPLATE_EXPRESSIONS_H_ |