Index: examples/serialization/main.cc |
diff --git a/examples/serialization/main.cc b/examples/serialization/main.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..dcaa464a5a09cf34b6bdc69ba12324472c83b729 |
--- /dev/null |
+++ b/examples/serialization/main.cc |
@@ -0,0 +1,25 @@ |
+// 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. |
+ |
viettrungluu
2015/10/20 23:54:36
You should add a file-level comment saying what th
vardhan
2015/10/21 19:29:38
I'll do a file-level comment here, and some in BUI
|
+#include "examples/serialization/serialization.mojom.h" |
+#include "mojo/public/cpp/bindings/array.h" |
+ |
+int main() { |
+ mojo::examples::MyStruct in; |
+ mojo::examples::MyStruct out; |
+ |
+ in.a = 1; |
+ in.b = 2.0f; |
+ in.c = "hello world!"; |
+ |
+ char buf[1000]; |
+ MOJO_CHECK(in.Serialize(buf, sizeof(buf))); |
viettrungluu
2015/10/20 23:54:36
You should probably include something for MOJO_CHE
vardhan
2015/10/21 19:29:38
Done.
|
+ |
+ out.Deserialize(buf); |
+ MOJO_CHECK(out.a == 1); |
+ MOJO_CHECK(out.b == 2.0f); |
+ MOJO_CHECK(out.c == "hello world!"); |
+ |
+ return 0; |
+} |