Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(643)

Unified Diff: ui/base/template_expressions.h

Issue 1220793010: [ui/base;css] adding string template expression replacement (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removing changes to base/strings Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..3afde9e7ad6857ca4f54099095b24e248a353e10
--- /dev/null
+++ b/ui/base/template_expressions.h
@@ -0,0 +1,26 @@
+// 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 "ui/base/ui_base_export.h"
+
+namespace ui {
+
+// Replace ${foo} in the format string with the value for the foo key in
+// |subst|. Additionally, any number of consecutive '$' characters is replaced
+// by that number less one. Eg $$ becomes $, $$$ becomes $$, etc.
+UI_BASE_EXPORT std::string ReplaceTemplateExpressions(
+ const std::string& format_string,
+ const std::map<std::string, std::string>& substitutions);
Dan Beam 2015/07/09 19:26:01 nit: \n
dschuyler 2015/07/14 00:56:17 Done.
+}
Dan Beam 2015/07/09 19:26:01 nit: } // namespace ui
dschuyler 2015/07/14 00:56:17 Done.
+
+#endif // UI_BASE_TEMPLATE_EXPRESSIONS_H_

Powered by Google App Engine
This is Rietveld 408576698