OLD | NEW |
1 # Copyright (c) 2013 Google Inc. All rights reserved. | 1 # Copyright (c) 2013 Google Inc. All rights reserved. |
2 # | 2 # |
3 # Redistribution and use in source and binary forms, with or without | 3 # Redistribution and use in source and binary forms, with or without |
4 # modification, are permitted provided that the following conditions are | 4 # modification, are permitted provided that the following conditions are |
5 # met: | 5 # met: |
6 # | 6 # |
7 # * Redistributions of source code must retain the above copyright | 7 # * Redistributions of source code must retain the above copyright |
8 # notice, this list of conditions and the following disclaimer. | 8 # notice, this list of conditions and the following disclaimer. |
9 # * Redistributions in binary form must reproduce the above | 9 # * Redistributions in binary form must reproduce the above |
10 # copyright notice, this list of conditions and the following disclaimer | 10 # copyright notice, this list of conditions and the following disclaimer |
(...skipping 584 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
595 void addItem(PassRefPtr<T> value) | 595 void addItem(PassRefPtr<T> value) |
596 { | 596 { |
597 ArrayItemHelper<T>::Traits::pushRefPtr(this->openAccessors(), value); | 597 ArrayItemHelper<T>::Traits::pushRefPtr(this->openAccessors(), value); |
598 } | 598 } |
599 | 599 |
600 void addItem(T value) | 600 void addItem(T value) |
601 { | 601 { |
602 ArrayItemHelper<T>::Traits::pushRaw(this->openAccessors(), value); | 602 ArrayItemHelper<T>::Traits::pushRaw(this->openAccessors(), value); |
603 } | 603 } |
604 | 604 |
605 static PassRefPtr<Array<T> > create() | 605 static PassRefPtr<Array<T>> create() |
606 { | 606 { |
607 return adoptRef(new Array<T>()); | 607 return adoptRef(new Array<T>()); |
608 } | 608 } |
609 | 609 |
610 static PassRefPtr<Array<T> > runtimeCast(PassRefPtr<JSONValue> value) | 610 static PassRefPtr<Array<T>> runtimeCast(PassRefPtr<JSONValue> value) |
611 { | 611 { |
612 RefPtr<JSONArray> array; | 612 RefPtr<JSONArray> array; |
613 bool castRes = value->asArray(&array); | 613 bool castRes = value->asArray(&array); |
614 ASSERT_UNUSED(castRes, castRes); | 614 ASSERT_UNUSED(castRes, castRes); |
615 #if $validatorIfdefName | 615 #if $validatorIfdefName |
616 assertCorrectValue(array.get()); | 616 assertCorrectValue(array.get()); |
617 #endif // $validatorIfdefName | 617 #endif // $validatorIfdefName |
618 static_assert(sizeof(Array<T>) == sizeof(JSONArray), "Array<T> should be
the same size as JSONArray"); | 618 static_assert(sizeof(Array<T>) == sizeof(JSONArray), "Array<T> should be
the same size as JSONArray"); |
619 return static_cast<Array<T>*>(static_cast<JSONArrayBase*>(array.get())); | 619 return static_cast<Array<T>*>(static_cast<JSONArrayBase*>(array.get())); |
620 } | 620 } |
621 | 621 |
622 void concat(PassRefPtr<Array<T> > array) | 622 void concat(PassRefPtr<Array<T>> array) |
623 { | 623 { |
624 return ArrayItemHelper<T>::Traits::concat(this->openAccessors(), array->
openAccessors()); | 624 return ArrayItemHelper<T>::Traits::concat(this->openAccessors(), array->
openAccessors()); |
625 } | 625 } |
626 | 626 |
627 #if $validatorIfdefName | 627 #if $validatorIfdefName |
628 static void assertCorrectValue(JSONValue* value) | 628 static void assertCorrectValue(JSONValue* value) |
629 { | 629 { |
630 RefPtr<JSONArray> array; | 630 RefPtr<JSONArray> array; |
631 bool castRes = value->asArray(&array); | 631 bool castRes = value->asArray(&array); |
632 ASSERT_UNUSED(castRes, castRes); | 632 ASSERT_UNUSED(castRes, castRes); |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
770 #if $validatorIfdefName | 770 #if $validatorIfdefName |
771 template<typename T> | 771 template<typename T> |
772 static void assertCorrectValue(JSONValue* value) { | 772 static void assertCorrectValue(JSONValue* value) { |
773 RuntimeCastHelper::assertType<JSONValue::TypeArray>(value); | 773 RuntimeCastHelper::assertType<JSONValue::TypeArray>(value); |
774 } | 774 } |
775 #endif // $validatorIfdefName | 775 #endif // $validatorIfdefName |
776 }; | 776 }; |
777 }; | 777 }; |
778 | 778 |
779 template<typename T> | 779 template<typename T> |
780 struct ArrayItemHelper<TypeBuilder::Array<T> > { | 780 struct ArrayItemHelper<TypeBuilder::Array<T>> { |
781 struct Traits { | 781 struct Traits { |
782 static void pushRefPtr(JSONArray* array, PassRefPtr<TypeBuilder::Array<T
> > value) | 782 static void pushRefPtr(JSONArray* array, PassRefPtr<TypeBuilder::Array<T
>> value) |
783 { | 783 { |
784 array->pushValue(value); | 784 array->pushValue(value); |
785 } | 785 } |
786 | 786 |
787 #if $validatorIfdefName | 787 #if $validatorIfdefName |
788 template<typename S> | 788 template<typename S> |
789 static void assertCorrectValue(JSONValue* value) { | 789 static void assertCorrectValue(JSONValue* value) { |
790 S::assertCorrectValue(value); | 790 S::assertCorrectValue(value); |
791 } | 791 } |
792 #endif // $validatorIfdefName | 792 #endif // $validatorIfdefName |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
906 }; | 906 }; |
907 | 907 |
908 """) | 908 """) |
909 | 909 |
910 class_binding_builder_part_4 = ( | 910 class_binding_builder_part_4 = ( |
911 """ static Builder<NoFieldsSet> create() | 911 """ static Builder<NoFieldsSet> create() |
912 { | 912 { |
913 return Builder<NoFieldsSet>(JSONObject::create()); | 913 return Builder<NoFieldsSet>(JSONObject::create()); |
914 } | 914 } |
915 """) | 915 """) |
OLD | NEW |