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

Unified Diff: pkg/serialization/lib/src/format.dart

Issue 17578002: pkg/serialization: add format param to Serialization.read method (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: A few more tweaks Created 7 years, 6 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: pkg/serialization/lib/src/format.dart
diff --git a/pkg/serialization/lib/src/format.dart b/pkg/serialization/lib/src/format.dart
index 2c71e42f903afa02724d4678f32de127896a8191..dd463eabcebc71315c2440004c7a792db4cf3018 100644
--- a/pkg/serialization/lib/src/format.dart
+++ b/pkg/serialization/lib/src/format.dart
@@ -80,7 +80,7 @@ class InternalMapFormat extends Format {
* A format that stores the data in maps which can be converted into a JSON
* string or passed through an isolate. Note that this consists of maps, but
* that they don't follow the original object structure or look like the nested
- * maps of a [json] representation. They are flat, and [Reference] objects
+ * maps of a JSON representation. They are flat, and [Reference] objects
* are converted into a map form that will not make sense to
* anything but this format. For simple acyclic JSON that other programs
* can read, use [SimpleJsonFormat]. This is the default format, and is
@@ -92,7 +92,7 @@ class SimpleMapFormat extends InternalMapFormat {
/**
* Generate output for this format from [w] and return it as a String which
- * is the [json] representation of a nested Map structure. The top level has
+ * is the JSON representation of a nested Map structure. The top level has
* 3 fields, "rules" which may hold a definition of the rules used,
* "data" which holds the serialized data, and "roots", which holds
* [Reference] objects indicating the root objects. Note that roots are
@@ -115,7 +115,7 @@ class SimpleMapFormat extends InternalMapFormat {
* of [Reference] objects instead of the [Reference] so that the structure
* can be serialized between isolates and json easily.
*/
- forAllStates(ReaderOrWriter w, bool predicate(value),
+ void forAllStates(ReaderOrWriter w, bool predicate(value),
void transform(value)) {
for (var eachRule in w.rules) {
var ruleData = w.states[eachRule.number];
@@ -129,7 +129,7 @@ class SimpleMapFormat extends InternalMapFormat {
}
}
- /** Convert the reference to a [json] serializable form. */
+ /** Convert the reference to a JSON serializable form. */
Map<String, int> referenceToMap(Reference ref) => ref == null ? null :
{
"__Ref" : 0,
@@ -163,9 +163,9 @@ class SimpleMapFormat extends InternalMapFormat {
}
/**
- * A format for "normal" [json] representation of objects. It stores
+ * A format for "normal" JSON representation of objects. It stores
* the fields of the objects as nested maps, and doesn't allow cycles. This can
- * be useful in talking to existing APIs that expect [json] format data. The
+ * be useful in talking to existing APIs that expect JSON format data. The
* output will be either a simple object (string, num, bool), a List, or a Map,
* with nesting of those.
* Note that since the classes of objects aren't normally stored, this isn't
@@ -195,7 +195,7 @@ class SimpleJsonFormat extends SimpleMapFormat {
/**
* Generate output for this format from [w] and return it as
- * the [json] representation of a nested Map structure.
+ * the JSON representation of a nested Map structure.
*/
generateOutput(Writer w) {
jsonify(w);
@@ -214,7 +214,7 @@ class SimpleJsonFormat extends SimpleMapFormat {
* of Reference objects and to add rule numbers if [storeRoundTripInfo]
* is true.
*/
- jsonify(Writer w) {
+ void jsonify(Writer w) {
for (var eachRule in w.rules) {
var ruleData = w.states[eachRule.number];
jsonifyForRule(ruleData, w, eachRule);
@@ -224,7 +224,7 @@ class SimpleJsonFormat extends SimpleMapFormat {
/**
* For a particular [rule] modify the [ruleData] to conform to this format.
*/
- jsonifyForRule(List ruleData, Writer w, SerializationRule rule) {
+ void jsonifyForRule(List ruleData, Writer w, SerializationRule rule) {
for (var i = 0; i < ruleData.length; i++) {
var each = ruleData[i];
if (each is List) {
@@ -241,7 +241,7 @@ class SimpleJsonFormat extends SimpleMapFormat {
* For one particular entry, which is either a Map or a List, update it
* to turn References into a nested List/Map.
*/
- jsonifyEntry(map, Writer w) {
+ void jsonifyEntry(map, Writer w) {
// Note, if this is a Map, and the key might be a reference, we need to
// bend over backwards to avoid concurrent modifications. Non-string keys
// won't actually work if we try to write this to json, but might happen
@@ -496,7 +496,7 @@ class SimpleFlatFormat extends Format {
* Read data for [rule] from [input] with [length] number of entries,
* creating lists from the results.
*/
- readLists(Iterator input, SerializationRule rule, int length, Reader r) {
+ List readLists(Iterator input, SerializationRule rule, int length, Reader r) {
var ruleData = [];
for (var i = 0; i < length; i++) {
var subLength =
@@ -514,7 +514,7 @@ class SimpleFlatFormat extends Format {
* Read data for [rule] from [input] with [length] number of entries,
* creating maps from the results.
*/
- readMaps(Iterator input, SerializationRule rule, int length, Reader r) {
+ List readMaps(Iterator input, SerializationRule rule, int length, Reader r) {
var ruleData = [];
for (var i = 0; i < length; i++) {
var subLength =
@@ -534,7 +534,7 @@ class SimpleFlatFormat extends Format {
* Read data for [rule] from [input] with [length] number of entries,
* treating the data as primitives that can be returned directly.
*/
- readPrimitives(Iterator input, SerializationRule rule, int length) {
+ List readPrimitives(Iterator input, SerializationRule rule, int length) {
var ruleData = [];
for (var i = 0; i < length; i++) {
ruleData.add(_next(input));

Powered by Google App Engine
This is Rietveld 408576698