Ejemplo n.º 1
0
	def generate_arrayclass(self, arrayclass, dirpath, namespace, stringtype):
		walker = JSONArrayClassWalker()

		cppheader = CppHeaderHandler(namespace, stringtype)
		walker.json_handlers.append(cppheader)
		cppbodybuilder = CppBodyBuilder(namespace, stringtype)
		walker.json_handlers.extend(cppbodybuilder.handlers)

		walker.walk(arrayclass)

		cppheader.save_to_dir(dirpath)
		cppbodybuilder.save_to_dir(dirpath)
Ejemplo n.º 2
0
	#print "array_types: ", array_types

	typename, is_multiple = cur_class
	if JSONXSDConstant.is_basic_type(typename) and not is_multiple:
		#single basic/simple type
		exit(0)

	classname = JSONXSDConstant.get_cpp_class_name(typename, is_multiple)
	if options.gentest:
		cpptest = CppTest(classname, options.namespace, options.stringtype)
		cpptest.savefile(os.path.join(options.dstdir, cpptest.filename))

	for typename, is_multiple in array_types:
		classname = JSONXSDConstant.get_cpp_class_name(typename, is_multiple)
		detailCpp = JSONDetailCppClass()
		detailCpp.save_to_dir(classname, options.dstdir, options.namespace, options.stringtype)

	for typename, is_multiple in dep_types:
		walker = JSONXSDWalker(schema)

		cppheader = CppHeaderHandler(options.namespace, options.stringtype)
		walker.json_handlers.append(cppheader)
		cppbodybuilder = CppBodyBuilder(options.namespace, options.stringtype)
		walker.json_handlers.extend(cppbodybuilder.handlers)

		#print "walking " + typename + ", " + str(is_multiple)
		walker.walk(typename, is_multiple)
		cppheader.save_to_dir(options.dstdir)
		cppbodybuilder.save_to_dir(options.dstdir)