class Fox::FXDict
The dictionary class maintains a fast-access hash table of entities indexed by a character string. It is typically used to map strings to pointers; however, derived classes may allow any type of data to be indexed by strings.
Public Class Methods
Source
SWIGINTERN VALUE
_wrap_new_FXDict(int argc, VALUE *argv, VALUE self) {
FXDict *result = 0 ;
if ((argc < 0) || (argc > 0)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
}
{
result = (FXDict *)new_FXDict();
DATA_PTR(self) = result; FXRbRegisterRubyObj(self, result);
if(rb_block_given_p()){
rb_yield(self);
}
}
return self;
fail:
return Qnil;
}
Source
# File rdoc-sources/FXDict.rb, line 24 def initialize ; end
Construct an empty dictionary.
Public Instance Methods
Source
SWIGINTERN VALUE
_wrap_FXDict_clear(int argc, VALUE *argv, VALUE self) {
FXDict *arg1 = (FXDict *) 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
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_FXDict, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "FXDict *","clear", 1, self ));
}
arg1 = reinterpret_cast< FXDict * >(argp1);
(arg1)->clear();
return Qnil;
fail:
return Qnil;
}
Source
# File lib/fox16/dict.rb, line 19 def each_key pos = first while pos < self.getTotalSize() yield key(pos) pos = self.next(pos) end end
Iterate over the keys in this dictionary.
Source
# File lib/fox16/dict.rb, line 30 def empty? self.size == 0 end
Returns true if this dictionary contains no key-value pairs.
Source
SWIGINTERN VALUE
_wrap_FXDict_first(int argc, VALUE *argv, VALUE self) {
FXDict *arg1 = (FXDict *) 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
FXint 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_FXDict, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "FXDict const *","first", 1, self ));
}
arg1 = reinterpret_cast< FXDict * >(argp1);
result = (FXint)((FXDict const *)arg1)->first();
vresult = SWIG_From_int(static_cast< int >(result));
return vresult;
fail:
return Qnil;
}
Return the first element in FXDict.
Source
SWIGINTERN VALUE
_wrap_FXDict_getTotalSize(int argc, VALUE *argv, VALUE self) {
FXDict *arg1 = (FXDict *) 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
FXint 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_FXDict, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "FXDict const *","size", 1, self ));
}
arg1 = reinterpret_cast< FXDict * >(argp1);
result = (FXint)((FXDict const *)arg1)->size();
vresult = SWIG_From_int(static_cast< int >(result));
return vresult;
fail:
return Qnil;
}
Size or Length of the FXDict.
Source
SWIGINTERN VALUE
_wrap_FXDict_has_keyq___(int argc, VALUE *argv, VALUE self) {
FXDict *arg1 = (FXDict *) 0 ;
FXchar *arg2 = (FXchar *) 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
bool result;
VALUE vresult = Qnil;
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_FXDict, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "FXDict const *","has_key", 1, self ));
}
arg1 = reinterpret_cast< FXDict * >(argp1);
arg2 = NIL_P(argv[0]) ? 0 : StringValuePtr(argv[0]);
result = (bool)FXDict_has_key((FXDict const *)arg1,(char const *)arg2);
vresult = (result ? Qtrue : Qfalse);
return vresult;
fail:
return Qnil;
}
Source
SWIGINTERN VALUE
_wrap_FXDict_key(int argc, VALUE *argv, VALUE self) {
FXDict *arg1 = (FXDict *) 0 ;
FXuint arg2 ;
void *argp1 = 0 ;
int res1 = 0 ;
FXchar *result = 0 ;
VALUE vresult = Qnil;
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_FXDict, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "FXDict const *","key", 1, self ));
}
arg1 = reinterpret_cast< FXDict * >(argp1);
arg2 = NUM2UINT(argv[0]);
result = (FXchar *)((FXDict const *)arg1)->key(arg2);
vresult = SWIG_FromCharPtr((const char *)result);
return vresult;
fail:
return Qnil;
}
Source
# File lib/fox16/dict.rb, line 10 def keys ary = [] each_key { |k| ary << k } ary end
Returns a new array populated with the keys from this dictionary.
Source
SWIGINTERN VALUE
_wrap_FXDict_last(int argc, VALUE *argv, VALUE self) {
FXDict *arg1 = (FXDict *) 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
FXint 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_FXDict, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "FXDict const *","last", 1, self ));
}
arg1 = reinterpret_cast< FXDict * >(argp1);
result = (FXint)((FXDict const *)arg1)->last();
vresult = SWIG_From_int(static_cast< int >(result));
return vresult;
fail:
return Qnil;
}
Return the last element in FXDict.
Source
SWIGINTERN VALUE
_wrap_FXDict_length(int argc, VALUE *argv, VALUE self) {
FXDict *arg1 = (FXDict *) 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
FXint 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_FXDict, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "FXDict const *","no", 1, self ));
}
arg1 = reinterpret_cast< FXDict * >(argp1);
result = (FXint)((FXDict const *)arg1)->no();
vresult = SWIG_From_int(static_cast< int >(result));
return vresult;
fail:
return Qnil;
}
Total number of entries in the table [Integer]
Also aliased as: size
Source
SWIGINTERN VALUE
_wrap_FXDict_load(int argc, VALUE *argv, VALUE self) {
FXDict *arg1 = (FXDict *) 0 ;
FXStream *arg2 = 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
void *argp2 = 0 ;
int res2 = 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_FXDict, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "FXDict *","load", 1, self ));
}
arg1 = reinterpret_cast< FXDict * >(argp1);
res2 = SWIG_ConvertPtr(argv[0], &argp2, SWIGTYPE_p_FXStream, 0 );
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "FXStream &","load", 2, argv[0] ));
}
if (!argp2) {
SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "FXStream &","load", 2, argv[0]));
}
arg2 = reinterpret_cast< FXStream * >(argp2);
FXDict_load(arg1,*arg2);
return Qnil;
fail:
return Qnil;
}
Source
SWIGINTERN VALUE
_wrap_FXDict_mark(int argc, VALUE *argv, VALUE self) {
FXDict *arg1 = (FXDict *) 0 ;
FXuint arg2 ;
void *argp1 = 0 ;
int res1 = 0 ;
bool result;
VALUE vresult = Qnil;
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_FXDict, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "FXDict const *","mark", 1, self ));
}
arg1 = reinterpret_cast< FXDict * >(argp1);
arg2 = NUM2UINT(argv[0]);
result = (bool)((FXDict const *)arg1)->mark(arg2);
vresult = SWIG_From_bool(static_cast< bool >(result));
return vresult;
fail:
return Qnil;
}
Source
# File rdoc-sources/FXDict.rb, line 34 def marked?(pos) ; end
Return mark flag of entry at position pos.
Source
SWIGINTERN VALUE
_wrap_FXDict_next(int argc, VALUE *argv, VALUE self) {
FXDict *arg1 = (FXDict *) 0 ;
FXint arg2 ;
void *argp1 = 0 ;
int res1 = 0 ;
FXint result;
VALUE vresult = Qnil;
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_FXDict, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "FXDict const *","next", 1, self ));
}
arg1 = reinterpret_cast< FXDict * >(argp1);
arg2 = NUM2INT(argv[0]);
result = (FXint)((FXDict const *)arg1)->next(arg2);
vresult = SWIG_From_int(static_cast< int >(result));
return vresult;
fail:
return Qnil;
}
Source
SWIGINTERN VALUE
_wrap_FXDict_prev(int argc, VALUE *argv, VALUE self) {
FXDict *arg1 = (FXDict *) 0 ;
FXint arg2 ;
void *argp1 = 0 ;
int res1 = 0 ;
FXint result;
VALUE vresult = Qnil;
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_FXDict, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "FXDict const *","prev", 1, self ));
}
arg1 = reinterpret_cast< FXDict * >(argp1);
arg2 = NUM2INT(argv[0]);
result = (FXint)((FXDict const *)arg1)->prev(arg2);
vresult = SWIG_From_int(static_cast< int >(result));
return vresult;
fail:
return Qnil;
}
Source
SWIGINTERN VALUE
_wrap_FXDict_remove(int argc, VALUE *argv, VALUE self) {
FXDict *arg1 = (FXDict *) 0 ;
FXchar *arg2 = (FXchar *) 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
void *result = 0 ;
VALUE vresult = Qnil;
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_FXDict, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "FXDict *","remove", 1, self ));
}
arg1 = reinterpret_cast< FXDict * >(argp1);
arg2 = NIL_P(argv[0]) ? 0 : StringValuePtr(argv[0]);
result = (void *)(arg1)->remove((FXchar const *)arg2);
vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_void, 0 | 0 );
return vresult;
fail:
return Qnil;
}
Source
SWIGINTERN VALUE
_wrap_FXDict_save(int argc, VALUE *argv, VALUE self) {
FXDict *arg1 = (FXDict *) 0 ;
FXStream *arg2 = 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
void *argp2 = 0 ;
int res2 = 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_FXDict, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "FXDict const *","save", 1, self ));
}
arg1 = reinterpret_cast< FXDict * >(argp1);
res2 = SWIG_ConvertPtr(argv[0], &argp2, SWIGTYPE_p_FXStream, 0 );
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "FXStream &","save", 2, argv[0] ));
}
if (!argp2) {
SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "FXStream &","save", 2, argv[0]));
}
arg2 = reinterpret_cast< FXStream * >(argp2);
FXDict_save((FXDict const *)arg1,*arg2);
return Qnil;
fail:
return Qnil;
}
Source
SWIGINTERN VALUE
_wrap_FXDict_setTotalSize(int argc, VALUE *argv, VALUE self) {
FXDict *arg1 = (FXDict *) 0 ;
FXint arg2 ;
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_FXDict, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "FXDict *","size", 1, self ));
}
arg1 = reinterpret_cast< FXDict * >(argp1);
arg2 = NUM2INT(argv[0]);
(arg1)->size(arg2);
return Qnil;
fail:
return Qnil;
}
Size or Length of the FXDict.