diff --git a/haxework/core/Const.hx b/haxework/core/Const.hx new file mode 100755 index 0000000..44e33f1 --- /dev/null +++ b/haxework/core/Const.hx @@ -0,0 +1,8 @@ +package haxework.core; + +class Const { + public static var UINT_MAX_VALUE:UInt = untyped __global__["uint"].MAX_VALUE; + public static var UINT_MIN_VALUE:UInt = untyped __global__["uint"].MIN_VALUE; + public static var INT_MAX_VALUE:Int = untyped __global__["int"].MAX_VALUE; + public static var INT_MIN_VALUE:Int = untyped __global__["int"].MIN_VALUE; +} \ No newline at end of file diff --git a/haxework/core/Set.hx b/haxework/core/Set.hx new file mode 100755 index 0000000..4b2f3fd --- /dev/null +++ b/haxework/core/Set.hx @@ -0,0 +1,31 @@ +package haxework.core; + +import haxe.ds.ObjectMap; +import Map.IMap; + +class Set { + + private static var O:Dynamic = {}; + + private var map:ObjectMap; + + public function new() { + map = new ObjectMap(); + } + + public inline function iterator():Iterator { + return map.keys(); + } + + public inline function set(value:T):Void { + map.set(value, O); + } + + public inline function exists(value:T):Bool { + return map.exists(value); + } + + public inline inline function remove(value:T):Bool { + return map.remove(value); + } +} \ No newline at end of file diff --git a/haxework/log/BaseLogger.hx b/haxework/log/BaseLogger.hx index 6dd13ba..37c4ea6 100755 --- a/haxework/log/BaseLogger.hx +++ b/haxework/log/BaseLogger.hx @@ -1,5 +1,6 @@ package haxework.log; +import flash.errors.Error; import haxework.log.ILogger.LogLevel; class BaseLogger implements ILogger { @@ -7,10 +8,18 @@ class BaseLogger implements ILogger { public function new() {} public function log(level:LogLevel, tag:String, message:String, ?error:Dynamic, ?p:haxe.PosInfos):Void { - var s:String = "[" + level + "] " + tag + " - " + message + (error == null ? "" : " {" + Std.string(error) + "}"); + var s:String = "[" + level + "] " + tag + " - " + message + (error == null ? "" : " {" + error2strign(error) + "}"); write(s, p); } + private function error2strign(error:Dynamic):String { + return if (Std.is(error, Error)) { + cast(error, Error).getStackTrace(); + } else { + Std.string(error); + } + } + private function write(text:String, ?p:haxe.PosInfos):Void {} public function d(tag:String, message:String, ?error:Dynamic, ?p:haxe.PosInfos):Void { diff --git a/haxework/net/BaseLoader.hx b/haxework/net/BaseLoader.hx index 166cceb..663463b 100755 --- a/haxework/net/BaseLoader.hx +++ b/haxework/net/BaseLoader.hx @@ -9,6 +9,7 @@ import haxework.net.ILoader.Method; class BaseLoader implements ILoader { public static var urlProcessors(default, null):ArrayString> = new ArrayString>(); + public static function prepareUrl(url:String):String { for (p in urlProcessors) url = p(url); return url; }; public var busy(default, null):Bool; @@ -27,8 +28,7 @@ class BaseLoader implements ILoader { this.data = data; callback = new Callback(); var url:String = this.url; - for (p in urlProcessors) url = p(url); - internalRequest(url); + internalRequest(prepareUrl(url)); return callback; }