def __str__(self, n=None): if self._null: return "(UaStatusCode) : NULL" + ("" if n is None else "\n") else: return "(UaStatusCode): " + ffi.string( lib.UA_StatusCode_name( self._val)).decode("utf-8") + ("" if n is None else "\n")
def __init__(self, p_val: str = "", is_pointer=True, val=None): if type(val) is Void: val = ffi.cast("char[]", val._ptr) p_val = bytes(p_val, "utf-8") if val is None: super().__init__(ffi.new("char[]", p_val), is_pointer) self._p_value = p_val else: super().__init__(val, is_pointer) if self._null: self._p_value = None else: self._p_value = ffi.string(val)
def value(self) -> bytes: if self._null: return "NULL" return ffi.string(ffi.cast(f"char[{self.length._val}]", self.data._ptr), self.length._val)
def value(self) -> str: if self._null: return "NULL" return ffi.string(ffi.cast(f"char[{self.length._val}]", self.data._ptr), self.length._val).decode("utf-8")