Index: chromeos/dbus/dbus_command_line_helper.h |
diff --git a/chromeos/dbus/dbus_command_line_helper.h b/chromeos/dbus/dbus_command_line_helper.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..d0f96b392a162f65eedc363ac74e4115c8261dfc |
--- /dev/null |
+++ b/chromeos/dbus/dbus_command_line_helper.h |
@@ -0,0 +1,33 @@ |
+// Copyright (c) 2014 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. |
+ |
+#ifndef CHROMEOS_DBUS_DBUS_COMMAND_LINE_HELPER_H_ |
+#define CHROMEOS_DBUS_DBUS_COMMAND_LINE_HELPER_H_ |
+ |
+#include <string> |
+ |
+#include "base/callback.h" |
+#include "chromeos/chromeos_export.h" |
+ |
+namespace dbus_command_line_helper { |
+ |
+// Parses a single name,value pair. Returns 'true' if parsed successfully. |
+typedef base::Callback< |
+ bool(const std::string& arg0, const std::string& arg1)> ParseOptionCallback; |
+ |
+// Parses a command line switch containing comma-separated name-value pairs. |
+// Invokes |callback| for each name-value pair. Returns false only if the |
+// option is not set in the command line. |
+// Examples: |
+// Invokes |callback| once with ("foo", ""): |
+// --option=foo |
+// Invokes |callback| three times with ("foo", ""), ("bar", "1"), ("a", "b") |
+// --option=foo,bar=1,a=b |
+CHROMEOS_EXPORT bool ParseOptions(const std::string& switch_name, |
+ const ParseOptionCallback& callback); |
+ |
+} // namespace dbus_command_line_helper |
+ |
+ |
+#endif // CHROMEOS_DBUS_DBUS_COMMAND_LINE_HELPER_H_ |