class Fox::FXMemoryStream
Public Class Methods
new(*args)
click to toggle source
SWIGINTERN VALUE _wrap_new_FXMemoryStream(int argc, VALUE *argv, VALUE self) { FXObject *arg1 = (FXObject *) 0 ; void *argp1 = 0 ; int res1 = 0 ; FXMemoryStream *result = 0 ; if ((argc < 0) || (argc > 1)) { rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; } if (argc > 0) { res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_FXObject, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "FXObject const *","FXMemoryStream", 1, argv[0] )); } arg1 = reinterpret_cast< FXObject * >(argp1); } { result = (FXMemoryStream *)new_FXMemoryStream((FXObject const *)arg1); DATA_PTR(self) = result; FXRbRegisterRubyObj(self, result); if(rb_block_given_p()){ rb_yield(self); } } return self; fail: return Qnil; }
new(*args, &blk)
click to toggle source
# File lib/fox16/kwargs.rb, line 2646 def initialize(*args, &blk) argument_names = %w{cont} default_params = { :cont => nil } params = {} params = args.pop if args.last.is_a? Hash args.each_with_index { |e, i| params[argument_names[i].intern] = e } params.keys.each { |key| raise ArgumentError, "Unrecognized parameter #{key}" unless default_params.keys.include?(key) } params = default_params.merge(params) old_initialize(params[:cont], &blk) end
Also aliased as: old_initialize
open(save_or_load, data, cont=nil) { |theMemoryStream| ... }
click to toggle source
Construct a new FXMemoryStream object with the specified data flow direction, data and container object. If an optional code block is given, it will be passed this memory stream as an argument, and the memory stream will automatically be closed when the block terminates. If no code block is provided, this method just returns the new memory stream in an opened state.
Raises FXStreamAllocError if some kind of memory allocation failed while initializing the stream.
Parameters:¶ ↑
save_or_load
-
access mode, either
FXStreamSave
orFXStreamLoad
[Integer] data
-
memory buffer used for the stream, or
nil
if the buffer is to be initially empty [String]. cont
-
the container object, or
nil
if there is none [FXObject]
# File lib/fox16/iterators.rb, line 321 def FXMemoryStream.open(save_or_load, data, cont=nil) # :yields: theMemoryStream stream = FXMemoryStream.new(cont) if stream.open(save_or_load, data) if block_given? begin yield stream ensure stream.close end else stream end else # FXFileStream#open returned false, so report error raise FXStreamError.makeStreamError(stream.status) end end
Public Instance Methods
getPosition(*args)
click to toggle source
SWIGINTERN VALUE _wrap_FXMemoryStream_getPosition(int argc, VALUE *argv, VALUE self) { FXMemoryStream *arg1 = (FXMemoryStream *) 0 ; void *argp1 = 0 ; int res1 = 0 ; FXlong result; VALUE vresult = Qnil; if ((argc < 0) || (argc > 0)) { rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; } res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_FXMemoryStream, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "FXMemoryStream const *","position", 1, self )); } arg1 = reinterpret_cast< FXMemoryStream * >(argp1); result = ((FXMemoryStream const *)arg1)->position(); vresult = LONG2NUM(result); return vresult; fail: return Qnil; }
giveBuffer(*args)
click to toggle source
SWIGINTERN VALUE _wrap_FXMemoryStream_giveBuffer(int argc, VALUE *argv, VALUE self) { FXMemoryStream *arg1 = (FXMemoryStream *) 0 ; VALUE arg2 = (VALUE) 0 ; void *argp1 = 0 ; int res1 = 0 ; if ((argc < 1) || (argc > 1)) { rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; } res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_FXMemoryStream, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "FXMemoryStream *","giveBuffer", 1, self )); } arg1 = reinterpret_cast< FXMemoryStream * >(argp1); arg2 = argv[0]; FXMemoryStream_giveBuffer(arg1,arg2); return Qnil; fail: return Qnil; }
open(*args)
click to toggle source
SWIGINTERN VALUE _wrap_FXMemoryStream_open(int argc, VALUE *argv, VALUE self) { FXMemoryStream *arg1 = (FXMemoryStream *) 0 ; FXStreamDirection arg2 ; VALUE arg3 = (VALUE) 0 ; void *argp1 = 0 ; int res1 = 0 ; int val2 ; int ecode2 = 0 ; bool result; VALUE vresult = Qnil; if ((argc < 2) || (argc > 2)) { rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail; } res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_FXMemoryStream, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "FXMemoryStream *","open", 1, self )); } arg1 = reinterpret_cast< FXMemoryStream * >(argp1); ecode2 = SWIG_AsVal_int(argv[0], &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "FXStreamDirection","open", 2, argv[0] )); } arg2 = static_cast< FXStreamDirection >(val2); arg3 = argv[1]; result = (bool)FXMemoryStream_open(arg1,arg2,arg3); vresult = SWIG_From_bool(static_cast< bool >(result)); return vresult; fail: return Qnil; }
takeBuffer(*args)
click to toggle source
SWIGINTERN VALUE _wrap_FXMemoryStream_takeBuffer(int argc, VALUE *argv, VALUE self) { FXMemoryStream *arg1 = (FXMemoryStream *) 0 ; void *argp1 = 0 ; int res1 = 0 ; VALUE result; VALUE vresult = Qnil; if ((argc < 0) || (argc > 0)) { rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; } res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_FXMemoryStream, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "FXMemoryStream *","takeBuffer", 1, self )); } arg1 = reinterpret_cast< FXMemoryStream * >(argp1); result = (VALUE)FXMemoryStream_takeBuffer(arg1); vresult = result; return vresult; fail: return Qnil; }