Prev | Current Page 383 | Next

L. McColl-Sylvester and F. Ponticelli

"Professional haXe and Neko"

Don ??™ t
panic, though, as this is easily rectified. You simply provide the functionality of the getCallStack()
method to the class constructor. This way, the list of functions provided by the callStack() function
can be stored in a string member variable and returned in the getCallStack() method call:
public function new( msg : String, ?info : haxe.PosInfos )
{
__description = msg;
// string member variable to store callStack data
__calls = ???Call stack available in debug mode only.???;
#if debug
var cs = haxe.Stack.callStack();
__calls = haxe.Stack.toString( cs );
#end
__infos = info;
}
public function getCallStack() : String
{
return StringTools.rpad( ???CallStackTrace\n???, ???=???, 26 ) + ???\n??? + __calls;
}
Providing a Generic Output Function
Every good object class deserves a toString() method. This way, should the developer wish to simply
dump every bit of information possible in an easy to read format, he or she doesn ??™ t have to parse the
information. Thankfully, this should be easy to provide for this class, as every other member method
outputs a string value.


Pages:
371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395