1*408a4873SAndrew Rist/************************************************************** 2cdf0e10cSrcweir * 3*408a4873SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*408a4873SAndrew Rist * or more contributor license agreements. See the NOTICE file 5*408a4873SAndrew Rist * distributed with this work for additional information 6*408a4873SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*408a4873SAndrew Rist * to you under the Apache License, Version 2.0 (the 8*408a4873SAndrew Rist * "License"); you may not use this file except in compliance 9*408a4873SAndrew Rist * with the License. You may obtain a copy of the License at 10*408a4873SAndrew Rist * 11*408a4873SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*408a4873SAndrew Rist * 13*408a4873SAndrew Rist * Unless required by applicable law or agreed to in writing, 14*408a4873SAndrew Rist * software distributed under the License is distributed on an 15*408a4873SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*408a4873SAndrew Rist * KIND, either express or implied. See the License for the 17*408a4873SAndrew Rist * specific language governing permissions and limitations 18*408a4873SAndrew Rist * under the License. 19*408a4873SAndrew Rist * 20*408a4873SAndrew Rist *************************************************************/ 21*408a4873SAndrew Rist 22*408a4873SAndrew Rist 23cdf0e10cSrcweir#ifndef __com_sun_star_uno_XInterface_idl__ 24cdf0e10cSrcweir#define __com_sun_star_uno_XInterface_idl__ 25cdf0e10cSrcweir 26cdf0e10cSrcweir//============================================================================= 27cdf0e10cSrcweir 28cdf0e10cSrcweir module com { module sun { module star { module uno { 29cdf0e10cSrcweir 30cdf0e10cSrcweir//============================================================================= 31cdf0e10cSrcweir 32cdf0e10cSrcweir// DocMerge from xml: interface com::sun::star::uno::XInterface 33cdf0e10cSrcweir/** base interface of all UNO interfaces 34cdf0e10cSrcweir 35cdf0e10cSrcweir <p> It provides lifetime control by reference counting and the 36cdf0e10cSrcweir possibility of querying for other 37cdf0e10cSrcweir interfaces of the same logical object. 38cdf0e10cSrcweir 39cdf0e10cSrcweir 40cdf0e10cSrcweir <p> 41cdf0e10cSrcweir "Logical Object" in this case means that the 42cdf0e10cSrcweir interfaces actually can be supported by internal (e.g. aggregated) physical objects.</p> 43cdf0e10cSrcweir 44cdf0e10cSrcweir <p> Deriving from this interface is mandatory for all UNO interfaces. 45cdf0e10cSrcweir <p> Each language binding (Java, C++, StarBasic, Python, ... ) may 46cdf0e10cSrcweir provide a different mapping of this interface, please look into the language 47cdf0e10cSrcweir dependent documention. 48cdf0e10cSrcweir 49cdf0e10cSrcweir <p> The UNO object does not export the state of the reference count (acquire() and 50cdf0e10cSrcweir release() do not have return values). In general, also the UNO object itself 51cdf0e10cSrcweir should not make any assumption on the concrete value of the reference count 52cdf0e10cSrcweir (except on the transition from one to zero ). 53cdf0e10cSrcweir 54cdf0e10cSrcweir */ 55cdf0e10cSrcweirpublished interface XInterface 56cdf0e10cSrcweir{ 57cdf0e10cSrcweir /** queries for a new interface to an existing UNO object. 58cdf0e10cSrcweir <p> 59cdf0e10cSrcweir The queryInterface() method is the entry point to obtain other interfaces which 60cdf0e10cSrcweir are exported by the object. The caller asks the implementation of the object, 61cdf0e10cSrcweir if it supports the interface specified by the type argument. The call may either 62cdf0e10cSrcweir return with a interface reference of the requested type or with a void any. 63cdf0e10cSrcweir 64cdf0e10cSrcweir <p> 65cdf0e10cSrcweir There are certain specifications, a queryInterface() implementation must not violate. 66cdf0e10cSrcweir <p> 67cdf0e10cSrcweir 1) If queryInterface on a specific object has once returned a valid interface reference 68cdf0e10cSrcweir for a given type, it must return a valid reference for any successive queryInterface 69cdf0e10cSrcweir calls on this object for the same type. 70cdf0e10cSrcweir <p> 71cdf0e10cSrcweir 2) If queryInterface on a specific object has once returned a null reference 72cdf0e10cSrcweir for a given type, it must always return a null reference for the same type. 73cdf0e10cSrcweir <p> 74cdf0e10cSrcweir 3) If queryInterface on a reference A returns reference B, queryInterface on 75cdf0e10cSrcweir B for Type A must return interface reference A or calls made on the returned 76cdf0e10cSrcweir reference must be equivalent to calls made on reference A. 77cdf0e10cSrcweir <p> 78cdf0e10cSrcweir 4) If queryInterface on a reference A returns reference B, queryInterface on 79cdf0e10cSrcweir A and B for XInterface must return the same interface reference (object identity). 80cdf0e10cSrcweir 81cdf0e10cSrcweir <p> The reason for the strong specification is, that a Uno Runtime Environment (URE) 82cdf0e10cSrcweir may choose to cache queryInterface() calls. 83cdf0e10cSrcweir <p> As mentioned above, certain language bindings may map this function differently also 84cdf0e10cSrcweir with different specifications, please visit the language dependent specification for it. 85cdf0e10cSrcweir The current C++ binding sticks to the specification state 86cdf0e10cSrcweir <p> 87cdf0e10cSrcweir The rules mentioned above are basically identical to the rules of QueryInterface in MS COM. 88cdf0e10cSrcweir 89cdf0e10cSrcweir @param aType a UNO interface type, for which an object reference shall be obtained. 90cdf0e10cSrcweir @return an interface reference in case the requested interface is supported by the object, 91cdf0e10cSrcweir a void any otherwise. 92cdf0e10cSrcweir */ 93cdf0e10cSrcweir any queryInterface( [in] type aType ); 94cdf0e10cSrcweir 95cdf0e10cSrcweir //------------------------------------------------------------------------- 96cdf0e10cSrcweir /** increases the reference counter by one. 97cdf0e10cSrcweir 98cdf0e10cSrcweir <p>When you have called acquire() on the 99cdf0e10cSrcweir UNO object, it is often said, that you have a reference or a hard reference 100cdf0e10cSrcweir to the object. 101cdf0e10cSrcweir 102cdf0e10cSrcweir <p> 103cdf0e10cSrcweir It is only allowed to invoke a method on an UNO object, when you keep 104cdf0e10cSrcweir a hard reference to it. 105cdf0e10cSrcweir 106cdf0e10cSrcweir <p> Every call to acquire must be followed by a corresponding call to release 107cdf0e10cSrcweir some time later, which may eventually lead to the destruction of the object. 108cdf0e10cSrcweir */ 109cdf0e10cSrcweir [oneway] void acquire(); 110cdf0e10cSrcweir 111cdf0e10cSrcweir //------------------------------------------------------------------------- 112cdf0e10cSrcweir 113cdf0e10cSrcweir // DocMerge from xml: method com::sun::star::uno::XInterface::release 114cdf0e10cSrcweir /** decreases the reference counter by one. 115cdf0e10cSrcweir <p>When the reference counter reaches 0, the object gets deleted.</p> 116cdf0e10cSrcweir <p>Calling release() on the object is often called releasing 117cdf0e10cSrcweir or clearing the reference to an object. 118cdf0e10cSrcweir */ 119cdf0e10cSrcweir [oneway] void release(); 120cdf0e10cSrcweir 121cdf0e10cSrcweir}; 122cdf0e10cSrcweir 123cdf0e10cSrcweir//============================================================================= 124cdf0e10cSrcweir 125cdf0e10cSrcweir}; }; }; }; 126cdf0e10cSrcweir 127cdf0e10cSrcweir/*============================================================================= 128cdf0e10cSrcweir 129cdf0e10cSrcweir=============================================================================*/ 130cdf0e10cSrcweir#endif 131