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