예제 #1
0
	def __init__(self, integer):
		# create function prototype
		namespace = integer._namespace
		name = integer.type().name()
		super().__init__(
		    namespace,
		    namespace.get('bool').type(),
		    calligra.method_name(namespace.get(name).name(), '_from_json'),
		)

		self._integer = integer

		# add arguments
		self.add(
		    calligra.declaration(
		        namespace,
		        namespace.get(name),
		        'value',
		        pointer = True,
		    )
		)
		self.add(
		    calligra.declaration(
		        namespace,
		        namespace.get('json_t'),
		        'json',
		        pointer = True,
		    )
		)
예제 #2
0
	def __init__(self, struct):
		# create function prototype
		namespace = struct._namespace
		name = struct.type().name()
		super().__init__(
		    namespace,
		    namespace.get('json_t').type(),
		    calligra.method_name(namespace.get(name).name(), '_to_json'),
		    pointer = True
		)

		self._struct = struct

		# add arguments
		self.add(
		    calligra.declaration(
		        namespace,
		        self._struct,
		        namespace.get(name).name(),
		        pointer = True,
		        const = True,
		    )
		)