Add ICU message format support
[chromium-blink-merge.git] / ui / base / template_expressions.h
blobff14ee1b719149e0286a24c728ec4b64a28a8d35
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.
5 // This file defines utility functions for replacing template expressions.
6 // For example "Hello ${name}" could have ${name} replaced by the user's name.
8 #ifndef UI_BASE_TEMPLATE_EXPRESSIONS_H_
9 #define UI_BASE_TEMPLATE_EXPRESSIONS_H_
11 #include <map>
12 #include <string>
14 #include "base/strings/string_piece.h"
15 #include "ui/base/ui_base_export.h"
17 namespace ui {
19 // Replace ${foo} in the format string with the value for the foo key in
20 // |subst|. If the key is not found in the |substitutions| that item will
21 // be unaltered.
22 UI_BASE_EXPORT std::string ReplaceTemplateExpressions(
23 base::StringPiece format_string,
24 const std::map<base::StringPiece, std::string>& substitutions);
26 } // namespace ui
28 #endif // UI_BASE_TEMPLATE_EXPRESSIONS_H_