2 * Licensed under the Apache License, Version 2.0 (the "License");
3 * you may not use this file except in compliance with the License.
4 * You may obtain a copy of the License at
6 * http://www.apache.org/licenses/LICENSE-2.0
8 * Unless required by applicable law or agreed to in writing, software
9 * distributed under the License is distributed on an "AS IS" BASIS,
10 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 * See the License for the specific language governing permissions and
12 * limitations under the License.
18 #include "java/lang/Object.h"
19 #include "java/lang/Class.h"
20 #include "java/util/Enumeration.h"
30 Class *Enumeration::class$ = NULL;
31 jmethodID *Enumeration::mids$ = NULL;
33 jclass Enumeration::initializeClass()
37 jclass cls = env->findClass("java/util/Enumeration");
39 mids$ = new jmethodID[max_mid];
40 mids$[mid_hasMoreElements] = env->getMethodID(cls, "hasMoreElements", "()Z");
41 mids$[mid_nextElement] = env->getMethodID(cls, "nextElement", "()Ljava/lang/Object;");
43 class$ = (Class *) new JObject(cls);
46 return (jclass) class$->this$;
49 jboolean Enumeration::hasMoreElements() const
51 return env->callBooleanMethod(this$, mids$[mid_hasMoreElements]);
54 Object Enumeration::nextElement() const
56 return Object(env->callObjectMethod(this$, mids$[mid_nextElement]));
62 #include "structmember.h"
63 #include "functions.h"
69 static PyObject *t_Enumeration_hasMoreElements(t_Enumeration *self);
70 static PyObject *t_Enumeration_nextElement(t_Enumeration *self);
72 static PyMethodDef t_Enumeration__methods_[] = {
73 DECLARE_METHOD(t_Enumeration, hasMoreElements, METH_NOARGS),
74 DECLARE_METHOD(t_Enumeration, nextElement, METH_NOARGS),
75 { NULL, NULL, 0, NULL }
78 DECLARE_TYPE(Enumeration, t_Enumeration, JObject,
79 java::util::Enumeration, abstract_init, 0, 0, 0, 0, 0);
82 PyObject *t_Enumeration::wrap_Object(const Enumeration& object,
85 PyObject *obj = t_Enumeration::wrap_Object(object);
88 t_Enumeration *self = (t_Enumeration *) obj;
89 self->parameters[0] = T;
94 static PyObject *t_Enumeration_hasMoreElements(t_Enumeration *self)
98 OBJ_CALL(b = self->object.hasMoreElements());
102 static PyObject *t_Enumeration_nextElement(t_Enumeration *self)
104 Object nextElement((jobject) NULL);
106 OBJ_CALL(nextElement = self->object.nextElement());
107 return t_Object::wrap_Object(nextElement);