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

Unified Diff: mojo/dart/packages/mojo_services/lib/mojo/geometry.mojom.dart

Issue 1449203002: Check in generated Dart bindings and add presubmit script (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 1 month 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: mojo/dart/packages/mojo_services/lib/mojo/geometry.mojom.dart
diff --git a/mojo/dart/packages/mojo_services/lib/mojo/geometry.mojom.dart b/mojo/dart/packages/mojo_services/lib/mojo/geometry.mojom.dart
new file mode 100644
index 0000000000000000000000000000000000000000..90422dd86a8cb9e1c42256139864fa61d05a6ffc
--- /dev/null
+++ b/mojo/dart/packages/mojo_services/lib/mojo/geometry.mojom.dart
@@ -0,0 +1,496 @@
+// Copyright 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.
+
+library geometry_mojom;
+
+import 'dart:async';
+
+import 'package:mojo/bindings.dart' as bindings;
+import 'package:mojo/core.dart' as core;
+
+
+
+class Point extends bindings.Struct {
+ static const List<bindings.StructDataHeader> kVersions = const [
+ const bindings.StructDataHeader(16, 0)
+ ];
+ int x = 0;
+ int y = 0;
+
+ Point() : super(kVersions.last.size);
+
+ static Point deserialize(bindings.Message message) {
+ var decoder = new bindings.Decoder(message);
+ var result = decode(decoder);
+ if (decoder.excessHandles != null) {
+ decoder.excessHandles.forEach((h) => h.close());
+ }
+ return result;
+ }
+
+ static Point decode(bindings.Decoder decoder0) {
+ if (decoder0 == null) {
+ return null;
+ }
+ Point result = new Point();
+
+ var mainDataHeader = decoder0.decodeStructDataHeader();
+ if (mainDataHeader.version <= kVersions.last.version) {
+ // Scan in reverse order to optimize for more recent versions.
+ for (int i = kVersions.length - 1; i >= 0; --i) {
+ if (mainDataHeader.version >= kVersions[i].version) {
+ if (mainDataHeader.size == kVersions[i].size) {
+ // Found a match.
+ break;
+ }
+ throw new bindings.MojoCodecError(
+ 'Header size doesn\'t correspond to known version size.');
+ }
+ }
+ } else if (mainDataHeader.size < kVersions.last.size) {
+ throw new bindings.MojoCodecError(
+ 'Message newer than the last known version cannot be shorter than '
+ 'required by the last known version.');
+ }
+ if (mainDataHeader.version >= 0) {
+
+ result.x = decoder0.decodeInt32(8);
+ }
+ if (mainDataHeader.version >= 0) {
+
+ result.y = decoder0.decodeInt32(12);
+ }
+ return result;
+ }
+
+ void encode(bindings.Encoder encoder) {
+ var encoder0 = encoder.getStructEncoderAtOffset(kVersions.last);
+
+ encoder0.encodeInt32(x, 8);
+
+ encoder0.encodeInt32(y, 12);
+ }
+
+ String toString() {
+ return "Point("
+ "x: $x" ", "
+ "y: $y" ")";
+ }
+
+ Map toJson() {
+ Map map = new Map();
+ map["x"] = x;
+ map["y"] = y;
+ return map;
+ }
+}
+
+
+class PointF extends bindings.Struct {
+ static const List<bindings.StructDataHeader> kVersions = const [
+ const bindings.StructDataHeader(16, 0)
+ ];
+ double x = 0.0;
+ double y = 0.0;
+
+ PointF() : super(kVersions.last.size);
+
+ static PointF deserialize(bindings.Message message) {
+ var decoder = new bindings.Decoder(message);
+ var result = decode(decoder);
+ if (decoder.excessHandles != null) {
+ decoder.excessHandles.forEach((h) => h.close());
+ }
+ return result;
+ }
+
+ static PointF decode(bindings.Decoder decoder0) {
+ if (decoder0 == null) {
+ return null;
+ }
+ PointF result = new PointF();
+
+ var mainDataHeader = decoder0.decodeStructDataHeader();
+ if (mainDataHeader.version <= kVersions.last.version) {
+ // Scan in reverse order to optimize for more recent versions.
+ for (int i = kVersions.length - 1; i >= 0; --i) {
+ if (mainDataHeader.version >= kVersions[i].version) {
+ if (mainDataHeader.size == kVersions[i].size) {
+ // Found a match.
+ break;
+ }
+ throw new bindings.MojoCodecError(
+ 'Header size doesn\'t correspond to known version size.');
+ }
+ }
+ } else if (mainDataHeader.size < kVersions.last.size) {
+ throw new bindings.MojoCodecError(
+ 'Message newer than the last known version cannot be shorter than '
+ 'required by the last known version.');
+ }
+ if (mainDataHeader.version >= 0) {
+
+ result.x = decoder0.decodeFloat(8);
+ }
+ if (mainDataHeader.version >= 0) {
+
+ result.y = decoder0.decodeFloat(12);
+ }
+ return result;
+ }
+
+ void encode(bindings.Encoder encoder) {
+ var encoder0 = encoder.getStructEncoderAtOffset(kVersions.last);
+
+ encoder0.encodeFloat(x, 8);
+
+ encoder0.encodeFloat(y, 12);
+ }
+
+ String toString() {
+ return "PointF("
+ "x: $x" ", "
+ "y: $y" ")";
+ }
+
+ Map toJson() {
+ Map map = new Map();
+ map["x"] = x;
+ map["y"] = y;
+ return map;
+ }
+}
+
+
+class Size extends bindings.Struct {
+ static const List<bindings.StructDataHeader> kVersions = const [
+ const bindings.StructDataHeader(16, 0)
+ ];
+ int width = 0;
+ int height = 0;
+
+ Size() : super(kVersions.last.size);
+
+ static Size deserialize(bindings.Message message) {
+ var decoder = new bindings.Decoder(message);
+ var result = decode(decoder);
+ if (decoder.excessHandles != null) {
+ decoder.excessHandles.forEach((h) => h.close());
+ }
+ return result;
+ }
+
+ static Size decode(bindings.Decoder decoder0) {
+ if (decoder0 == null) {
+ return null;
+ }
+ Size result = new Size();
+
+ var mainDataHeader = decoder0.decodeStructDataHeader();
+ if (mainDataHeader.version <= kVersions.last.version) {
+ // Scan in reverse order to optimize for more recent versions.
+ for (int i = kVersions.length - 1; i >= 0; --i) {
+ if (mainDataHeader.version >= kVersions[i].version) {
+ if (mainDataHeader.size == kVersions[i].size) {
+ // Found a match.
+ break;
+ }
+ throw new bindings.MojoCodecError(
+ 'Header size doesn\'t correspond to known version size.');
+ }
+ }
+ } else if (mainDataHeader.size < kVersions.last.size) {
+ throw new bindings.MojoCodecError(
+ 'Message newer than the last known version cannot be shorter than '
+ 'required by the last known version.');
+ }
+ if (mainDataHeader.version >= 0) {
+
+ result.width = decoder0.decodeInt32(8);
+ }
+ if (mainDataHeader.version >= 0) {
+
+ result.height = decoder0.decodeInt32(12);
+ }
+ return result;
+ }
+
+ void encode(bindings.Encoder encoder) {
+ var encoder0 = encoder.getStructEncoderAtOffset(kVersions.last);
+
+ encoder0.encodeInt32(width, 8);
+
+ encoder0.encodeInt32(height, 12);
+ }
+
+ String toString() {
+ return "Size("
+ "width: $width" ", "
+ "height: $height" ")";
+ }
+
+ Map toJson() {
+ Map map = new Map();
+ map["width"] = width;
+ map["height"] = height;
+ return map;
+ }
+}
+
+
+class Rect extends bindings.Struct {
+ static const List<bindings.StructDataHeader> kVersions = const [
+ const bindings.StructDataHeader(24, 0)
+ ];
+ int x = 0;
+ int y = 0;
+ int width = 0;
+ int height = 0;
+
+ Rect() : super(kVersions.last.size);
+
+ static Rect deserialize(bindings.Message message) {
+ var decoder = new bindings.Decoder(message);
+ var result = decode(decoder);
+ if (decoder.excessHandles != null) {
+ decoder.excessHandles.forEach((h) => h.close());
+ }
+ return result;
+ }
+
+ static Rect decode(bindings.Decoder decoder0) {
+ if (decoder0 == null) {
+ return null;
+ }
+ Rect result = new Rect();
+
+ var mainDataHeader = decoder0.decodeStructDataHeader();
+ if (mainDataHeader.version <= kVersions.last.version) {
+ // Scan in reverse order to optimize for more recent versions.
+ for (int i = kVersions.length - 1; i >= 0; --i) {
+ if (mainDataHeader.version >= kVersions[i].version) {
+ if (mainDataHeader.size == kVersions[i].size) {
+ // Found a match.
+ break;
+ }
+ throw new bindings.MojoCodecError(
+ 'Header size doesn\'t correspond to known version size.');
+ }
+ }
+ } else if (mainDataHeader.size < kVersions.last.size) {
+ throw new bindings.MojoCodecError(
+ 'Message newer than the last known version cannot be shorter than '
+ 'required by the last known version.');
+ }
+ if (mainDataHeader.version >= 0) {
+
+ result.x = decoder0.decodeInt32(8);
+ }
+ if (mainDataHeader.version >= 0) {
+
+ result.y = decoder0.decodeInt32(12);
+ }
+ if (mainDataHeader.version >= 0) {
+
+ result.width = decoder0.decodeInt32(16);
+ }
+ if (mainDataHeader.version >= 0) {
+
+ result.height = decoder0.decodeInt32(20);
+ }
+ return result;
+ }
+
+ void encode(bindings.Encoder encoder) {
+ var encoder0 = encoder.getStructEncoderAtOffset(kVersions.last);
+
+ encoder0.encodeInt32(x, 8);
+
+ encoder0.encodeInt32(y, 12);
+
+ encoder0.encodeInt32(width, 16);
+
+ encoder0.encodeInt32(height, 20);
+ }
+
+ String toString() {
+ return "Rect("
+ "x: $x" ", "
+ "y: $y" ", "
+ "width: $width" ", "
+ "height: $height" ")";
+ }
+
+ Map toJson() {
+ Map map = new Map();
+ map["x"] = x;
+ map["y"] = y;
+ map["width"] = width;
+ map["height"] = height;
+ return map;
+ }
+}
+
+
+class RectF extends bindings.Struct {
+ static const List<bindings.StructDataHeader> kVersions = const [
+ const bindings.StructDataHeader(24, 0)
+ ];
+ double x = 0.0;
+ double y = 0.0;
+ double width = 0.0;
+ double height = 0.0;
+
+ RectF() : super(kVersions.last.size);
+
+ static RectF deserialize(bindings.Message message) {
+ var decoder = new bindings.Decoder(message);
+ var result = decode(decoder);
+ if (decoder.excessHandles != null) {
+ decoder.excessHandles.forEach((h) => h.close());
+ }
+ return result;
+ }
+
+ static RectF decode(bindings.Decoder decoder0) {
+ if (decoder0 == null) {
+ return null;
+ }
+ RectF result = new RectF();
+
+ var mainDataHeader = decoder0.decodeStructDataHeader();
+ if (mainDataHeader.version <= kVersions.last.version) {
+ // Scan in reverse order to optimize for more recent versions.
+ for (int i = kVersions.length - 1; i >= 0; --i) {
+ if (mainDataHeader.version >= kVersions[i].version) {
+ if (mainDataHeader.size == kVersions[i].size) {
+ // Found a match.
+ break;
+ }
+ throw new bindings.MojoCodecError(
+ 'Header size doesn\'t correspond to known version size.');
+ }
+ }
+ } else if (mainDataHeader.size < kVersions.last.size) {
+ throw new bindings.MojoCodecError(
+ 'Message newer than the last known version cannot be shorter than '
+ 'required by the last known version.');
+ }
+ if (mainDataHeader.version >= 0) {
+
+ result.x = decoder0.decodeFloat(8);
+ }
+ if (mainDataHeader.version >= 0) {
+
+ result.y = decoder0.decodeFloat(12);
+ }
+ if (mainDataHeader.version >= 0) {
+
+ result.width = decoder0.decodeFloat(16);
+ }
+ if (mainDataHeader.version >= 0) {
+
+ result.height = decoder0.decodeFloat(20);
+ }
+ return result;
+ }
+
+ void encode(bindings.Encoder encoder) {
+ var encoder0 = encoder.getStructEncoderAtOffset(kVersions.last);
+
+ encoder0.encodeFloat(x, 8);
+
+ encoder0.encodeFloat(y, 12);
+
+ encoder0.encodeFloat(width, 16);
+
+ encoder0.encodeFloat(height, 20);
+ }
+
+ String toString() {
+ return "RectF("
+ "x: $x" ", "
+ "y: $y" ", "
+ "width: $width" ", "
+ "height: $height" ")";
+ }
+
+ Map toJson() {
+ Map map = new Map();
+ map["x"] = x;
+ map["y"] = y;
+ map["width"] = width;
+ map["height"] = height;
+ return map;
+ }
+}
+
+
+class Transform extends bindings.Struct {
+ static const List<bindings.StructDataHeader> kVersions = const [
+ const bindings.StructDataHeader(16, 0)
+ ];
+ List<double> matrix = null;
+
+ Transform() : super(kVersions.last.size);
+
+ static Transform deserialize(bindings.Message message) {
+ var decoder = new bindings.Decoder(message);
+ var result = decode(decoder);
+ if (decoder.excessHandles != null) {
+ decoder.excessHandles.forEach((h) => h.close());
+ }
+ return result;
+ }
+
+ static Transform decode(bindings.Decoder decoder0) {
+ if (decoder0 == null) {
+ return null;
+ }
+ Transform result = new Transform();
+
+ var mainDataHeader = decoder0.decodeStructDataHeader();
+ if (mainDataHeader.version <= kVersions.last.version) {
+ // Scan in reverse order to optimize for more recent versions.
+ for (int i = kVersions.length - 1; i >= 0; --i) {
+ if (mainDataHeader.version >= kVersions[i].version) {
+ if (mainDataHeader.size == kVersions[i].size) {
+ // Found a match.
+ break;
+ }
+ throw new bindings.MojoCodecError(
+ 'Header size doesn\'t correspond to known version size.');
+ }
+ }
+ } else if (mainDataHeader.size < kVersions.last.size) {
+ throw new bindings.MojoCodecError(
+ 'Message newer than the last known version cannot be shorter than '
+ 'required by the last known version.');
+ }
+ if (mainDataHeader.version >= 0) {
+
+ result.matrix = decoder0.decodeFloatArray(8, bindings.kNothingNullable, 16);
+ }
+ return result;
+ }
+
+ void encode(bindings.Encoder encoder) {
+ var encoder0 = encoder.getStructEncoderAtOffset(kVersions.last);
+
+ encoder0.encodeFloatArray(matrix, 8, bindings.kNothingNullable, 16);
+ }
+
+ String toString() {
+ return "Transform("
+ "matrix: $matrix" ")";
+ }
+
+ Map toJson() {
+ Map map = new Map();
+ map["matrix"] = matrix;
+ return map;
+ }
+}
+
+

Powered by Google App Engine
This is Rietveld 408576698