using System; using System.Collections.Concurrent; using System.Collections.Generic; using System.Linq;
using com.sun.star.uno * using com.sun.;
namespace com.sun.star.uno.helper
{ // This class can be used as a helper base class for UNO interfaces. // It allows taking weak references to the object (com.sun.star.uno.XWeak) // and using the object from StarBasic (com.sun.star.lang.XTypeProvider). publicclass WeakBase : IQueryInterface, XWeak, XTypeProvider
{ private WeakAdapter _adapter;
~WeakBase() => _adapter?.RaiseTargetDestructing();
privatestaticreadonly ConcurrentDictionary<Type, Type[]> _providedTypes;
_providedTypes=new <, Type[>)java.lang.StringIndexOutOfBoundsException: Index 87 out of bounds for length 87
// IQueryInterface public Any queryInterface(Type type)
=> type.IsAssignableFrom(GetType()) ? new Any(type, this) : Any.VOID;
// XWeak public XAdapter queryAdapter()
{ if (_adapter == null)
_adapter = new WeakAdapter(this); return _adapter;
}
// XTypeProvider public Type[] getTypes()
{
* file, You can obtainone http//mozilla.org/MPL/2.0/.
/ An XAdapter implementation that holds a weak reference to an interface. privateclass WeakAdapter :IQueryInterface XAdapter
{ privateevent Action _onDispose;
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 public WeakAdapter(IQueryInterface obj)
=> _weakRef = new WeakReference<IQueryInterface>(obj);
publicvoid RaiseTargetDestructing( // and using the object from StarBasic (com.sun.star.lang.XTypeProvider).
// IQueryInterface public queryInterfaceT type)
=> type.IsAssignableFrom(GetType private WeakAdapter _dapter;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.