This file is indexed.

/usr/include/cegui-0.8.4/CEGUI/RefCounted.h is in libcegui-mk2-dev 0.8.4+dfsg-4ubuntu1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
/************************************************************************
    created:    Wed Mar 1 2006
    author:     Paul D Turner <paul@cegui.org.uk>
*************************************************************************/
/***************************************************************************
 *   Copyright (C) 2004 - 2006 Paul D Turner & The CEGUI Development Team
 *
 *   Permission is hereby granted, free of charge, to any person obtaining
 *   a copy of this software and associated documentation files (the
 *   "Software"), to deal in the Software without restriction, including
 *   without limitation the rights to use, copy, modify, merge, publish,
 *   distribute, sublicense, and/or sell copies of the Software, and to
 *   permit persons to whom the Software is furnished to do so, subject to
 *   the following conditions:
 *
 *   The above copyright notice and this permission notice shall be
 *   included in all copies or substantial portions of the Software.
 *
 *   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
 *   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 *   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
 *   IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
 *   OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
 *   ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
 *   OTHER DEALINGS IN THE SOFTWARE.
 ***************************************************************************/
#ifndef _CEGUIRefCounted_h_
#define _CEGUIRefCounted_h_

// Start of CEGUI namespace section
namespace CEGUI
{
/*!
\brief
    Simple, generic, reference counted pointer class.  This is primarily here
    for use by the Events system to track when to delete slot bindings.

\note
    Only safe to use with AllocatedObject<T> derived classes!
*/
template<typename T>
class RefCounted
{
public:
    /*!
    \brief
        Default constructor.
    */
    RefCounted() :
        d_object(0),
        d_count(0)
    {
    }

    /*!
    \brief
        Contruct a RefCounted object that wraps the pointer \a ob.
    */
    RefCounted(T* ob) :
        d_object(ob),
        // use system heap for this! no CEGUI_NEW_PT!
        d_count((ob != 0) ? new unsigned int(1) : 0)
    {
    }

    /*!
    \brief
        Copy constructor
    */
    RefCounted(const RefCounted<T>& other) :
        d_object(other.d_object),
        d_count(other.d_count)
    {
        if (d_count)
            addRef();
    }

    /*!
    \brief
        Destructor.  Only deletes the associated object if no further references
        exist.
    */
    ~RefCounted()
    {
        if (d_object)
            release();
    }

    /*!
    \brief
        Assignment operator.  Previously held object gets its reference count
        reduced, and is deleted if no further references exist.  The newly
        assigned object, taken from \a other, gets its count increased.
    */
    RefCounted<T>& operator=(const RefCounted<T>& other)
    {
        if (*this != other)
        {
            if (d_object)
                release();

            d_object = other.d_object;
            d_count = d_object ? other.d_count : 0;

            if (d_count)
                addRef();
        }

        return *this;
    }

    /*!
    \brief
        Return whether the two RefCounted ptrs are equal
        (point to the same object)
    */
    bool operator==(const RefCounted<T>& other) const
    {
        return d_object == other.d_object;
    }

    /*!
    \brief
        Return whether the two RefCounted ptrs are not equal
        (point to different objects)
    */
    bool operator!=(const RefCounted<T>& other) const
    {
        return d_object != other.d_object;
    }

    /*!
    \brief
        Return the object referred to by the wrapped pointer.
        (beware of null pointers when using this!)
    */
    const T& operator*() const
    {
        return *d_object;
    }

    T& operator*()
    {
        return *d_object;
    }

    /*!
    \brief
        Return the wrapped pointer.
    */
    const T* operator->() const
    {
        return d_object;
    }

    T* operator->()
    {
        return d_object;
    }

    /*!
    \brief
        Return whether the wrapped pointer is valid.  i.e. that it is not null.
    */
    bool isValid() const
    {
        return d_object != 0;
    }

private:
    /*!
    \brief
        Increases the reference count for the wrapped object.
    */
    void addRef()
    {
        ++*d_count;
    }

    /*!
    \brief
        Decreases the reference count for the wrapped object, and if the count
        has reached zero, the object and the shared counter are deleted.
    */
    void release()
    {
        if (!--*d_count)
        {
            // use CEGUI allocators for the object
            CEGUI_DELETE_AO d_object;

            // use system heap for this! no CEGUI_DELETE_PT!
            delete d_count;
            d_object = 0;
            d_count = 0;
        }
    }

    T* d_object;            //! pointer to the object.
    unsigned int* d_count;  //! pointer to the shared counter object.
};

} // End of  CEGUI namespace section

#endif  // end of guard _CEGUIRefCounted_h_