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

Unified Diff: mojo/public/cpp/bindings/type_converter.h

Issue 294473010: Improve compiler output for users who forget to include TypeConverter specializations. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/public/cpp/bindings/type_converter.h
diff --git a/mojo/public/cpp/bindings/type_converter.h b/mojo/public/cpp/bindings/type_converter.h
index 147d83b495f2d39d918d732cd98be1616329ce05..83597747c55d2887b8ca1531a328ab448fd02730 100644
--- a/mojo/public/cpp/bindings/type_converter.h
+++ b/mojo/public/cpp/bindings/type_converter.h
@@ -7,10 +7,26 @@
namespace mojo {
-// Specialize to perform type conversion for Mojom-defined structs and arrays.
-// Here, T is the Mojom-defined struct or array, and U is some other non-Mojom
+// Specialize the following class:
+// template <typename T, typename U> class TypeConverter;
+// to perform type conversion for Mojom-defined structs and arrays. Here, T is
+// the Mojom-defined struct or array, and U is some other non-Mojom
// struct or array type.
//
+// Specializations should implement the following interface:
+// namespace mojo {
+// template <>
+// class TypeConverter<T, U> {
+// public:
+// static T ConvertFrom(const U& input, Buffer* buf);
+// static U ConvertTo(const T& input);
+//
+// // Maybe (mutually exclusive):
+// MOJO_ALLOW_IMPLICIT_TYPE_CONVERSION();
+// MOJO_INHERIT_IMPLICIT_TYPE_CONVERSION(X, Y);
+// };
+// }
+//
// EXAMPLE:
//
// Suppose you have the following Mojom-defined struct:
@@ -94,14 +110,7 @@ namespace mojo {
// Although these macros are convenient, they make conversions less obvious.
// Users may do conversions excessively without paying attention to the cost. So
// please use them wisely.
-template <typename T, typename U> class TypeConverter {
- // static T ConvertFrom(const U& input, Buffer* buf);
- // static U ConvertTo(const T& input);
-
- // Maybe (mutually exclusive):
- // MOJO_ALLOW_IMPLICIT_TYPE_CONVERSION();
- // MOJO_INHERIT_IMPLICIT_TYPE_CONVERSION(X, Y);
-};
+template <typename T, typename U> class TypeConverter;
} // namespace mojo
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698