mirror of
https://github.com/valitydev/thrift.git
synced 2024-11-06 10:25:18 +00:00
THRIFT-5593 Implement uuid for Haxe
Client: hx Patch: Jens Geyer Relies on https://github.com/flashultra/uuid/issues/4 being fixed, thus may require using the most recent uuid package from Github instead of the Haxelib package.
This commit is contained in:
parent
4a147ad9db
commit
18564d29cf
@ -544,6 +544,9 @@ void t_haxe_generator::render_const_value(std::ostream& out,
|
||||
case t_base_type::TYPE_STRING:
|
||||
out << '"' << get_escaped_string(value) << '"';
|
||||
break;
|
||||
case t_base_type::TYPE_UUID:
|
||||
out << '"' << get_escaped_string(value) << '"';
|
||||
break;
|
||||
case t_base_type::TYPE_BOOL:
|
||||
out << ((value->get_integer() > 0) ? "true" : "false");
|
||||
break;
|
||||
@ -1443,6 +1446,9 @@ std::string t_haxe_generator::get_haxe_type_string(t_type* type) {
|
||||
case t_base_type::TYPE_STRING:
|
||||
return "TType.STRING";
|
||||
break;
|
||||
case t_base_type::TYPE_UUID:
|
||||
return "TType.UUID";
|
||||
break;
|
||||
case t_base_type::TYPE_BOOL:
|
||||
return "TType.BOOL";
|
||||
break;
|
||||
@ -2222,6 +2228,9 @@ void t_haxe_generator::generate_deserialize_field(ostream& out, t_field* tfield,
|
||||
out << "readString();";
|
||||
}
|
||||
break;
|
||||
case t_base_type::TYPE_UUID:
|
||||
out << "readUuid();";
|
||||
break;
|
||||
case t_base_type::TYPE_BOOL:
|
||||
out << "readBool();";
|
||||
break;
|
||||
@ -2406,6 +2415,9 @@ void t_haxe_generator::generate_serialize_field(ostream& out, t_field* tfield, s
|
||||
out << "writeString(" << name << ");";
|
||||
}
|
||||
break;
|
||||
case t_base_type::TYPE_UUID:
|
||||
out << "writeUuid(" << name << ");";
|
||||
break;
|
||||
case t_base_type::TYPE_BOOL:
|
||||
out << "writeBool(" << name << ");";
|
||||
break;
|
||||
@ -2651,6 +2663,8 @@ string t_haxe_generator::base_type_name(t_base_type* type, bool in_container) {
|
||||
} else {
|
||||
return "String";
|
||||
}
|
||||
case t_base_type::TYPE_UUID:
|
||||
return "String";
|
||||
case t_base_type::TYPE_BOOL:
|
||||
return "Bool";
|
||||
case t_base_type::TYPE_I8:
|
||||
@ -2686,6 +2700,9 @@ string t_haxe_generator::declare_field(t_field* tfield, bool init) {
|
||||
case t_base_type::TYPE_STRING:
|
||||
result += " = null";
|
||||
break;
|
||||
case t_base_type::TYPE_UUID:
|
||||
result += " = uuid.Uuid.NIL";
|
||||
break;
|
||||
case t_base_type::TYPE_BOOL:
|
||||
result += " = false";
|
||||
break;
|
||||
@ -2795,6 +2812,8 @@ string t_haxe_generator::type_to_enum(t_type* type) {
|
||||
throw "NO T_VOID CONSTRUCT";
|
||||
case t_base_type::TYPE_STRING:
|
||||
return "TType.STRING";
|
||||
case t_base_type::TYPE_UUID:
|
||||
return "TType.UUID";
|
||||
case t_base_type::TYPE_BOOL:
|
||||
return "TType.BOOL";
|
||||
case t_base_type::TYPE_I8:
|
||||
|
@ -14,7 +14,8 @@
|
||||
"releasenote": "Licensed under Apache License, Version 2.0. The Apache Thrift compiler needs to be installed separately.",
|
||||
"contributors": ["ApacheThrift"],
|
||||
"dependencies": {
|
||||
"crypto": ""
|
||||
"crypto": "",
|
||||
"uuid": ""
|
||||
},
|
||||
"classPath": "src"
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ import haxe.ds.IntMap;
|
||||
// Int64Map allows mapping of Int64 keys to arbitrary values.
|
||||
// ObjectMap<> cannot be used, since we want to compare by value, not address
|
||||
|
||||
class Int64Map<T> implements IMap< Int64, T> {
|
||||
class Int64Map<T> implements haxe.Constraints.IMap< Int64, T> {
|
||||
|
||||
private var SubMaps : IntMap< IntMap< T>>; // Hi -> Lo -> Value
|
||||
|
||||
@ -141,7 +141,7 @@ class Int64Map<T> implements IMap< Int64, T> {
|
||||
SubMaps.clear();
|
||||
}
|
||||
|
||||
public function copy() : IMap< Int64, T> {
|
||||
public function copy() : haxe.Constraints.IMap< Int64, T> {
|
||||
var retval = new Int64Map<T>();
|
||||
for( key in this.keys())
|
||||
retval.set( key, this.get(key));
|
||||
|
46
lib/haxe/src/org/apache/thrift/helper/UuidHelper.hx
Normal file
46
lib/haxe/src/org/apache/thrift/helper/UuidHelper.hx
Normal file
@ -0,0 +1,46 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package org.apache.thrift.helper;
|
||||
|
||||
import haxe.io.Bytes;
|
||||
import uuid.Uuid;
|
||||
|
||||
class UuidHelper {
|
||||
|
||||
public static function CanonicalUuid( uuid : String) : String {
|
||||
uuid = StringTools.replace( uuid, "{", "");
|
||||
uuid = StringTools.replace( uuid, "}", "");
|
||||
uuid = Uuid.stringify( Uuid.parse( uuid));
|
||||
return uuid;
|
||||
}
|
||||
|
||||
#if debug
|
||||
|
||||
public static function UnitTest() : Void
|
||||
{
|
||||
var guid : String = CanonicalUuid("{00112233-4455-6677-8899-AABBCCDDEEFF}");
|
||||
if ( guid.length != 36)
|
||||
throw 'UuidHelper Test: CanonicalUuid() failed';
|
||||
}
|
||||
|
||||
#end
|
||||
|
||||
}
|
||||
|
@ -25,8 +25,11 @@ import haxe.io.BytesOutput;
|
||||
import haxe.io.BytesBuffer;
|
||||
import haxe.Int64;
|
||||
|
||||
import uuid.Uuid;
|
||||
|
||||
import org.apache.thrift.TException;
|
||||
import org.apache.thrift.transport.TTransport;
|
||||
import org.apache.thrift.helper.UuidHelper;
|
||||
|
||||
/**
|
||||
* Binary protocol implementation for thrift.
|
||||
@ -164,6 +167,12 @@ class TBinaryProtocol extends TProtocolImplBase implements TProtocol {
|
||||
Transport.write(bin, 0, bin.length);
|
||||
}
|
||||
|
||||
public function writeUuid(uuid : String) : Void {
|
||||
var bytes : Bytes = Uuid.parse(UuidHelper.CanonicalUuid(uuid));
|
||||
Transport.write(bytes, 0, bytes.length);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Reading methods.
|
||||
*/
|
||||
@ -300,6 +309,13 @@ class TBinaryProtocol extends TProtocolImplBase implements TProtocol {
|
||||
return buffer.getBytes();
|
||||
}
|
||||
|
||||
public function readUuid() : String {
|
||||
var buffer = new BytesBuffer();
|
||||
Transport.readAll( buffer, 0, 16);
|
||||
var bytes : Bytes = buffer.getBytes();
|
||||
return Uuid.stringify( bytes);
|
||||
}
|
||||
|
||||
// Return the minimum number of bytes a type will consume on the wire
|
||||
public override function GetMinSerializedSize(type : TType) : Int
|
||||
{
|
||||
@ -318,6 +334,7 @@ class TBinaryProtocol extends TProtocolImplBase implements TProtocol {
|
||||
case TType.MAP: return 4; // element count
|
||||
case TType.SET: return 4; // element count
|
||||
case TType.LIST: return 4; // element count
|
||||
case TType.UUID: return 16; // uuid bytes
|
||||
default: throw new TProtocolException(TProtocolException.NOT_IMPLEMENTED, "unrecognized type code");
|
||||
}
|
||||
}
|
||||
|
@ -28,11 +28,13 @@ import haxe.ds.GenericStack;
|
||||
import haxe.Int32;
|
||||
import haxe.Int64;
|
||||
|
||||
import uuid.Uuid;
|
||||
|
||||
import org.apache.thrift.TException;
|
||||
import org.apache.thrift.transport.TTransport;
|
||||
import org.apache.thrift.helper.ZigZag;
|
||||
import org.apache.thrift.helper.BitConverter;
|
||||
|
||||
import org.apache.thrift.helper.UuidHelper;
|
||||
|
||||
/**
|
||||
* Compact protocol implementation for thrift.
|
||||
@ -62,7 +64,8 @@ class TCompactProtocol extends TProtocolImplBase implements TProtocol {
|
||||
TType.STRUCT => TCompactTypes.STRUCT,
|
||||
TType.MAP => TCompactTypes.MAP,
|
||||
TType.SET => TCompactTypes.SET,
|
||||
TType.LIST => TCompactTypes.LIST
|
||||
TType.LIST => TCompactTypes.LIST,
|
||||
TType.UUID => TCompactTypes.UUID
|
||||
];
|
||||
|
||||
private static var tcompactTypeToType = [
|
||||
@ -78,7 +81,8 @@ class TCompactProtocol extends TProtocolImplBase implements TProtocol {
|
||||
TCompactTypes.LIST => TType.LIST,
|
||||
TCompactTypes.SET => TType.SET,
|
||||
TCompactTypes.MAP => TType.MAP,
|
||||
TCompactTypes.STRUCT => TType.STRUCT
|
||||
TCompactTypes.STRUCT => TType.STRUCT,
|
||||
TCompactTypes.UUID => TType.UUID
|
||||
];
|
||||
|
||||
|
||||
@ -337,6 +341,10 @@ class TCompactProtocol extends TProtocolImplBase implements TProtocol {
|
||||
Transport.write( bin, 0, bin.length);
|
||||
}
|
||||
|
||||
public function writeUuid(uuid : String) : Void {
|
||||
var bytes : Bytes = Uuid.parse(UuidHelper.CanonicalUuid(uuid));
|
||||
Transport.write(bytes, 0, bytes.length);
|
||||
}
|
||||
|
||||
// These methods are called by structs, but don't actually have any wire
|
||||
// output or purpose.
|
||||
@ -616,6 +624,13 @@ class TCompactProtocol extends TProtocolImplBase implements TProtocol {
|
||||
}
|
||||
|
||||
|
||||
public function readUuid() : String {
|
||||
var buffer = new BytesBuffer();
|
||||
Transport.readAll( buffer, 0, 16);
|
||||
var bytes : Bytes = buffer.getBytes();
|
||||
return Uuid.stringify( bytes);
|
||||
}
|
||||
|
||||
// These methods are here for the struct to call, but don't have any wire
|
||||
// encoding.
|
||||
public function readMessageEnd() : Void { }
|
||||
@ -723,6 +738,7 @@ class TCompactProtocol extends TProtocolImplBase implements TProtocol {
|
||||
case TType.MAP: return 1; // element count
|
||||
case TType.SET: return 1; // element count
|
||||
case TType.LIST: return 1; // element count
|
||||
case TType.UUID: return 16; // uuid bytes
|
||||
default: throw new TProtocolException(TProtocolException.NOT_IMPLEMENTED, "unrecognized type code");
|
||||
}
|
||||
}
|
||||
|
@ -37,5 +37,6 @@ abstract TCompactTypes(Int) from Int to Int {
|
||||
public static inline var SET = 0x0A;
|
||||
public static inline var MAP = 0x0B;
|
||||
public static inline var STRUCT = 0x0C;
|
||||
public static inline var UUID = 0x0D;
|
||||
}
|
||||
|
||||
|
@ -28,6 +28,8 @@ import haxe.ds.GenericStack;
|
||||
import haxe.crypto.Base64;
|
||||
import haxe.Int64;
|
||||
|
||||
import uuid.Uuid;
|
||||
|
||||
import org.apache.thrift.TException;
|
||||
import org.apache.thrift.protocol.TMessage;
|
||||
import org.apache.thrift.protocol.TField;
|
||||
@ -35,6 +37,7 @@ import org.apache.thrift.protocol.TMap;
|
||||
import org.apache.thrift.protocol.TSet;
|
||||
import org.apache.thrift.protocol.TList;
|
||||
import org.apache.thrift.transport.TTransport;
|
||||
import org.apache.thrift.helper.UuidHelper;
|
||||
|
||||
|
||||
|
||||
@ -164,6 +167,10 @@ class TJSONProtocol extends TProtocolImplBase implements TProtocol {
|
||||
WriteJSONBase64(bin);
|
||||
}
|
||||
|
||||
public function writeUuid(uuid : String) : Void {
|
||||
writeString( UuidHelper.CanonicalUuid(uuid));
|
||||
}
|
||||
|
||||
public function readMessageBegin():TMessage {
|
||||
var message : TMessage = new TMessage();
|
||||
ReadJSONArrayStart();
|
||||
@ -289,6 +296,10 @@ class TJSONProtocol extends TProtocolImplBase implements TProtocol {
|
||||
return ReadJSONBase64();
|
||||
}
|
||||
|
||||
public function readUuid() : String {
|
||||
return UuidHelper.CanonicalUuid( readString());
|
||||
}
|
||||
|
||||
// Push a new JSON context onto the stack.
|
||||
private function PushContext(c : JSONBaseContext) : Void {
|
||||
contextStack.add(context);
|
||||
@ -794,6 +805,7 @@ class TJSONProtocol extends TProtocolImplBase implements TProtocol {
|
||||
case TType.MAP: return 2; // empty map
|
||||
case TType.SET: return 2; // empty set
|
||||
case TType.LIST: return 2; // empty list
|
||||
case TType.UUID: return 36; // "E236974D-F0B0-4E05-8F29-0B455D41B1A1"
|
||||
default: throw new TProtocolException(TProtocolException.NOT_IMPLEMENTED, "unrecognized type code");
|
||||
}
|
||||
}
|
||||
@ -892,6 +904,7 @@ class JSONConstants {
|
||||
public static var NAME_MAP = 'map';
|
||||
public static var NAME_LIST = 'lst';
|
||||
public static var NAME_SET = 'set';
|
||||
public static var NAME_UUID = 'uid';
|
||||
|
||||
public static function GetTypeNameForTypeID(typeID : Int) : String {
|
||||
switch (typeID)
|
||||
@ -907,6 +920,7 @@ class JSONConstants {
|
||||
case TType.MAP: return NAME_MAP;
|
||||
case TType.SET: return NAME_SET;
|
||||
case TType.LIST: return NAME_LIST;
|
||||
case TType.UUID: return NAME_UUID;
|
||||
}
|
||||
throw new TProtocolException(TProtocolException.NOT_IMPLEMENTED, "Unrecognized type");
|
||||
}
|
||||
@ -922,7 +936,8 @@ class JSONConstants {
|
||||
NAME_STRUCT => TType.STRUCT,
|
||||
NAME_MAP => TType.MAP,
|
||||
NAME_SET => TType.SET,
|
||||
NAME_LIST => TType.LIST
|
||||
NAME_LIST => TType.LIST,
|
||||
NAME_UUID => TType.UUID
|
||||
];
|
||||
|
||||
public static function GetTypeIDForTypeName(name : String) : Int
|
||||
|
@ -20,7 +20,6 @@
|
||||
package org.apache.thrift.protocol;
|
||||
|
||||
import haxe.io.Bytes;
|
||||
import org.apache.thrift.TException;
|
||||
import org.apache.thrift.transport.TTransport;
|
||||
|
||||
/**
|
||||
@ -54,6 +53,7 @@ interface TProtocol {
|
||||
function writeDouble(dub : Float) : Void;
|
||||
function writeString(str : String) : Void;
|
||||
function writeBinary(bin : Bytes) : Void;
|
||||
function writeUuid(uuid : String) : Void;
|
||||
|
||||
/**
|
||||
* Reading methods.
|
||||
@ -78,6 +78,7 @@ interface TProtocol {
|
||||
function readDouble() : Float;
|
||||
function readString() : String;
|
||||
function readBinary() : Bytes;
|
||||
function readUuid() : String;
|
||||
|
||||
// recursion tracking
|
||||
function IncrementRecursionDepth() : Void;
|
||||
|
@ -34,4 +34,5 @@ abstract TType(Int) from Int to Int {
|
||||
public static inline var MAP : Int = 13;
|
||||
public static inline var SET : Int = 14;
|
||||
public static inline var LIST : Int = 15;
|
||||
public static inline var UUID : Int = 16;
|
||||
}
|
||||
|
@ -36,11 +36,11 @@
|
||||
#To produce 64 bit binaries the file should define the HXCPP_M64 compile variable:
|
||||
#-D HXCPP_M64
|
||||
|
||||
# libs
|
||||
-lib uuid
|
||||
|
||||
#Add debug information
|
||||
-debug
|
||||
|
||||
#dead code elimination : remove unused code
|
||||
#"-dce no" : do not remove unused code
|
||||
#"-dce std" : remove unused code in the std lib (default)
|
||||
#"-dce full" : remove all unused code
|
||||
-dce full
|
@ -33,11 +33,11 @@
|
||||
#CSHARP target
|
||||
-cs bin/Test.exe
|
||||
|
||||
# libs
|
||||
-lib uuid
|
||||
|
||||
#Add debug information
|
||||
-debug
|
||||
|
||||
#dead code elimination : remove unused code
|
||||
#"-dce no" : do not remove unused code
|
||||
#"-dce std" : remove unused code in the std lib (default)
|
||||
#"-dce full" : remove all unused code
|
||||
-dce full
|
@ -33,11 +33,11 @@
|
||||
#Flash target
|
||||
-swf bin/Test.swf
|
||||
|
||||
# libs
|
||||
-lib uuid
|
||||
|
||||
#Add debug information
|
||||
-debug
|
||||
|
||||
#dead code elimination : remove unused code
|
||||
#"-dce no" : do not remove unused code
|
||||
#"-dce std" : remove unused code in the std lib (default)
|
||||
#"-dce full" : remove all unused code
|
||||
-dce full
|
@ -33,11 +33,11 @@
|
||||
#Java target
|
||||
-java bin/Test.jar
|
||||
|
||||
# libs
|
||||
-lib uuid
|
||||
|
||||
#Add debug information
|
||||
-debug
|
||||
|
||||
#dead code elimination : remove unused code
|
||||
#"-dce no" : do not remove unused code
|
||||
#"-dce std" : remove unused code in the std lib (default)
|
||||
#"-dce full" : remove all unused code
|
||||
-dce full
|
@ -39,11 +39,11 @@
|
||||
#you modify your .hx files.
|
||||
-D source-map-content
|
||||
|
||||
# libs
|
||||
-lib uuid
|
||||
|
||||
#Generate source map and add debug information
|
||||
-debug
|
||||
|
||||
#dead code elimination : remove unused code
|
||||
#"-dce no" : do not remove unused code
|
||||
#"-dce std" : remove unused code in the std lib (default)
|
||||
#"-dce full" : remove all unused code
|
||||
-dce full
|
@ -33,11 +33,11 @@
|
||||
#neko target
|
||||
-neko bin/Test.n
|
||||
|
||||
# libs
|
||||
-lib uuid
|
||||
|
||||
#Add debug information
|
||||
-debug
|
||||
|
||||
#dead code elimination : remove unused code
|
||||
#"-dce no" : do not remove unused code
|
||||
#"-dce std" : remove unused code in the std lib (default)
|
||||
#"-dce full" : remove all unused code
|
||||
-dce full
|
@ -34,11 +34,11 @@
|
||||
-php bin/php/
|
||||
#--php-front Main-debug.php
|
||||
|
||||
# libs
|
||||
-lib uuid
|
||||
|
||||
#Add debug information
|
||||
-debug
|
||||
|
||||
#dead code elimination : remove unused code
|
||||
#"-dce no" : do not remove unused code
|
||||
#"-dce std" : remove unused code in the std lib (default)
|
||||
#"-dce full" : remove all unused code
|
||||
-dce full
|
||||
|
@ -33,11 +33,11 @@
|
||||
#Python target
|
||||
-python bin/Test.py
|
||||
|
||||
# libs
|
||||
-lib uuid
|
||||
|
||||
#Add debug information
|
||||
-debug
|
||||
|
||||
#dead code elimination : remove unused code
|
||||
#"-dce no" : do not remove unused code
|
||||
#"-dce std" : remove unused code in the std lib (default)
|
||||
#"-dce full" : remove all unused code
|
||||
-dce full
|
@ -76,9 +76,13 @@ class Main
|
||||
|
||||
switch( tests) {
|
||||
case Normal:
|
||||
#if sys
|
||||
StreamTest.Run(server);
|
||||
#end
|
||||
case Multiplex:
|
||||
#if ! (flash || html5 || js)
|
||||
MultiplexTest.Run(server);
|
||||
#end
|
||||
case Constants:
|
||||
ConstantsTest.Run(server);
|
||||
default:
|
||||
|
@ -19,6 +19,8 @@
|
||||
|
||||
package;
|
||||
|
||||
#if ! (flash || html5 || js)
|
||||
|
||||
import haxe.Int64;
|
||||
import haxe.Int32;
|
||||
|
||||
@ -42,7 +44,6 @@ import BenchmarkServiceImpl;
|
||||
import BenchmarkServiceProcessor;
|
||||
import Error;
|
||||
|
||||
|
||||
class BenchmarkServiceHandler implements BenchmarkService_service
|
||||
{
|
||||
public function new() {
|
||||
@ -221,4 +222,5 @@ class MultiplexTest extends TestBase {
|
||||
|
||||
}
|
||||
|
||||
#end
|
||||
|
||||
|
@ -18,6 +18,7 @@
|
||||
*/
|
||||
|
||||
package;
|
||||
#if sys
|
||||
|
||||
import haxe.Int64;
|
||||
import sys.FileSystem;
|
||||
@ -95,3 +96,4 @@ class StreamTest extends TestBase {
|
||||
}
|
||||
|
||||
|
||||
#end
|
||||
|
@ -8,9 +8,9 @@
|
||||
<movie fps="30" />
|
||||
<movie width="800" />
|
||||
<movie height="600" />
|
||||
<movie version="1" />
|
||||
<movie version="0" />
|
||||
<movie minorVersion="0" />
|
||||
<movie platform="C++" />
|
||||
<movie platform="C#" />
|
||||
<movie background="#FFFFFF" />
|
||||
</output>
|
||||
<!-- Other classes to be compiled into your SWF -->
|
||||
@ -30,7 +30,7 @@
|
||||
</build>
|
||||
<!-- haxelib libraries -->
|
||||
<haxelib>
|
||||
<!-- example: <library name="..." /> -->
|
||||
<library name="uuid" />
|
||||
</haxelib>
|
||||
<!-- Class files to compile (other referenced classes will automatically be included) -->
|
||||
<compileTargets>
|
||||
|
@ -31,11 +31,11 @@
|
||||
#To produce 64 bit binaries the file should define the HXCPP_M64 compile variable:
|
||||
#-D HXCPP_M64
|
||||
|
||||
# libs
|
||||
-lib uuid
|
||||
|
||||
#Add debug information
|
||||
-debug
|
||||
|
||||
#dead code elimination : remove unused code
|
||||
#"-dce no" : do not remove unused code
|
||||
#"-dce std" : remove unused code in the std lib (default)
|
||||
#"-dce full" : remove all unused code
|
||||
-dce full
|
@ -26,13 +26,13 @@
|
||||
-main Main
|
||||
|
||||
#CSHARP target
|
||||
-cs bin/Tutorial.exe
|
||||
-cs bin/ThriftTest.exe
|
||||
|
||||
# libs
|
||||
-lib uuid
|
||||
|
||||
#Add debug information
|
||||
-debug
|
||||
|
||||
#dead code elimination : remove unused code
|
||||
#"-dce no" : do not remove unused code
|
||||
#"-dce std" : remove unused code in the std lib (default)
|
||||
#"-dce full" : remove all unused code
|
||||
-dce full
|
@ -26,7 +26,10 @@
|
||||
-main Main
|
||||
|
||||
#Flash target
|
||||
-swf bin/Tutorial.swf
|
||||
-swf bin/ThriftTest.swf
|
||||
|
||||
# libs
|
||||
-lib uuid
|
||||
|
||||
#Add debug information
|
||||
-debug
|
||||
@ -35,7 +38,4 @@
|
||||
# --macro allowPackage("sys")
|
||||
|
||||
#dead code elimination : remove unused code
|
||||
#"-dce no" : do not remove unused code
|
||||
#"-dce std" : remove unused code in the std lib (default)
|
||||
#"-dce full" : remove all unused code
|
||||
-dce full
|
@ -26,13 +26,13 @@
|
||||
-main Main
|
||||
|
||||
#Java target
|
||||
-java bin/Tutorial.jar
|
||||
-java bin/ThriftTest.jar
|
||||
|
||||
# libs
|
||||
-lib uuid
|
||||
|
||||
#Add debug information
|
||||
-debug
|
||||
|
||||
#dead code elimination : remove unused code
|
||||
#"-dce no" : do not remove unused code
|
||||
#"-dce std" : remove unused code in the std lib (default)
|
||||
#"-dce full" : remove all unused code
|
||||
-dce full
|
@ -26,7 +26,7 @@
|
||||
-main Main
|
||||
|
||||
#JavaScript target
|
||||
-js bin/Tutorial.js
|
||||
-js bin/ThriftTest.js
|
||||
|
||||
#You can use -D source-map-content (requires Haxe 3.1+) to have the .hx
|
||||
#files directly embedded into the map file, this way you only have to
|
||||
@ -34,11 +34,11 @@
|
||||
#you modify your .hx files.
|
||||
-D source-map-content
|
||||
|
||||
# libs
|
||||
-lib uuid
|
||||
|
||||
#Generate source map and add debug information
|
||||
-debug
|
||||
|
||||
#dead code elimination : remove unused code
|
||||
#"-dce no" : do not remove unused code
|
||||
#"-dce std" : remove unused code in the std lib (default)
|
||||
#"-dce full" : remove all unused code
|
||||
-dce full
|
@ -26,13 +26,13 @@
|
||||
-main Main
|
||||
|
||||
#neko target
|
||||
-neko bin/Tutorial.n
|
||||
-neko bin/ThriftTest.n
|
||||
|
||||
# libs
|
||||
-lib uuid
|
||||
|
||||
#Add debug information
|
||||
-debug
|
||||
|
||||
#dead code elimination : remove unused code
|
||||
#"-dce no" : do not remove unused code
|
||||
#"-dce std" : remove unused code in the std lib (default)
|
||||
#"-dce full" : remove all unused code
|
||||
-dce full
|
@ -39,7 +39,4 @@
|
||||
-debug
|
||||
|
||||
#dead code elimination : remove unused code
|
||||
#"-dce no" : do not remove unused code
|
||||
#"-dce std" : remove unused code in the std lib (default)
|
||||
#"-dce full" : remove all unused code
|
||||
-dce full
|
||||
|
@ -36,7 +36,4 @@
|
||||
-debug
|
||||
|
||||
#dead code elimination : remove unused code
|
||||
#"-dce no" : do not remove unused code
|
||||
#"-dce std" : remove unused code in the std lib (default)
|
||||
#"-dce full" : remove all unused code
|
||||
-dce full
|
||||
|
@ -26,13 +26,13 @@
|
||||
-main Main
|
||||
|
||||
#Python target
|
||||
-python bin/Tutorial.py
|
||||
-python bin/ThriftTest.py
|
||||
|
||||
# libs
|
||||
-lib uuid
|
||||
|
||||
#Add debug information
|
||||
-debug
|
||||
|
||||
#dead code elimination : remove unused code
|
||||
#"-dce no" : do not remove unused code
|
||||
#"-dce std" : remove unused code in the std lib (default)
|
||||
#"-dce full" : remove all unused code
|
||||
-dce full
|
@ -27,6 +27,8 @@ import haxe.ds.IntMap;
|
||||
import haxe.ds.StringMap;
|
||||
import haxe.ds.ObjectMap;
|
||||
|
||||
import uuid.Uuid;
|
||||
|
||||
import org.apache.thrift.*;
|
||||
import org.apache.thrift.helper.*;
|
||||
import org.apache.thrift.protocol.*;
|
||||
@ -366,6 +368,14 @@ class TestClient {
|
||||
rslt.Expect( false, 'ZigZag.UnitTest: $e Test #101');
|
||||
}
|
||||
|
||||
try {
|
||||
UuidHelper.UnitTest();
|
||||
rslt.Expect( true, 'UuidHelper.UnitTest Test #102');
|
||||
}
|
||||
catch( e : Dynamic) {
|
||||
rslt.Expect( false, 'UuidHelper.UnitTest: $e Test #102');
|
||||
}
|
||||
|
||||
#end
|
||||
}
|
||||
|
||||
@ -537,6 +547,19 @@ class TestClient {
|
||||
trace(' = $dub');
|
||||
rslt.Expect(dub == 5.325098235, '$dub == 5.325098235');
|
||||
|
||||
|
||||
var uuidOut : String = UuidHelper.CanonicalUuid("{00112233-4455-6677-8899-AABBCCDDEEFF}");
|
||||
trace('testUuid(${uuidOut}');
|
||||
try {
|
||||
var uuidIn = client.testUuid(uuidOut);
|
||||
trace('testUuid() = ${uuidIn}');
|
||||
rslt.Expect( uuidIn == uuidOut, '${uuidIn} == ${uuidOut}');
|
||||
}
|
||||
catch (e : TApplicationException) {
|
||||
trace('testUuid(${uuidOut}): '+e.errorMsg); // may not be supported by the server
|
||||
}
|
||||
|
||||
|
||||
var binOut = PrepareTestData(true);
|
||||
trace('testBinary('+BytesToHex(binOut)+')');
|
||||
try {
|
||||
|
@ -25,6 +25,7 @@ import org.apache.thrift.transport.*;
|
||||
import org.apache.thrift.server.*;
|
||||
import org.apache.thrift.meta_data.*;
|
||||
import org.apache.thrift.helper.*;
|
||||
import uuid.Uuid;
|
||||
|
||||
import haxe.Int32;
|
||||
import haxe.Int64;
|
||||
@ -146,6 +147,19 @@ class TestServerHandler implements ThriftTest_service {
|
||||
return thing;
|
||||
}
|
||||
|
||||
/**
|
||||
* Prints 'testUuid("%s")'
|
||||
* @param Uuid thing - the uuid to print
|
||||
* @return Uuid - returns the uuid 'thing'
|
||||
*
|
||||
* @param thing
|
||||
*/
|
||||
public function testUuid(thing : String) : String
|
||||
{
|
||||
trace('testUuid($thing)');
|
||||
return thing;
|
||||
}
|
||||
|
||||
/**
|
||||
* Prints 'testStruct("{%s}")' where thing has been formatted
|
||||
* into a string of comma separated values
|
||||
|
@ -31,11 +31,11 @@
|
||||
#To produce 64 bit binaries the file should define the HXCPP_M64 compile variable:
|
||||
#-D HXCPP_M64
|
||||
|
||||
# libs
|
||||
-lib uuid
|
||||
|
||||
#Add debug information
|
||||
-debug
|
||||
|
||||
#dead code elimination : remove unused code
|
||||
#"-dce no" : do not remove unused code
|
||||
#"-dce std" : remove unused code in the std lib (default)
|
||||
#"-dce full" : remove all unused code
|
||||
-dce full
|
@ -28,11 +28,11 @@
|
||||
#CSHARP target
|
||||
-cs bin/Tutorial.exe
|
||||
|
||||
# libs
|
||||
-lib uuid
|
||||
|
||||
#Add debug information
|
||||
-debug
|
||||
|
||||
#dead code elimination : remove unused code
|
||||
#"-dce no" : do not remove unused code
|
||||
#"-dce std" : remove unused code in the std lib (default)
|
||||
#"-dce full" : remove all unused code
|
||||
-dce full
|
@ -28,6 +28,9 @@
|
||||
#Flash target
|
||||
-swf bin/Tutorial.swf
|
||||
|
||||
# libs
|
||||
-lib uuid
|
||||
|
||||
#Add debug information
|
||||
-debug
|
||||
|
||||
@ -35,7 +38,4 @@
|
||||
# --macro allowPackage("sys")
|
||||
|
||||
#dead code elimination : remove unused code
|
||||
#"-dce no" : do not remove unused code
|
||||
#"-dce std" : remove unused code in the std lib (default)
|
||||
#"-dce full" : remove all unused code
|
||||
-dce full
|
@ -28,11 +28,11 @@
|
||||
#Java target
|
||||
-java bin/Tutorial.jar
|
||||
|
||||
# libs
|
||||
-lib uuid
|
||||
|
||||
#Add debug information
|
||||
-debug
|
||||
|
||||
#dead code elimination : remove unused code
|
||||
#"-dce no" : do not remove unused code
|
||||
#"-dce std" : remove unused code in the std lib (default)
|
||||
#"-dce full" : remove all unused code
|
||||
-dce full
|
@ -34,11 +34,11 @@
|
||||
#you modify your .hx files.
|
||||
-D source-map-content
|
||||
|
||||
# libs
|
||||
-lib uuid
|
||||
|
||||
#Generate source map and add debug information
|
||||
-debug
|
||||
|
||||
#dead code elimination : remove unused code
|
||||
#"-dce no" : do not remove unused code
|
||||
#"-dce std" : remove unused code in the std lib (default)
|
||||
#"-dce full" : remove all unused code
|
||||
-dce full
|
@ -28,11 +28,11 @@
|
||||
#neko target
|
||||
-neko bin/Tutorial.n
|
||||
|
||||
# libs
|
||||
-lib uuid
|
||||
|
||||
#Add debug information
|
||||
-debug
|
||||
|
||||
#dead code elimination : remove unused code
|
||||
#"-dce no" : do not remove unused code
|
||||
#"-dce std" : remove unused code in the std lib (default)
|
||||
#"-dce full" : remove all unused code
|
||||
-dce full
|
@ -39,7 +39,4 @@
|
||||
-debug
|
||||
|
||||
#dead code elimination : remove unused code
|
||||
#"-dce no" : do not remove unused code
|
||||
#"-dce std" : remove unused code in the std lib (default)
|
||||
#"-dce full" : remove all unused code
|
||||
-dce full
|
||||
|
@ -29,11 +29,11 @@
|
||||
-php bin/php/
|
||||
-D php-front=Main-debug.php
|
||||
|
||||
# libs
|
||||
-lib uuid
|
||||
|
||||
#Add debug information
|
||||
-debug
|
||||
|
||||
#dead code elimination : remove unused code
|
||||
#"-dce no" : do not remove unused code
|
||||
#"-dce std" : remove unused code in the std lib (default)
|
||||
#"-dce full" : remove all unused code
|
||||
-dce full
|
||||
|
@ -28,11 +28,11 @@
|
||||
#Python target
|
||||
-python bin/Tutorial.py
|
||||
|
||||
# libs
|
||||
-lib uuid
|
||||
|
||||
#Add debug information
|
||||
-debug
|
||||
|
||||
#dead code elimination : remove unused code
|
||||
#"-dce no" : do not remove unused code
|
||||
#"-dce std" : remove unused code in the std lib (default)
|
||||
#"-dce full" : remove all unused code
|
||||
-dce full
|
Loading…
Reference in New Issue
Block a user