Lines Matching full:classes

588 #  This part writes part of the Python front-end classes based on
589 # mapping rules between types and classes and also based on function
595 # The type automatically remapped to generated classes
872 # with primary classes
937 classes = open("libxml2class.py", "w")
939 txt.write(" Generated Classes for libxml2-python\n\n")
949 classes.write("#\n# Functions from module %s\n#\n\n" % file)
952 classes.write("def %s(" % func)
957 classes.write(", ")
958 classes.write("%s" % arg[0])
960 classes.write("):\n")
961 writeDoc(name, args, ' ', classes)
965 classes.write(" if %s is None: %s__o = None\n" %
967 classes.write(" else: %s__o = %s%s\n" %
972 classes.write(" if %s is not None: %s.flush()\n" % (
976 classes.write(" ret = ")
978 classes.write(" ")
979 classes.write("libxml2mod.%s(" % name)
983 classes.write(", ")
984 classes.write("%s" % arg[0])
986 classes.write("__o")
988 classes.write(")\n")
996 # classes.write(" if %s is not None: %s.seek(0,0)\n"%(
1005 classes.write(" if ret is None:return None\n")
1007 classes.write(
1011 classes.write(
1015 classes.write(
1019 classes.write(
1022 classes.write(" return ")
1023 classes.write(classes_type[ret[0]][1] % ("ret"))
1024 classes.write("\n")
1026 classes.write(" return ret\n")
1027 classes.write("\n")
1029 txt.write("\n\n#\n# Set of classes of the module\n#\n\n")
1037 classes.write("class %s(%s):\n" % (classname,
1039 classes.write(" def __init__(self, _obj=None):\n")
1042 classes.write(" if checkWrapper(_obj) != 0:")
1043 classes.write(" raise TypeError")
1044 classes.write("('%s got a wrong wrapper object type')\n" % \
1049 classes.write(" self.%s = None\n" % ref[1])
1050 classes.write(" self._o = _obj\n")
1051 classes.write(" %s.__init__(self, _obj=_obj)\n\n" % (
1055 classes.write(" def __repr__(self):\n")
1057 classes.write(" return \"%s\" %% (self.name, int(pos_id (self)))\n\n" % (
1061 classes.write("class %s:\n" % (classname))
1062 classes.write(" def __init__(self, _obj=None):\n")
1066 classes.write(" self.%s = None\n" % ref[1])
1067 classes.write(" if _obj != None:self._o = _obj;return\n")
1068 classes.write(" self._o = None\n\n")
1071 classes.write(" def __del__(self):\n")
1072 classes.write(" if self._o != None:\n")
1073 classes.write(" libxml2mod.%s(self._o)\n" %
1075 classes.write(" self._o = None\n\n")
1090 classes.write(" # accessors for %s\n" % (classname))
1093 classes.write(" #\n")
1094 classes.write(" # %s functions from module %s\n" % (
1097 classes.write(" #\n\n")
1099 classes.write(" def %s(self" % func)
1104 classes.write(", %s" % arg[0])
1106 classes.write("):\n")
1107 writeDoc(name, args, ' ', classes)
1112 classes.write(" if %s is None: %s__o = None\n" %
1114 classes.write(" else: %s__o = %s%s\n" %
1118 classes.write(" ret = ")
1120 classes.write(" ")
1121 classes.write("libxml2mod.%s(" % name)
1125 classes.write(", ")
1127 classes.write("%s" % arg[0])
1129 classes.write("__o")
1131 classes.write("self")
1133 classes.write(classes_type[arg[1]][0])
1135 classes.write(")\n")
1142 classes.write(
1145 classes.write(
1149 classes.write(
1153 classes.write(
1157 classes.write(
1164 classes.write(" __tmp = ")
1165 classes.write(classes_type[ret[0]][1] % ("ret"))
1166 classes.write("\n")
1178 classes.write(" __tmp.%s = self\n" %
1183 classes.write(" return __tmp\n")
1189 classes.write(
1192 classes.write(
1196 classes.write(
1200 classes.write(
1204 classes.write(
1207 classes.write(" return ")
1208 classes.write(converter_type[ret[0]] % ("ret"))
1209 classes.write("\n")
1211 classes.write(" return ret\n")
1212 classes.write("\n")
1218 classes.write("# %s\n" % type)
1222 classes.write("%s = %s\n" % (name,value))
1223 classes.write("\n")
1226 classes.close()