You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@thrift.apache.org by je...@apache.org on 2014/11/09 03:33:50 UTC
[5/5] thrift git commit: THRIFT-2806 more whitespace fixups Client:
Haxe Patch: Jens Geyer
THRIFT-2806 more whitespace fixups
Client: Haxe
Patch: Jens Geyer
This closes #254
Project: http://git-wip-us.apache.org/repos/asf/thrift/repo
Commit: http://git-wip-us.apache.org/repos/asf/thrift/commit/b502832c
Tree: http://git-wip-us.apache.org/repos/asf/thrift/tree/b502832c
Diff: http://git-wip-us.apache.org/repos/asf/thrift/diff/b502832c
Branch: refs/heads/master
Commit: b502832c7930ba08700f10928cadb49c020ba93f
Parents: fea00ac
Author: Jens Geyer <je...@apache.org>
Authored: Sun Nov 9 02:38:11 2014 +0100
Committer: Jens Geyer <je...@apache.org>
Committed: Sun Nov 9 02:50:33 2014 +0100
----------------------------------------------------------------------
.../org/apache/thrift/AbstractMethodError.hx | 12 +-
lib/haxe/src/org/apache/thrift/ArgumentError.hx | 8 +-
lib/haxe/src/org/apache/thrift/Limits.hx | 42 +-
.../org/apache/thrift/TApplicationException.hx | 6 +-
lib/haxe/src/org/apache/thrift/TBase.hx | 14 +-
lib/haxe/src/org/apache/thrift/TException.hx | 25 +-
.../org/apache/thrift/TFieldRequirementType.hx | 2 +-
lib/haxe/src/org/apache/thrift/TProcessor.hx | 2 +-
.../src/org/apache/thrift/helper/Int64Map.hx | 416 ++--
lib/haxe/src/org/apache/thrift/helper/IntSet.hx | 94 +-
.../src/org/apache/thrift/helper/ObjectSet.hx | 94 +-
.../src/org/apache/thrift/helper/StringSet.hx | 94 +-
.../apache/thrift/meta_data/FieldMetaData.hx | 8 +-
.../thrift/meta_data/FieldValueMetaData.hx | 12 +-
.../org/apache/thrift/meta_data/ListMetaData.hx | 9 +-
.../org/apache/thrift/meta_data/MapMetaData.hx | 7 +-
.../org/apache/thrift/meta_data/SetMetaData.hx | 6 +-
.../apache/thrift/meta_data/StructMetaData.hx | 4 +-
.../apache/thrift/protocol/TBinaryProtocol.hx | 510 ++---
.../thrift/protocol/TBinaryProtocolFactory.hx | 26 +-
.../src/org/apache/thrift/protocol/TField.hx | 16 +-
.../org/apache/thrift/protocol/TJSONProtocol.hx | 1952 +++++++++---------
.../thrift/protocol/TJSONProtocolFactory.hx | 14 +-
.../src/org/apache/thrift/protocol/TList.hx | 6 +-
lib/haxe/src/org/apache/thrift/protocol/TMap.hx | 8 +-
.../src/org/apache/thrift/protocol/TMessage.hx | 12 +-
.../org/apache/thrift/protocol/TMessageType.hx | 6 +-
.../src/org/apache/thrift/protocol/TProtocol.hx | 72 +-
.../thrift/protocol/TProtocolException.hx | 12 +-
.../apache/thrift/protocol/TProtocolFactory.hx | 2 +-
lib/haxe/src/org/apache/thrift/protocol/TSet.hx | 8 +-
.../src/org/apache/thrift/protocol/TStruct.hx | 10 +-
.../src/org/apache/thrift/protocol/TType.hx | 4 +-
.../src/org/apache/thrift/server/TServer.hx | 97 +-
.../apache/thrift/server/TServerEventHandler.hx | 14 +-
.../org/apache/thrift/server/TSimpleServer.hx | 154 +-
.../org/apache/thrift/transport/TFileStream.hx | 135 +-
.../apache/thrift/transport/TFramedTransport.hx | 100 +-
.../thrift/transport/TFramedTransportFactory.hx | 6 +-
.../thrift/transport/TFullDuplexHttpClient.hx | 30 +-
.../org/apache/thrift/transport/THttpClient.hx | 86 +-
.../apache/thrift/transport/TServerSocket.hx | 188 +-
.../apache/thrift/transport/TServerTransport.hx | 38 +-
.../src/org/apache/thrift/transport/TSocket.hx | 402 ++--
.../src/org/apache/thrift/transport/TStream.hx | 10 +-
.../apache/thrift/transport/TStreamTransport.hx | 124 +-
.../org/apache/thrift/transport/TTransport.hx | 38 +-
.../thrift/transport/TTransportException.hx | 13 +-
.../thrift/transport/TTransportFactory.hx | 22 +-
lib/haxe/test/src/Main.hx | 22 +-
lib/haxe/test/src/StreamTest.hx | 112 +-
lib/haxe/test/src/TestBase.hx | 17 +-
test/haxe/src/Arguments.hx | 546 ++---
test/haxe/src/Main.hx | 36 +-
test/haxe/src/TestClient.hx | 1498 +++++++-------
test/haxe/src/TestServer.hx | 152 +-
test/haxe/src/TestServerEventHandler.hx | 38 +-
test/haxe/src/TestServerHandler.hx | 664 +++---
tutorial/haxe/src/CalculatorHandler.hx | 130 +-
tutorial/haxe/src/Main.hx | 563 ++---
60 files changed, 4378 insertions(+), 4370 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/thrift/blob/b502832c/lib/haxe/src/org/apache/thrift/AbstractMethodError.hx
----------------------------------------------------------------------
diff --git a/lib/haxe/src/org/apache/thrift/AbstractMethodError.hx b/lib/haxe/src/org/apache/thrift/AbstractMethodError.hx
index 9fb9bbb..54b8153 100644
--- a/lib/haxe/src/org/apache/thrift/AbstractMethodError.hx
+++ b/lib/haxe/src/org/apache/thrift/AbstractMethodError.hx
@@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
-
+
package org.apache.thrift;
#if flash
@@ -25,16 +25,16 @@ import flash.errors.IllegalOperationError;
import org.apache.thrift.TException;
#end
-class AbstractMethodError
+class AbstractMethodError
#if flash
-extends IllegalOperationError
+extends IllegalOperationError
#else
extends TException
#end
{
- public function new(message : String="") {
- super("Attempt to call an abstract method");
- }
+ public function new(message : String="") {
+ super("Attempt to call an abstract method");
+ }
}
http://git-wip-us.apache.org/repos/asf/thrift/blob/b502832c/lib/haxe/src/org/apache/thrift/ArgumentError.hx
----------------------------------------------------------------------
diff --git a/lib/haxe/src/org/apache/thrift/ArgumentError.hx b/lib/haxe/src/org/apache/thrift/ArgumentError.hx
index 8a5df6f..3ca04fd 100644
--- a/lib/haxe/src/org/apache/thrift/ArgumentError.hx
+++ b/lib/haxe/src/org/apache/thrift/ArgumentError.hx
@@ -16,14 +16,14 @@
* specific language governing permissions and limitations
* under the License.
*/
-
+
package org.apache.thrift;
#if ! flash
// predefined for flash only
class ArgumentError extends TException {
- public function new(msg : String = "") {
- super(msg);
- }
+ public function new(msg : String = "") {
+ super(msg);
+ }
}
#end
http://git-wip-us.apache.org/repos/asf/thrift/blob/b502832c/lib/haxe/src/org/apache/thrift/Limits.hx
----------------------------------------------------------------------
diff --git a/lib/haxe/src/org/apache/thrift/Limits.hx b/lib/haxe/src/org/apache/thrift/Limits.hx
index 7d2aa5d..44eec3a 100644
--- a/lib/haxe/src/org/apache/thrift/Limits.hx
+++ b/lib/haxe/src/org/apache/thrift/Limits.hx
@@ -16,29 +16,29 @@
* specific language governing permissions and limitations
* under the License.
*/
-
+
package org.apache.thrift;
class Limits {
-
- // Haxe limits are not fixed values, they depend on the target platform
- // For example, neko limits an int to 31 bits instead of 32. So we detect
- // the values once during intialisation in order to
- // (a) get the right values for the current platform, and
- // (b) prevent us from dependecies to a bunch of defines
-
- public static var I32_MAX = {
- var last : Int = 0;
- var next : Int = 0;
- for(bit in 0 ... 32) {
- last = next;
- next = last | (1 << bit);
- if(next < 0) {
- break;
- }
- }
- last; // final value
- }
- // add whatever you need
+ // Haxe limits are not fixed values, they depend on the target platform
+ // For example, neko limits an int to 31 bits instead of 32. So we detect
+ // the values once during intialisation in order to
+ // (a) get the right values for the current platform, and
+ // (b) prevent us from dependecies to a bunch of defines
+
+ public static var I32_MAX = {
+ var last : Int = 0;
+ var next : Int = 0;
+ for(bit in 0 ... 32) {
+ last = next;
+ next = last | (1 << bit);
+ if(next < 0) {
+ break;
+ }
+ }
+ last; // final value
+ }
+
+ // add whatever you need
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/thrift/blob/b502832c/lib/haxe/src/org/apache/thrift/TApplicationException.hx
----------------------------------------------------------------------
diff --git a/lib/haxe/src/org/apache/thrift/TApplicationException.hx b/lib/haxe/src/org/apache/thrift/TApplicationException.hx
index 012a802..4287a85 100644
--- a/lib/haxe/src/org/apache/thrift/TApplicationException.hx
+++ b/lib/haxe/src/org/apache/thrift/TApplicationException.hx
@@ -30,9 +30,9 @@ import org.apache.thrift.protocol.TType;
*/
class TApplicationException extends TException {
- private static var TAPPLICATION_EXCEPTION_STRUCT = { new TStruct("TApplicationException"); };
- private static var MESSAGE_FIELD = { new TField("message", TType.STRING, 1); };
- private static var TYPE_FIELD = { new TField("type", TType.I32, 2); };
+ private static var TAPPLICATION_EXCEPTION_STRUCT = { new TStruct("TApplicationException"); };
+ private static var MESSAGE_FIELD = { new TField("message", TType.STRING, 1); };
+ private static var TYPE_FIELD = { new TField("type", TType.I32, 2); };
public static inline var UNKNOWN : Int = 0;
public static inline var UNKNOWN_METHOD : Int = 1;
http://git-wip-us.apache.org/repos/asf/thrift/blob/b502832c/lib/haxe/src/org/apache/thrift/TBase.hx
----------------------------------------------------------------------
diff --git a/lib/haxe/src/org/apache/thrift/TBase.hx b/lib/haxe/src/org/apache/thrift/TBase.hx
index 5d8bfc1..a35c752 100644
--- a/lib/haxe/src/org/apache/thrift/TBase.hx
+++ b/lib/haxe/src/org/apache/thrift/TBase.hx
@@ -26,38 +26,38 @@ import org.apache.thrift.protocol.TProtocol;
*
*/
interface TBase {
-
+
/**
* Reads the TObject from the given input protocol.
*
* @param iprot Input protocol
*/
function read(iprot:TProtocol) : Void;
-
+
/**
* Writes the objects out to the protocol
*
* @param oprot Output protocol
*/
function write(oprot:TProtocol) : Void;
-
+
/**
* Check if a field is currently set or unset.
*
* @param fieldId The field's id tag as found in the IDL.
*/
function isSet(fieldId : Int) : Bool;
-
+
/**
- * Get a field's value by id. Primitive types will be wrapped in the
+ * Get a field's value by id. Primitive types will be wrapped in the
* appropriate "boxed" types.
*
* @param fieldId The field's id tag as found in the IDL.
*/
function getFieldValue(fieldId : Int) : Dynamic;
-
+
/**
- * Set a field's value by id. Primitive types must be "boxed" in the
+ * Set a field's value by id. Primitive types must be "boxed" in the
* appropriate object wrapper type.
*
* @param fieldId The field's id tag as found in the IDL.
http://git-wip-us.apache.org/repos/asf/thrift/blob/b502832c/lib/haxe/src/org/apache/thrift/TException.hx
----------------------------------------------------------------------
diff --git a/lib/haxe/src/org/apache/thrift/TException.hx b/lib/haxe/src/org/apache/thrift/TException.hx
index ed630ba..54fa1ff 100644
--- a/lib/haxe/src/org/apache/thrift/TException.hx
+++ b/lib/haxe/src/org/apache/thrift/TException.hx
@@ -16,20 +16,21 @@
* specific language governing permissions and limitations
* under the License.
*/
-
+
package org.apache.thrift;
class TException {
-
- @:isVar
- public var errorID(default,null) : Int;
- @:isVar
- public var errorMsg(default,null) : String;
-
- public function new(msg : String = "", id : Int = 0) {
- errorID = id;
- errorMsg = msg;
- }
-
+ @:isVar
+ public var errorID(default,null) : Int;
+ @:isVar
+ public var errorMsg(default,null) : String;
+
+
+ public function new(msg : String = "", id : Int = 0) {
+ errorID = id;
+ errorMsg = msg;
+ }
+
}
+
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/thrift/blob/b502832c/lib/haxe/src/org/apache/thrift/TFieldRequirementType.hx
----------------------------------------------------------------------
diff --git a/lib/haxe/src/org/apache/thrift/TFieldRequirementType.hx b/lib/haxe/src/org/apache/thrift/TFieldRequirementType.hx
index 70f698f..7c22030 100644
--- a/lib/haxe/src/org/apache/thrift/TFieldRequirementType.hx
+++ b/lib/haxe/src/org/apache/thrift/TFieldRequirementType.hx
@@ -27,5 +27,5 @@ class TFieldRequirementType {
public static inline var REQUIRED : Int = 1;
public static inline var OPTIONAL : Int = 2;
public static inline var DEFAULT : Int = 3;
-
+
}
http://git-wip-us.apache.org/repos/asf/thrift/blob/b502832c/lib/haxe/src/org/apache/thrift/TProcessor.hx
----------------------------------------------------------------------
diff --git a/lib/haxe/src/org/apache/thrift/TProcessor.hx b/lib/haxe/src/org/apache/thrift/TProcessor.hx
index 78ce5a7..0cb6f7d 100644
--- a/lib/haxe/src/org/apache/thrift/TProcessor.hx
+++ b/lib/haxe/src/org/apache/thrift/TProcessor.hx
@@ -26,5 +26,5 @@ import org.apache.thrift.protocol.TProtocol;
* writes to some output stream.
*/
interface TProcessor {
- function process(input:TProtocol, output:TProtocol) : Bool;
+ function process(input:TProtocol, output:TProtocol) : Bool;
}
http://git-wip-us.apache.org/repos/asf/thrift/blob/b502832c/lib/haxe/src/org/apache/thrift/helper/Int64Map.hx
----------------------------------------------------------------------
diff --git a/lib/haxe/src/org/apache/thrift/helper/Int64Map.hx b/lib/haxe/src/org/apache/thrift/helper/Int64Map.hx
index 8d9e4e1..6d6a6a1 100644
--- a/lib/haxe/src/org/apache/thrift/helper/Int64Map.hx
+++ b/lib/haxe/src/org/apache/thrift/helper/Int64Map.hx
@@ -29,187 +29,187 @@ import haxe.ds.IntMap;
class Int64Map<T> implements IMap< Int64, T> {
- private var SubMaps : IntMap< IntMap< T>>; // Hi -> Lo -> Value
-
- public function new() : Void {
- SubMaps = new IntMap< IntMap< T>>();
- };
-
- private function GetSubMap( hi : haxe.Int32, canCreate : Bool) : IntMap< T> {
- if( SubMaps.exists(hi)) {
- return SubMaps.get(hi);
- }
-
- if( ! canCreate) {
- return null;
- }
-
- var lomap = new IntMap< T>();
- SubMaps.set( hi, lomap);
- return lomap;
- }
-
- /**
- Maps `key` to `value`.
- If `key` already has a mapping, the previous value disappears.
- If `key` is null, the result is unspecified.
- **/
- public function set( key : Int64, value : T ) : Void {
- if( key == null) {
- return;
- }
-
- var lomap = GetSubMap( Int64.getHigh(key), true);
- lomap.set( Int64.getLow(key), value);
- }
-
-
- /**
- Returns the current mapping of `key`.
- If no such mapping exists, null is returned.
- If `key` is null, the result is unspecified.
-
- Note that a check like `map.get(key) == null` can hold for two reasons:
-
- 1. the map has no mapping for `key`
- 2. the map has a mapping with a value of `null`
-
- If it is important to distinguish these cases, `exists()` should be
- used.
-
- **/
- public function get( key : Int64) : Null<T> {
- if( key == null) {
- return null;
- }
-
- var lomap = GetSubMap( Int64.getHigh(key), false);
- if( lomap == null) {
- return null;
- }
-
- return lomap.get( Int64.getLow(key));
- }
-
- /**
- Returns true if `key` has a mapping, false otherwise.
- If `key` is null, the result is unspecified.
- **/
- public function exists( key : Int64) : Bool {
- if( key == null) {
- return false;
- }
-
- var lomap = GetSubMap( Int64.getHigh(key), false);
- if( lomap == null) {
- return false;
- }
-
- return lomap.exists( Int64.getLow(key));
- }
-
- /**
- Removes the mapping of `key` and returns true if such a mapping existed,
- false otherwise. If `key` is null, the result is unspecified.
- **/
- public function remove( key : Int64) : Bool {
- if( key == null) {
- return false;
- }
-
- var lomap = GetSubMap( Int64.getHigh(key), false);
- if( lomap == null) {
- return false;
- }
-
- return lomap.remove( Int64.getLow(key));
- }
-
-
- /**
- Returns an Iterator over the keys of `this` Map.
- The order of keys is undefined.
- **/
- public function keys() : Iterator<Int64> {
- return new Int64KeyIterator<T>(SubMaps);
- }
-
- /**
- Returns an Iterator over the values of `this` Map.
- The order of values is undefined.
- **/
- public function iterator() : Iterator<T> {
- return new Int64ValueIterator<T>(SubMaps);
- }
-
- /**
- Returns a String representation of `this` Map.
- The exact representation depends on the platform and key-type.
- **/
- public function toString() : String {
- var result : String = "{";
-
- var first = true;
- for( key in this.keys()) {
- if( first) {
- first = false;
- } else {
- result += ", ";
- }
-
- var value = this.get(key);
- result += Int64.toStr(key) + ' => $value';
- }
-
- return result + "}";
- }
+ private var SubMaps : IntMap< IntMap< T>>; // Hi -> Lo -> Value
+
+ public function new() : Void {
+ SubMaps = new IntMap< IntMap< T>>();
+ };
+
+ private function GetSubMap( hi : haxe.Int32, canCreate : Bool) : IntMap< T> {
+ if( SubMaps.exists(hi)) {
+ return SubMaps.get(hi);
+ }
+
+ if( ! canCreate) {
+ return null;
+ }
+
+ var lomap = new IntMap< T>();
+ SubMaps.set( hi, lomap);
+ return lomap;
+ }
+
+ /**
+ Maps `key` to `value`.
+ If `key` already has a mapping, the previous value disappears.
+ If `key` is null, the result is unspecified.
+ **/
+ public function set( key : Int64, value : T ) : Void {
+ if( key == null) {
+ return;
+ }
+
+ var lomap = GetSubMap( Int64.getHigh(key), true);
+ lomap.set( Int64.getLow(key), value);
+ }
+
+
+ /**
+ Returns the current mapping of `key`.
+ If no such mapping exists, null is returned.
+ If `key` is null, the result is unspecified.
+
+ Note that a check like `map.get(key) == null` can hold for two reasons:
+
+ 1. the map has no mapping for `key`
+ 2. the map has a mapping with a value of `null`
+
+ If it is important to distinguish these cases, `exists()` should be
+ used.
+
+ **/
+ public function get( key : Int64) : Null<T> {
+ if( key == null) {
+ return null;
+ }
+
+ var lomap = GetSubMap( Int64.getHigh(key), false);
+ if( lomap == null) {
+ return null;
+ }
+
+ return lomap.get( Int64.getLow(key));
+ }
+
+ /**
+ Returns true if `key` has a mapping, false otherwise.
+ If `key` is null, the result is unspecified.
+ **/
+ public function exists( key : Int64) : Bool {
+ if( key == null) {
+ return false;
+ }
+
+ var lomap = GetSubMap( Int64.getHigh(key), false);
+ if( lomap == null) {
+ return false;
+ }
+
+ return lomap.exists( Int64.getLow(key));
+ }
+
+ /**
+ Removes the mapping of `key` and returns true if such a mapping existed,
+ false otherwise. If `key` is null, the result is unspecified.
+ **/
+ public function remove( key : Int64) : Bool {
+ if( key == null) {
+ return false;
+ }
+
+ var lomap = GetSubMap( Int64.getHigh(key), false);
+ if( lomap == null) {
+ return false;
+ }
+
+ return lomap.remove( Int64.getLow(key));
+ }
+
+
+ /**
+ Returns an Iterator over the keys of `this` Map.
+ The order of keys is undefined.
+ **/
+ public function keys() : Iterator<Int64> {
+ return new Int64KeyIterator<T>(SubMaps);
+ }
+
+ /**
+ Returns an Iterator over the values of `this` Map.
+ The order of values is undefined.
+ **/
+ public function iterator() : Iterator<T> {
+ return new Int64ValueIterator<T>(SubMaps);
+ }
+
+ /**
+ Returns a String representation of `this` Map.
+ The exact representation depends on the platform and key-type.
+ **/
+ public function toString() : String {
+ var result : String = "{";
+
+ var first = true;
+ for( key in this.keys()) {
+ if( first) {
+ first = false;
+ } else {
+ result += ", ";
+ }
+
+ var value = this.get(key);
+ result += Int64.toStr(key) + ' => $value';
+ }
+
+ return result + "}";
+ }
}
-
+
// internal helper class for Int64Map<T>
// all class with matching methods can be used as iterator (duck typing)
private class Int64MapIteratorBase<T> {
- private var SubMaps : IntMap< IntMap< T>>; // Hi -> Lo -> Value
-
- private var HiIterator : Iterator< Int> = null;
- private var LoIterator : Iterator< Int> = null;
- private var CurrentHi : Int = 0;
-
- public function new( data : IntMap< IntMap< T>>) : Void {
- SubMaps = data;
- HiIterator = SubMaps.keys();
- LoIterator = null;
- CurrentHi = 0;
- };
-
- /**
- Returns false if the iteration is complete, true otherwise.
-
- Usually iteration is considered to be complete if all elements of the
- underlying data structure were handled through calls to next(). However,
- in custom iterators any logic may be used to determine the completion
- state.
- **/
- public function hasNext() : Bool {
-
- if( (LoIterator != null) && LoIterator.hasNext()) {
- return true;
- }
-
- while( (HiIterator != null) && HiIterator.hasNext()) {
- CurrentHi = HiIterator.next();
- LoIterator = SubMaps.get(CurrentHi).keys();
- if( (LoIterator != null) && LoIterator.hasNext()) {
- return true;
- }
- }
-
- HiIterator = null;
- LoIterator = null;
- return false;
- }
+ private var SubMaps : IntMap< IntMap< T>>; // Hi -> Lo -> Value
+
+ private var HiIterator : Iterator< Int> = null;
+ private var LoIterator : Iterator< Int> = null;
+ private var CurrentHi : Int = 0;
+
+ public function new( data : IntMap< IntMap< T>>) : Void {
+ SubMaps = data;
+ HiIterator = SubMaps.keys();
+ LoIterator = null;
+ CurrentHi = 0;
+ };
+
+ /**
+ Returns false if the iteration is complete, true otherwise.
+
+ Usually iteration is considered to be complete if all elements of the
+ underlying data structure were handled through calls to next(). However,
+ in custom iterators any logic may be used to determine the completion
+ state.
+ **/
+ public function hasNext() : Bool {
+
+ if( (LoIterator != null) && LoIterator.hasNext()) {
+ return true;
+ }
+
+ while( (HiIterator != null) && HiIterator.hasNext()) {
+ CurrentHi = HiIterator.next();
+ LoIterator = SubMaps.get(CurrentHi).keys();
+ if( (LoIterator != null) && LoIterator.hasNext()) {
+ return true;
+ }
+ }
+
+ HiIterator = null;
+ LoIterator = null;
+ return false;
+ }
}
@@ -218,23 +218,23 @@ private class Int64MapIteratorBase<T> {
// all class with matching methods can be used as iterator (duck typing)
private class Int64KeyIterator<T>extends Int64MapIteratorBase<T> {
- public function new( data : IntMap< IntMap< T>>) : Void {
- super(data);
- };
-
- /**
- Returns the current item of the Iterator and advances to the next one.
-
- This method is not required to check hasNext() first. A call to this
- method while hasNext() is false yields unspecified behavior.
- **/
- public function next() : Int64 {
- if( hasNext()) {
- return Int64.make( CurrentHi, LoIterator.next());
- } else {
- throw "no more elements";
- }
- }
+ public function new( data : IntMap< IntMap< T>>) : Void {
+ super(data);
+ };
+
+ /**
+ Returns the current item of the Iterator and advances to the next one.
+
+ This method is not required to check hasNext() first. A call to this
+ method while hasNext() is false yields unspecified behavior.
+ **/
+ public function next() : Int64 {
+ if( hasNext()) {
+ return Int64.make( CurrentHi, LoIterator.next());
+ } else {
+ throw "no more elements";
+ }
+ }
}
@@ -242,23 +242,23 @@ private class Int64KeyIterator<T>extends Int64MapIteratorBase<T> {
// all class with matching methods can be used as iterator (duck typing)
private class Int64ValueIterator<T> extends Int64MapIteratorBase<T> {
- public function new( data : IntMap< IntMap< T>>) : Void {
- super(data);
- };
-
- /**
- Returns the current item of the Iterator and advances to the next one.
-
- This method is not required to check hasNext() first. A call to this
- method while hasNext() is false yields unspecified behavior.
- **/
- public function next() : T {
- if( hasNext()) {
- return SubMaps.get(CurrentHi).get(LoIterator.next());
- } else {
- throw "no more elements";
- }
- }
+ public function new( data : IntMap< IntMap< T>>) : Void {
+ super(data);
+ };
+
+ /**
+ Returns the current item of the Iterator and advances to the next one.
+
+ This method is not required to check hasNext() first. A call to this
+ method while hasNext() is false yields unspecified behavior.
+ **/
+ public function next() : T {
+ if( hasNext()) {
+ return SubMaps.get(CurrentHi).get(LoIterator.next());
+ } else {
+ throw "no more elements";
+ }
+ }
}
http://git-wip-us.apache.org/repos/asf/thrift/blob/b502832c/lib/haxe/src/org/apache/thrift/helper/IntSet.hx
----------------------------------------------------------------------
diff --git a/lib/haxe/src/org/apache/thrift/helper/IntSet.hx b/lib/haxe/src/org/apache/thrift/helper/IntSet.hx
index 214f3bd..91e5d8e 100644
--- a/lib/haxe/src/org/apache/thrift/helper/IntSet.hx
+++ b/lib/haxe/src/org/apache/thrift/helper/IntSet.hx
@@ -18,79 +18,79 @@
*/
package org.apache.thrift.helper;
-
+
import Map;
class IntSet {
-
+
private var _elements = new haxe.ds.IntMap<Int>();
private var _size : Int = 0;
public var size(get,never) : Int;
-
+
public function new( values : Array<Int> = null) {
- if ( values != null) {
- for ( value in values) {
- add(value);
- }
- }
+ if ( values != null) {
+ for ( value in values) {
+ add(value);
+ }
+ }
}
- public function iterator():Iterator<Int> {
- return _elements.keys();
- }
+ public function iterator():Iterator<Int> {
+ return _elements.keys();
+ }
- public function traceAll() : Void {
- trace('$_size entries');
- for(entry in this) {
- var yes = contains(entry);
- trace('- $entry, contains() = $yes');
- }
- }
+ public function traceAll() : Void {
+ trace('$_size entries');
+ for(entry in this) {
+ var yes = contains(entry);
+ trace('- $entry, contains() = $yes');
+ }
+ }
public function add(o : Int) : Bool {
- if( _elements.exists(o)) {
- return false;
- }
+ if( _elements.exists(o)) {
+ return false;
+ }
_size++;
_elements.set(o,_size);
- return true;
+ return true;
}
public function clear() : Void {
- while( _size > 0) {
- remove( _elements.keys().next());
- }
+ while( _size > 0) {
+ remove( _elements.keys().next());
+ }
}
-
+
public function contains(o : Int) : Bool {
- return _elements.exists(o);
+ return _elements.exists(o);
}
-
+
public function isEmpty() : Bool {
- return _size == 0;
+ return _size == 0;
}
-
+
public function remove(o : Int) : Bool {
- if (contains(o)) {
- _elements.remove(o);
- _size--;
- return true;
- } else {
- return false;
- }
+ if (contains(o)) {
+ _elements.remove(o);
+ _size--;
+ return true;
+ } else {
+ return false;
+ }
}
-
+
public function toArray() : Array<Int> {
- var ret : Array<Int> = new Array<Int>();
- for (key in _elements.keys()) {
- ret.push(key);
- }
- return ret;
+ var ret : Array<Int> = new Array<Int>();
+ for (key in _elements.keys()) {
+ ret.push(key);
+ }
+ return ret;
}
-
- public function get_size() : Int {
- return _size;
+
+ public function get_size() : Int {
+ return _size;
}
}
-
\ No newline at end of file
+
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/thrift/blob/b502832c/lib/haxe/src/org/apache/thrift/helper/ObjectSet.hx
----------------------------------------------------------------------
diff --git a/lib/haxe/src/org/apache/thrift/helper/ObjectSet.hx b/lib/haxe/src/org/apache/thrift/helper/ObjectSet.hx
index c590c75..bcf72fb 100644
--- a/lib/haxe/src/org/apache/thrift/helper/ObjectSet.hx
+++ b/lib/haxe/src/org/apache/thrift/helper/ObjectSet.hx
@@ -18,79 +18,79 @@
*/
package org.apache.thrift.helper;
-
+
import Map;
class ObjectSet<K> {
-
+
private var _elements = new haxe.ds.ObjectMap<K,Int>();
private var _size : Int = 0;
public var size(get,never) : Int;
-
+
public function new( values : Array<K> = null) {
- if ( values != null) {
- for ( value in values) {
- add(value);
- }
- }
+ if ( values != null) {
+ for ( value in values) {
+ add(value);
+ }
+ }
}
- public function iterator():Iterator<K> {
- return _elements.keys();
- }
+ public function iterator():Iterator<K> {
+ return _elements.keys();
+ }
- public function traceAll() : Void {
- trace('$_size entries');
- for(entry in this) {
- var yes = contains(entry);
- trace('- $entry, contains() = $yes');
- }
- }
+ public function traceAll() : Void {
+ trace('$_size entries');
+ for(entry in this) {
+ var yes = contains(entry);
+ trace('- $entry, contains() = $yes');
+ }
+ }
public function add(o : K) : Bool {
- if( _elements.exists(o)) {
- return false;
- }
+ if( _elements.exists(o)) {
+ return false;
+ }
_size++;
_elements.set(o,_size);
- return true;
+ return true;
}
public function clear() : Void {
- while( _size > 0) {
- remove( _elements.keys().next());
- }
+ while( _size > 0) {
+ remove( _elements.keys().next());
+ }
}
-
+
public function contains(o : K) : Bool {
- return _elements.exists(o);
+ return _elements.exists(o);
}
-
+
public function isEmpty() : Bool {
- return _size == 0;
+ return _size == 0;
}
-
+
public function remove(o : K) : Bool {
- if (contains(o)) {
- _elements.remove(o);
- _size--;
- return true;
- } else {
- return false;
- }
+ if (contains(o)) {
+ _elements.remove(o);
+ _size--;
+ return true;
+ } else {
+ return false;
+ }
}
-
+
public function toArray() : Array<K> {
- var ret : Array<K> = new Array<K>();
- for (key in _elements.keys()) {
- ret.push(key);
- }
- return ret;
+ var ret : Array<K> = new Array<K>();
+ for (key in _elements.keys()) {
+ ret.push(key);
+ }
+ return ret;
}
-
- public function get_size() : Int {
- return _size;
+
+ public function get_size() : Int {
+ return _size;
}
}
-
\ No newline at end of file
+
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/thrift/blob/b502832c/lib/haxe/src/org/apache/thrift/helper/StringSet.hx
----------------------------------------------------------------------
diff --git a/lib/haxe/src/org/apache/thrift/helper/StringSet.hx b/lib/haxe/src/org/apache/thrift/helper/StringSet.hx
index ee772c7..d8c0d90 100644
--- a/lib/haxe/src/org/apache/thrift/helper/StringSet.hx
+++ b/lib/haxe/src/org/apache/thrift/helper/StringSet.hx
@@ -18,79 +18,79 @@
*/
package org.apache.thrift.helper;
-
+
import Map;
class StringSet {
-
+
private var _elements = new haxe.ds.StringMap<Int>();
private var _size : Int = 0;
public var size(get,never) : Int;
-
+
public function new( values : Array<String> = null) {
- if ( values != null) {
- for ( value in values) {
- add(value);
- }
- }
+ if ( values != null) {
+ for ( value in values) {
+ add(value);
+ }
+ }
}
- public function iterator():Iterator<String> {
- return _elements.keys();
- }
+ public function iterator():Iterator<String> {
+ return _elements.keys();
+ }
- public function traceAll() : Void {
- trace('$_size entries');
- for(entry in this) {
- var yes = contains(entry);
- trace('- $entry, contains() = $yes');
- }
- }
+ public function traceAll() : Void {
+ trace('$_size entries');
+ for(entry in this) {
+ var yes = contains(entry);
+ trace('- $entry, contains() = $yes');
+ }
+ }
public function add(o : String) : Bool {
- if( _elements.exists(o)) {
- return false;
- }
+ if( _elements.exists(o)) {
+ return false;
+ }
_size++;
_elements.set(o,_size);
- return true;
+ return true;
}
public function clear() : Void {
- while( _size > 0) {
- remove( _elements.keys().next());
- }
+ while( _size > 0) {
+ remove( _elements.keys().next());
+ }
}
-
+
public function contains(o : String) : Bool {
- return _elements.exists(o);
+ return _elements.exists(o);
}
-
+
public function isEmpty() : Bool {
- return _size == 0;
+ return _size == 0;
}
-
+
public function remove(o : String) : Bool {
- if (contains(o)) {
- _elements.remove(o);
- _size--;
- return true;
- } else {
- return false;
- }
+ if (contains(o)) {
+ _elements.remove(o);
+ _size--;
+ return true;
+ } else {
+ return false;
+ }
}
-
+
public function toArray() : Array<String> {
- var ret : Array<String> = new Array<String>();
- for (key in _elements.keys()) {
- ret.push(key);
- }
- return ret;
+ var ret : Array<String> = new Array<String>();
+ for (key in _elements.keys()) {
+ ret.push(key);
+ }
+ return ret;
}
-
- public function get_size() : String {
- return _size;
+
+ public function get_size() : String {
+ return _size;
}
}
-
\ No newline at end of file
+
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/thrift/blob/b502832c/lib/haxe/src/org/apache/thrift/meta_data/FieldMetaData.hx
----------------------------------------------------------------------
diff --git a/lib/haxe/src/org/apache/thrift/meta_data/FieldMetaData.hx b/lib/haxe/src/org/apache/thrift/meta_data/FieldMetaData.hx
index 147eed9..26db113 100644
--- a/lib/haxe/src/org/apache/thrift/meta_data/FieldMetaData.hx
+++ b/lib/haxe/src/org/apache/thrift/meta_data/FieldMetaData.hx
@@ -27,19 +27,19 @@ import flash.utils.Dictionary;
*
*/
class FieldMetaData {
-
+
public var fieldName : String;
public var requirementType : Int;
public var valueMetaData:FieldValueMetaData;
-
+
private static var structMap:Dictionary = new Dictionary();
-
+
public function FieldMetaData(name : String, req : Int, vMetaData:FieldValueMetaData) {
this.fieldName = name;
this.requirementType = req;
this.valueMetaData = vMetaData;
}
-
+
public static function addStructMetaDataMap(sClass:Class, map:Dictionary) : Void{
structMap[sClass] = map;
}
http://git-wip-us.apache.org/repos/asf/thrift/blob/b502832c/lib/haxe/src/org/apache/thrift/meta_data/FieldValueMetaData.hx
----------------------------------------------------------------------
diff --git a/lib/haxe/src/org/apache/thrift/meta_data/FieldValueMetaData.hx b/lib/haxe/src/org/apache/thrift/meta_data/FieldValueMetaData.hx
index 06c7f48..8879d91 100644
--- a/lib/haxe/src/org/apache/thrift/meta_data/FieldValueMetaData.hx
+++ b/lib/haxe/src/org/apache/thrift/meta_data/FieldValueMetaData.hx
@@ -26,17 +26,17 @@ import org.apache.thrift.protocol.TType;
* the value(s) of a field
*/
class FieldValueMetaData {
-
- public var type : Int;
-
+
+ public var type : Int;
+
public function FieldValueMetaData(type : Int) {
this.type = type;
}
-
+
public function isStruct() : Bool {
- return type == TType.STRUCT;
+ return type == TType.STRUCT;
}
-
+
public function isContainer() : Bool {
return type == TType.LIST || type == TType.MAP || type == TType.SET;
}
http://git-wip-us.apache.org/repos/asf/thrift/blob/b502832c/lib/haxe/src/org/apache/thrift/meta_data/ListMetaData.hx
----------------------------------------------------------------------
diff --git a/lib/haxe/src/org/apache/thrift/meta_data/ListMetaData.hx b/lib/haxe/src/org/apache/thrift/meta_data/ListMetaData.hx
index 36bb2d1..40ca31b 100644
--- a/lib/haxe/src/org/apache/thrift/meta_data/ListMetaData.hx
+++ b/lib/haxe/src/org/apache/thrift/meta_data/ListMetaData.hx
@@ -18,13 +18,14 @@
*/
package org.apache.thrift.meta_data;
-
+
class ListMetaData extends FieldValueMetaData {
-
+
public var elemMetaData:FieldValueMetaData;
-
+
public function ListMetaData(type : Int, eMetaData:FieldValueMetaData) {
super(type);
this.elemMetaData = eMetaData;
- }
+ }
}
+
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/thrift/blob/b502832c/lib/haxe/src/org/apache/thrift/meta_data/MapMetaData.hx
----------------------------------------------------------------------
diff --git a/lib/haxe/src/org/apache/thrift/meta_data/MapMetaData.hx b/lib/haxe/src/org/apache/thrift/meta_data/MapMetaData.hx
index bf0502a..5463e62 100644
--- a/lib/haxe/src/org/apache/thrift/meta_data/MapMetaData.hx
+++ b/lib/haxe/src/org/apache/thrift/meta_data/MapMetaData.hx
@@ -20,13 +20,14 @@
package org.apache.thrift.meta_data;
class MapMetaData extends FieldValueMetaData {
-
+
public var keyMetaData:FieldValueMetaData;
public var valueMetaData:FieldValueMetaData;
-
+
public function MapMetaData(type : Int, kMetaData:FieldValueMetaData, vMetaData:FieldValueMetaData) {
super(type);
this.keyMetaData = kMetaData;
this.valueMetaData = vMetaData;
}
-}
+}
+
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/thrift/blob/b502832c/lib/haxe/src/org/apache/thrift/meta_data/SetMetaData.hx
----------------------------------------------------------------------
diff --git a/lib/haxe/src/org/apache/thrift/meta_data/SetMetaData.hx b/lib/haxe/src/org/apache/thrift/meta_data/SetMetaData.hx
index 0ee6c93..a3367f4 100644
--- a/lib/haxe/src/org/apache/thrift/meta_data/SetMetaData.hx
+++ b/lib/haxe/src/org/apache/thrift/meta_data/SetMetaData.hx
@@ -20,11 +20,11 @@
package org.apache.thrift.meta_data;
class SetMetaData extends FieldValueMetaData {
-
+
public var elemMetaData:FieldValueMetaData;
-
+
public function SetMetaData(type : Int, eMetaData:FieldValueMetaData) {
super(type);
- this.elemMetaData = eMetaData;
+ this.elemMetaData = eMetaData;
}
}
http://git-wip-us.apache.org/repos/asf/thrift/blob/b502832c/lib/haxe/src/org/apache/thrift/meta_data/StructMetaData.hx
----------------------------------------------------------------------
diff --git a/lib/haxe/src/org/apache/thrift/meta_data/StructMetaData.hx b/lib/haxe/src/org/apache/thrift/meta_data/StructMetaData.hx
index bbf11e7..1822dd3 100644
--- a/lib/haxe/src/org/apache/thrift/meta_data/StructMetaData.hx
+++ b/lib/haxe/src/org/apache/thrift/meta_data/StructMetaData.hx
@@ -20,9 +20,9 @@
package org.apache.thrift.meta_data;
class StructMetaData extends FieldValueMetaData {
-
+
public var structClass:Class;
-
+
public function StructMetaData(type : Int, sClass:Class) {
super(type);
this.structClass = sClass;
http://git-wip-us.apache.org/repos/asf/thrift/blob/b502832c/lib/haxe/src/org/apache/thrift/protocol/TBinaryProtocol.hx
----------------------------------------------------------------------
diff --git a/lib/haxe/src/org/apache/thrift/protocol/TBinaryProtocol.hx b/lib/haxe/src/org/apache/thrift/protocol/TBinaryProtocol.hx
index 9693b35..c37b74e 100644
--- a/lib/haxe/src/org/apache/thrift/protocol/TBinaryProtocol.hx
+++ b/lib/haxe/src/org/apache/thrift/protocol/TBinaryProtocol.hx
@@ -33,264 +33,264 @@ import org.apache.thrift.transport.TTransport;
*/
class TBinaryProtocol implements TProtocol {
- private static var ANONYMOUS_STRUCT:TStruct = new TStruct();
-
- private static inline var VERSION_MASK : haxe.Int32 = 0xffff0000;
- private static inline var VERSION_1 : haxe.Int32 = 0x80010000;
-
- private var strictRead_ : Bool = false;
- private var strictWrite_ : Bool = true;
- private var trans_ : TTransport;
-
- /**
- * Constructor
- */
- public function new(trans:TTransport, strictRead : Bool=false, strictWrite : Bool=true) {
- trans_ = trans;
- strictRead_ = strictRead;
- strictWrite_ = strictWrite;
- }
-
- public function getTransport():TTransport {
- return trans_;
- }
-
- public function writeMessageBegin(message:TMessage) : Void {
- if (strictWrite_) {
- var version : Int = VERSION_1 | message.type;
- writeI32(version);
- writeString(message.name);
- writeI32(message.seqid);
- } else {
- writeString(message.name);
- writeByte(message.type);
- writeI32(message.seqid);
- }
- }
+ private static var ANONYMOUS_STRUCT:TStruct = new TStruct();
+
+ private static inline var VERSION_MASK : haxe.Int32 = 0xffff0000;
+ private static inline var VERSION_1 : haxe.Int32 = 0x80010000;
+
+ private var strictRead_ : Bool = false;
+ private var strictWrite_ : Bool = true;
+ private var trans_ : TTransport;
+
+ /**
+ * Constructor
+ */
+ public function new(trans:TTransport, strictRead : Bool=false, strictWrite : Bool=true) {
+ trans_ = trans;
+ strictRead_ = strictRead;
+ strictWrite_ = strictWrite;
+ }
+
+ public function getTransport():TTransport {
+ return trans_;
+ }
+
+ public function writeMessageBegin(message:TMessage) : Void {
+ if (strictWrite_) {
+ var version : Int = VERSION_1 | message.type;
+ writeI32(version);
+ writeString(message.name);
+ writeI32(message.seqid);
+ } else {
+ writeString(message.name);
+ writeByte(message.type);
+ writeI32(message.seqid);
+ }
+ }
public function writeMessageEnd() : Void {}
- public function writeStructBegin(struct:TStruct) : Void {}
-
- public function writeStructEnd() : Void {}
-
- public function writeFieldBegin(field:TField) : Void {
- writeByte(field.type);
- writeI16(field.id);
- }
-
- public function writeFieldEnd() : Void {}
-
- public function writeFieldStop() : Void {
- writeByte(TType.STOP);
- }
-
- public function writeMapBegin(map:TMap) : Void {
- writeByte(map.keyType);
- writeByte(map.valueType);
- writeI32(map.size);
- }
-
- public function writeMapEnd() : Void {}
-
- public function writeListBegin(list:TList) : Void {
- writeByte(list.elemType);
- writeI32(list.size);
- }
-
- public function writeListEnd() : Void {}
-
- public function writeSetBegin(set:TSet) : Void {
- writeByte(set.elemType);
- writeI32(set.size);
- }
-
- public function writeSetEnd() : Void {}
-
- public function writeBool(b : Bool) : Void {
- writeByte(b ? 1 : 0);
- }
-
-
- public function writeByte(b : Int) : Void {
- var out = new BytesOutput();
- out.bigEndian = true;
- out.writeByte(b);
- trans_.write(out.getBytes(), 0, 1);
- }
-
- public function writeI16(i16 : Int) : Void {
- var out = new BytesOutput();
- out.bigEndian = true;
- out.writeInt16(i16);
- trans_.write(out.getBytes(), 0, 2);
- }
-
- public function writeI32(i32 : Int) : Void {
- var out = new BytesOutput();
- out.bigEndian = true;
- out.writeInt32(i32);
- trans_.write(out.getBytes(), 0, 4);
- }
-
- public function writeI64(i64 : haxe.Int64) : Void {
- var out = new BytesOutput();
- out.bigEndian = true;
- var hi = Int64.getHigh(i64);
- var lo = Int64.getLow(i64);
- out.writeInt32(hi);
- out.writeInt32(lo);
- trans_.write(out.getBytes(), 0, 8);
- }
-
- public function writeDouble(dub:Float) : Void {
- var out = new BytesOutput();
- out.bigEndian = true;
- out.writeDouble(dub);
- trans_.write(out.getBytes(), 0, 8);
- }
-
- public function writeString(str : String) : Void {
- var out = new BytesOutput();
- out.bigEndian = true;
- out.writeString(str);
- var bytes = out.getBytes();
- writeI32( bytes.length);
- trans_.write( bytes, 0, bytes.length);
- }
-
- public function writeBinary(bin:Bytes) : Void {
- writeI32(bin.length);
- trans_.write(bin, 0, bin.length);
- }
-
- /**
- * Reading methods.
- */
-
- public function readMessageBegin():TMessage {
- var size : Int = readI32();
- if (size < 0) {
- var version : Int = size & VERSION_MASK;
- if (version != VERSION_1) {
- throw new TProtocolException(TProtocolException.BAD_VERSION, "Bad version in readMessageBegin");
- }
- return new TMessage(readString(), size & 0x000000ff, readI32());
- } else {
- if (strictRead_) {
- throw new TProtocolException(TProtocolException.BAD_VERSION, "Missing version in readMessageBegin, old client?");
- }
- return new TMessage(readStringBody(size), readByte(), readI32());
- }
- }
-
- public function readMessageEnd() : Void {}
-
- public function readStructBegin():TStruct {
- return ANONYMOUS_STRUCT;
- }
-
- public function readStructEnd() : Void {}
-
- public function readFieldBegin() : TField {
- var type : Int = readByte();
- var id : Int = 0;
- if (type != TType.STOP)
- {
- id = readI16();
- }
- return new TField("", type, id);
- }
-
- public function readFieldEnd() : Void {}
-
- public function readMapBegin() : TMap {
- return new TMap(readByte(), readByte(), readI32());
- }
-
- public function readMapEnd() : Void {}
-
- public function readListBegin():TList {
- return new TList(readByte(), readI32());
- }
-
- public function readListEnd() : Void {}
-
- public function readSetBegin() : TSet {
- return new TSet(readByte(), readI32());
- }
-
- public function readSetEnd() : Void {}
-
- public function readBool() : Bool {
- return (readByte() == 1);
- }
-
-
- public function readByte() : Int {
- var buffer = new BytesBuffer();
- var len = trans_.readAll( buffer, 0, 1);
- var inp = new BytesInput( buffer.getBytes(), 0, 1);
- inp.bigEndian = true;
- return inp.readByte();
- }
-
- public function readI16() : Int {
- var buffer = new BytesBuffer();
- var len = trans_.readAll( buffer, 0, 2);
- var inp = new BytesInput( buffer.getBytes(), 0, 2);
- inp.bigEndian = true;
- return inp.readInt16();
- }
-
- public function readI32() : Int {
- var buffer = new BytesBuffer();
- var len = trans_.readAll( buffer, 0, 4);
- var inp = new BytesInput( buffer.getBytes(), 0, 4);
- inp.bigEndian = true;
- return inp.readInt32();
- }
-
- public function readI64() : haxe.Int64 {
- var buffer = new BytesBuffer();
- var len = trans_.readAll( buffer, 0, 8);
- var inp = new BytesInput( buffer.getBytes(), 0, 8);
- inp.bigEndian = true;
- var hi = inp.readInt32();
- var lo = inp.readInt32();
- return Int64.make(hi,lo);
- }
-
- public function readDouble():Float {
- var buffer = new BytesBuffer();
- var len = trans_.readAll( buffer, 0, 8);
- var inp = new BytesInput( buffer.getBytes(), 0, 8);
- inp.bigEndian = true;
- return inp.readDouble();
- }
-
- public function readString() : String {
- return readStringBody( readI32());
- }
-
- public function readStringBody(len : Int) : String {
- if( len > 0) {
- var buffer = new BytesBuffer();
- trans_.readAll( buffer, 0, len);
- var inp = new BytesInput( buffer.getBytes(), 0, len);
- inp.bigEndian = true;
- return inp.readString(len);
- } else {
- return "";
- }
- }
-
- public function readBinary() : Bytes {
- var len : Int = readI32();
- var buffer = new BytesBuffer();
- trans_.readAll( buffer, 0, len);
- return buffer.getBytes();
- }
+ public function writeStructBegin(struct:TStruct) : Void {}
+
+ public function writeStructEnd() : Void {}
+
+ public function writeFieldBegin(field:TField) : Void {
+ writeByte(field.type);
+ writeI16(field.id);
+ }
+
+ public function writeFieldEnd() : Void {}
+
+ public function writeFieldStop() : Void {
+ writeByte(TType.STOP);
+ }
+
+ public function writeMapBegin(map:TMap) : Void {
+ writeByte(map.keyType);
+ writeByte(map.valueType);
+ writeI32(map.size);
+ }
+
+ public function writeMapEnd() : Void {}
+
+ public function writeListBegin(list:TList) : Void {
+ writeByte(list.elemType);
+ writeI32(list.size);
+ }
+
+ public function writeListEnd() : Void {}
+
+ public function writeSetBegin(set:TSet) : Void {
+ writeByte(set.elemType);
+ writeI32(set.size);
+ }
+
+ public function writeSetEnd() : Void {}
+
+ public function writeBool(b : Bool) : Void {
+ writeByte(b ? 1 : 0);
+ }
+
+
+ public function writeByte(b : Int) : Void {
+ var out = new BytesOutput();
+ out.bigEndian = true;
+ out.writeByte(b);
+ trans_.write(out.getBytes(), 0, 1);
+ }
+
+ public function writeI16(i16 : Int) : Void {
+ var out = new BytesOutput();
+ out.bigEndian = true;
+ out.writeInt16(i16);
+ trans_.write(out.getBytes(), 0, 2);
+ }
+
+ public function writeI32(i32 : Int) : Void {
+ var out = new BytesOutput();
+ out.bigEndian = true;
+ out.writeInt32(i32);
+ trans_.write(out.getBytes(), 0, 4);
+ }
+
+ public function writeI64(i64 : haxe.Int64) : Void {
+ var out = new BytesOutput();
+ out.bigEndian = true;
+ var hi = Int64.getHigh(i64);
+ var lo = Int64.getLow(i64);
+ out.writeInt32(hi);
+ out.writeInt32(lo);
+ trans_.write(out.getBytes(), 0, 8);
+ }
+
+ public function writeDouble(dub:Float) : Void {
+ var out = new BytesOutput();
+ out.bigEndian = true;
+ out.writeDouble(dub);
+ trans_.write(out.getBytes(), 0, 8);
+ }
+
+ public function writeString(str : String) : Void {
+ var out = new BytesOutput();
+ out.bigEndian = true;
+ out.writeString(str);
+ var bytes = out.getBytes();
+ writeI32( bytes.length);
+ trans_.write( bytes, 0, bytes.length);
+ }
+
+ public function writeBinary(bin:Bytes) : Void {
+ writeI32(bin.length);
+ trans_.write(bin, 0, bin.length);
+ }
+
+ /**
+ * Reading methods.
+ */
+
+ public function readMessageBegin():TMessage {
+ var size : Int = readI32();
+ if (size < 0) {
+ var version : Int = size & VERSION_MASK;
+ if (version != VERSION_1) {
+ throw new TProtocolException(TProtocolException.BAD_VERSION, "Bad version in readMessageBegin");
+ }
+ return new TMessage(readString(), size & 0x000000ff, readI32());
+ } else {
+ if (strictRead_) {
+ throw new TProtocolException(TProtocolException.BAD_VERSION, "Missing version in readMessageBegin, old client?");
+ }
+ return new TMessage(readStringBody(size), readByte(), readI32());
+ }
+ }
+
+ public function readMessageEnd() : Void {}
+
+ public function readStructBegin():TStruct {
+ return ANONYMOUS_STRUCT;
+ }
+
+ public function readStructEnd() : Void {}
+
+ public function readFieldBegin() : TField {
+ var type : Int = readByte();
+ var id : Int = 0;
+ if (type != TType.STOP)
+ {
+ id = readI16();
+ }
+ return new TField("", type, id);
+ }
+
+ public function readFieldEnd() : Void {}
+
+ public function readMapBegin() : TMap {
+ return new TMap(readByte(), readByte(), readI32());
+ }
+
+ public function readMapEnd() : Void {}
+
+ public function readListBegin():TList {
+ return new TList(readByte(), readI32());
+ }
+
+ public function readListEnd() : Void {}
+
+ public function readSetBegin() : TSet {
+ return new TSet(readByte(), readI32());
+ }
+
+ public function readSetEnd() : Void {}
+
+ public function readBool() : Bool {
+ return (readByte() == 1);
+ }
+
+
+ public function readByte() : Int {
+ var buffer = new BytesBuffer();
+ var len = trans_.readAll( buffer, 0, 1);
+ var inp = new BytesInput( buffer.getBytes(), 0, 1);
+ inp.bigEndian = true;
+ return inp.readByte();
+ }
+
+ public function readI16() : Int {
+ var buffer = new BytesBuffer();
+ var len = trans_.readAll( buffer, 0, 2);
+ var inp = new BytesInput( buffer.getBytes(), 0, 2);
+ inp.bigEndian = true;
+ return inp.readInt16();
+ }
+
+ public function readI32() : Int {
+ var buffer = new BytesBuffer();
+ var len = trans_.readAll( buffer, 0, 4);
+ var inp = new BytesInput( buffer.getBytes(), 0, 4);
+ inp.bigEndian = true;
+ return inp.readInt32();
+ }
+
+ public function readI64() : haxe.Int64 {
+ var buffer = new BytesBuffer();
+ var len = trans_.readAll( buffer, 0, 8);
+ var inp = new BytesInput( buffer.getBytes(), 0, 8);
+ inp.bigEndian = true;
+ var hi = inp.readInt32();
+ var lo = inp.readInt32();
+ return Int64.make(hi,lo);
+ }
+
+ public function readDouble():Float {
+ var buffer = new BytesBuffer();
+ var len = trans_.readAll( buffer, 0, 8);
+ var inp = new BytesInput( buffer.getBytes(), 0, 8);
+ inp.bigEndian = true;
+ return inp.readDouble();
+ }
+
+ public function readString() : String {
+ return readStringBody( readI32());
+ }
+
+ public function readStringBody(len : Int) : String {
+ if( len > 0) {
+ var buffer = new BytesBuffer();
+ trans_.readAll( buffer, 0, len);
+ var inp = new BytesInput( buffer.getBytes(), 0, len);
+ inp.bigEndian = true;
+ return inp.readString(len);
+ } else {
+ return "";
+ }
+ }
+
+ public function readBinary() : Bytes {
+ var len : Int = readI32();
+ var buffer = new BytesBuffer();
+ trans_.readAll( buffer, 0, len);
+ return buffer.getBytes();
+ }
}
http://git-wip-us.apache.org/repos/asf/thrift/blob/b502832c/lib/haxe/src/org/apache/thrift/protocol/TBinaryProtocolFactory.hx
----------------------------------------------------------------------
diff --git a/lib/haxe/src/org/apache/thrift/protocol/TBinaryProtocolFactory.hx b/lib/haxe/src/org/apache/thrift/protocol/TBinaryProtocolFactory.hx
index 0d7c7c5..f4a9bec 100644
--- a/lib/haxe/src/org/apache/thrift/protocol/TBinaryProtocolFactory.hx
+++ b/lib/haxe/src/org/apache/thrift/protocol/TBinaryProtocolFactory.hx
@@ -26,20 +26,20 @@ import org.apache.thrift.transport.TTransport;
* Binary Protocol Factory
*/
class TBinaryProtocolFactory implements TProtocolFactory {
-
- private var strictRead_ : Bool = false;
- private var strictWrite_ : Bool = true;
-
- public function new( strictRead : Bool = false, strictWrite : Bool = true) {
- strictRead_ = strictRead;
- strictWrite_ = strictWrite;
- }
-
- public function getProtocol( trans : TTransport) : TProtocol {
- return new TBinaryProtocol( trans, strictRead_, strictWrite_);
- }
+
+ private var strictRead_ : Bool = false;
+ private var strictWrite_ : Bool = true;
+
+ public function new( strictRead : Bool = false, strictWrite : Bool = true) {
+ strictRead_ = strictRead;
+ strictWrite_ = strictWrite;
+ }
+
+ public function getProtocol( trans : TTransport) : TProtocol {
+ return new TBinaryProtocol( trans, strictRead_, strictWrite_);
+ }
}
-
\ No newline at end of file
+
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/thrift/blob/b502832c/lib/haxe/src/org/apache/thrift/protocol/TField.hx
----------------------------------------------------------------------
diff --git a/lib/haxe/src/org/apache/thrift/protocol/TField.hx b/lib/haxe/src/org/apache/thrift/protocol/TField.hx
index 20f3fb9..3f5498d 100644
--- a/lib/haxe/src/org/apache/thrift/protocol/TField.hx
+++ b/lib/haxe/src/org/apache/thrift/protocol/TField.hx
@@ -16,28 +16,28 @@
* specific language governing permissions and limitations
* under the License.
*/
-
+
package org.apache.thrift.protocol;
-
+
class TField {
-
+
public var name : String;
public var type : Int;
public var id : Int;
-
+
public function new(n : String = "", t : Int = 0, i : Int = 0) {
name = n;
type = t;
id = i;
}
-
+
public function toString() : String {
return '<TField name:"$name" type:"$type" field-id:"$id">';
}
-
+
public function equals( otherField : TField) : Bool {
- return (type == otherField.type)
+ return (type == otherField.type)
&& (id == otherField.id);
}
-
+
}