2024 String String Boolean UnsignedInt Double Float Int Long Short UnsignedShort UnsignedLong UnsignedInt Octet IUnknown ( self.mgr, ) def (self): req=_RequestMsg() req._this=self.handle val=self.mgr.getPort()._(req) return def (self, value): req=_RequestMsg() req._this=self.handle if type(value) in [int, bool, basestring, str, tuple, list]: req._ = value else: req._ = value.handle self.mgr.getPort()._(req) class : def __init__(self, mgr, array): self.array = array self.mgr = mgr def __next(self): return self.array.__next() def __size(self): return self.array._array.__size() def __len__(self): return self.array._array.__len__() def __getitem__(self, index): return (self.mgr, self.array._array[index]) class (): def __init__(self, mgr, handle, isarray = False): self.mgr = mgr if handle is None: raise Exception("bad handle: "+str(handle)) self.handle = handle self.isarray = isarray if self.isarray: for strHnd in handle: mgr.register(strHnd) else: mgr.register(self.handle) def __del__(self): self.releaseRemote() def releaseRemote(self): try: if self.handle is not None: if self.isarray: for strHnd in self.handle: self.mgr.unregister(strHnd) else: self.mgr.unregister(self.handle) self.handle = None; except: pass def __next(self): if self.isarray: return self.handle.__next() raise TypeError("iteration over non-sequence") def __size(self): if self.isarray: return self.handle.__size() raise TypeError("iteration over non-sequence") def __len__(self): if self.isarray: return self.handle.__len__() raise TypeError("iteration over non-sequence") def __getitem__(self, index): if self.isarray: return (self.mgr, self.handle[index]) raise TypeError("iteration over non-sequence") def __str__(self): if self.isarray: return str(self.handle) else: return self.handle def isValid(self): return self.handle != None and self.handle != '' def __getattr__(self,name): hndl = ._Attrs_.get(name, None) if hndl != None: if hndl[0] != None: return hndl[0](self) else: raise AttributeError else: return .__getattr__(self, name) def __setattr__(self, name, val): hndl = ._Attrs_.get(name, None) if (hndl != None and hndl[1] != None): hndl[1](self,val) else: self.__dict__[name] = val readonly attribute :: read/write attribute :: _Attrs_={ '':[ , None , ] , } class : def __init__(self, mgr, handle, isarray = False): self.mgr = mgr self.isarray = isarray if isarray: self.handle = handle else: self. = (self.mgr, handle._) pass def (self): return self. def (self): raise Error('setters not supported') def __next(self): if self.isarray: return self.handle.__next() raise TypeError("iteration over non-sequence") def __size(self): if self.isarray: return self.handle.__size() raise TypeError("iteration over non-sequence") def __len__(self): if self.isarray: return self.handle.__len__() raise TypeError("iteration over non-sequence") def __getitem__(self, index): if self.isarray: return (self.mgr, self.handle[index]) raise TypeError("iteration over non-sequence") req=_RequestMsg() req._this=self.handle req._= val=self.mgr.getPort()._(req) return , , def (self , ): _None class : def __init__(self,mgr,handle): self.mgr=mgr if isinstance(handle,basestring): self.handle=._ValueMap[handle] else: self.handle=handle def __eq__(self,other): if isinstance(other,): return self.handle == other.handle if isinstance(other,int): return self.handle == other if isinstance(other,basestring): return str(self) == other return False def __ne__(self,other): if isinstance(other,): return self.handle != other.handle if isinstance(other,int): return self.handle != other if isinstance(other,basestring): return str(self) != other return True def __str__(self): return ._NameMap[self.handle] def __int__(self): return self.handle _NameMap={ :'', } _ValueMap={ '':, } = # Copyright (C) 2008- Oracle and/or its affiliates. # # This file is part of a free software library; you can redistribute # it and/or modify it under the terms of the GNU Lesser General # Public License version 2.1 as published by the Free Software # Foundation and shipped in the "COPYING.LIB" file with this library. # The library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY of any kind. # # Oracle LGPL Disclaimer: For the avoidance of doubt, except that if # any license choice other than GPL or LGPL is available it will # apply instead, Oracle elects to use only the Lesser General Public # License version 2.1 (LGPLv2) at this time for any software where # a choice of LGPL license versions is made available with the # language indicating that LGPLv2 or any later version may be used, # or where a choice of which version of the LGPL is applied is # otherwise unspecified. # # SPDX-License-Identifier: LGPL-2.1-only # # # This file is autogenerated from VirtualBox.xidl, DO NOT EDIT! # # Works only with ZSI 2.0 generated stubs (part of the VirtualBox SDK). from VirtualBox_client import * class ObjectRefManager: def __init__(self, sessionmgr): self.map = {} self.sessionmgr = sessionmgr def register(self, handle): if handle == None: return c = self.map.get(handle,0) c = c + 1 self.map[handle]=c def unregister(self, handle): if handle == None: return c = self.map.get(handle,-1) if c == -1: raise Error('wrong refcount') c = c - 1 if c == 0: try: req=IManagedObjectRef_releaseRequestMsg() req._this=handle self.sessionmgr.getPort().IManagedObjectRef_release(req) except: pass del self.map[handle] else: self.map[handle] = c class String: def __init__(self, mgr, handle, isarray = False): self.handle = handle self.mgr = mgr self.isarray = isarray def __next(self): if self.isarray: return self.handle.__next() raise TypeError("iteration over non-sequence") def __size(self): if self.isarray: return self.handle.__size() raise TypeError("iteration over non-sequence") def __len__(self): if self.isarray: return self.handle.__len__() raise TypeError("iteration over non-sequence") def __getitem__(self, index): if self.isarray: return String(self.mgr, self.handle[index]) raise TypeError("iteration over non-sequence") def __str__(self): return str(self.handle) def __eq__(self,other): if self.isarray: return isinstance(other,String) and self.handle == other.handle if isinstance(other,String): return self.handle == other.handle if isinstance(other,basestring): return self.handle == other return False def __ne__(self,other): if self.isarray: return not isinstance(other,String) or self.handle != other.handle if isinstance(other,String): return self.handle != other.handle if isinstance(other,basestring): return self.handle != other return True def __add__(self,other): return str(self.handle)+str(other) class Boolean: def __init__(self, mgr, handle, isarray = False): self.handle = handle if self.handle == "false": self.handle = None self.mgr = mgr self.isarray = isarray def __str__(self): if self.handle: return "true" else: return "false" def __eq__(self,other): if isinstance(other,Bool): return self.handle == other.value if isinstance(other,bool): return self.handle == other return False def __ne__(self,other): if isinstance(other,Bool): return self.handle != other.handle if isinstance(other,bool): return self.handle != other return True def __int__(self): if self.handle: return 1 else: return 0 def __long__(self): if self.handle: return 1 else: return 0 def __nonzero__(self): if self.handle: return True else: return False def __next(self): if self.isarray: return self.handle.__next() raise TypeError("iteration over non-sequence") def __size(self): if self.isarray: return self.handle.__size() raise TypeError("iteration over non-sequence") def __len__(self): if self.isarray: return self.handle.__len__() raise TypeError("iteration over non-sequence") def __getitem__(self, index): if self.isarray: return Boolean(self.mgr, self.handle[index]) raise TypeError("iteration over non-sequence") class Number: def __init__(self, mgr, handle, isarray = False): self.handle = handle self.mgr = mgr self.isarray = isarray def __next(self): if self.isarray: return self.handle.__next() raise TypeError("iteration over non-sequence") def __size(self): if self.isarray: return self.handle.__size() raise TypeError("iteration over non-sequence") def __len__(self): if self.isarray: return self.handle.__len__() raise TypeError("iteration over non-sequence") def __str__(self): return str(self.handle) def __int__(self): return int(self.handle) def __long__(self): return long(self.handle) def __float__(self): return float(self.handle) def __lt__(self, other): if self.isarray: return NotImplemented else: return self.handle < other def __le__(self, other): if self.isarray: return NotImplemented else: return self.handle <= other def __eq__(self, other): return self.handle == other def __ne__(self, other): return self.handle != other def __gt__(self, other): if self.isarray: return NotImplemented else: return self.handle > other def __ge__(self, other): if self.isarray: return NotImplemented else: return self.handle >= other class Octet: def __init__(self, mgr, handle, isarray = False): self.mgr = mgr self.isarray = isarray if isarray: self.handle = mgr.decodebase64(handle) else: raise TypeError("only octet arrays") def __getitem__(self, index): return self.handle[index] def __str__(self): return str(self.handle) def __len__(self): return self.handle.__len__() class UnsignedInt(Number): def __init__(self, mgr, handle, isarray = False): self.handle = handle self.mgr = mgr self.isarray = isarray def __getitem__(self, index): if self.isarray: return UnsignedInt(self.mgr, self.handle[index]) raise TypeError("iteration over non-sequence") class Int(Number): def __init__(self, mgr, handle, isarray = False): self.handle = handle self.mgr = mgr self.isarray = isarray def __getitem__(self, index): if self.isarray: return Int(self.mgr, self.handle[index]) raise TypeError("iteration over non-sequence") class UnsignedShort(Number): def __init__(self, mgr, handle, isarray = False): self.handle = handle self.mgr = mgr self.isarray = isarray def __getitem__(self, index): if self.isarray: return UnsignedShort(self.mgr, self.handle[index]) raise TypeError("iteration over non-sequence") class Short(Number): def __init__(self, mgr, handle, isarray = False): self.handle = handle self.mgr = mgr self.isarray = isarray def __getitem__(self, index): if self.isarray: return Short(self.mgr, self.handle[index]) raise TypeError("iteration over non-sequence") class UnsignedLong(Number): def __init__(self, mgr, handle, isarray = False): self.handle = handle self.mgr = mgr self.isarray = isarray def __getitem__(self, index): if self.isarray: return UnsignedLong(self.mgr, self.handle[index]) raise TypeError("iteration over non-sequence") class Long(Number): def __init__(self, mgr, handle, isarray = False): self.handle = handle self.mgr = mgr self.isarray = isarray def __getitem__(self, index): if self.isarray: return Long(self.mgr, self.handle[index]) raise TypeError("iteration over non-sequence") class Double(Number): def __init__(self, mgr, handle, isarray = False): self.handle = handle self.mgr = mgr self.isarray = isarray def __getitem__(self, index): if self.isarray: return Double(self.mgr, self.handle[index]) raise TypeError("iteration over non-sequence") class Float(Number): def __init__(self, mgr, handle, isarray = False): self.handle = handle self.mgr = mgr self.isarray = isarray def __getitem__(self, index): if self.isarray: return Float(self.mgr, self.handle[index]) raise TypeError("iteration over non-sequence") class IUnknown: def __init__(self, mgr, handle, isarray = False): self.handle = handle self.mgr = mgr self.isarray = isarray def __nonzero__(self): if self.handle != "": return True else: return False def __next(self): if self.isarray: return self.handle.__next() raise TypeError("iteration over non-sequence") def __size(self): if self.isarray: return self.handle.__size() raise TypeError("iteration over non-sequence") def __len__(self): if self.isarray: return self.handle.__len__() raise TypeError("iteration over non-sequence") def __getitem__(self, index): if self.isarray: return IUnknown(self.mgr, self.handle[index]) raise TypeError("iteration over non-sequence") def __str__(self): return str(self.handle) def __eq__(self, other): return self.handle == other def __ne__(self, other): return self.handle != other def __getattr__(self,attr): if self.__class__.__dict__.get(attr) != None: return self.__class__.__dict__.get(attr) if self.__dict__.get(attr) != None: return self.__dict__.get(attr) raise AttributeError import base64 class IWebsessionManager2(IWebsessionManager, ObjectRefManager): def __init__(self, url): self.url = url self.port = None self.handle = None self.mgr = self ObjectRefManager.__init__(self, self.mgr) def getPort(self): if self.port is None: try: self.port = vboxServiceLocator().getvboxPortType(self.url) except: self.port = vboxServiceLocator().getvboxServicePort(self.url) return self.port def decodebase64(self, str): return base64.decodestring(str) def encodebase64(self, str): return base64.encodestring(str)