This file is indexed.

/usr/include/wx-3.0/wx/xti.h is in wx3.0-headers 3.0.4+dfsg-3.

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
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
/////////////////////////////////////////////////////////////////////////////
// Name:        wx/xti.h
// Purpose:     runtime metadata information (extended class info)
// Author:      Stefan Csomor
// Modified by: Francesco Montorsi
// Created:     27/07/03
// Copyright:   (c) 1997 Julian Smart
//              (c) 2003 Stefan Csomor
// Licence:     wxWindows licence
/////////////////////////////////////////////////////////////////////////////

#ifndef _WX_XTIH__
#define _WX_XTIH__

// We want to support properties, event sources and events sinks through
// explicit declarations, using templates and specialization to make the
// effort as painless as possible.
//
// This means we have the following domains :
//
// - Type Information for categorizing built in types as well as custom types
//   this includes information about enums, their values and names
// - Type safe value storage : a kind of wxVariant, called right now wxAny
//   which will be merged with wxVariant
// - Property Information and Property Accessors providing access to a class'
//   values and exposed event delegates
// - Information about event handlers
// - extended Class Information for accessing all these

// ----------------------------------------------------------------------------
// headers
// ----------------------------------------------------------------------------

#include "wx/defs.h"

#if wxUSE_EXTENDED_RTTI

class WXDLLIMPEXP_FWD_BASE wxAny;
class WXDLLIMPEXP_FWD_BASE wxAnyList;
class WXDLLIMPEXP_FWD_BASE wxObject;
class WXDLLIMPEXP_FWD_BASE wxString;
class WXDLLIMPEXP_FWD_BASE wxClassInfo;
class WXDLLIMPEXP_FWD_BASE wxHashTable;
class WXDLLIMPEXP_FWD_BASE wxObject;
class WXDLLIMPEXP_FWD_BASE wxPluginLibrary;
class WXDLLIMPEXP_FWD_BASE wxHashTable;
class WXDLLIMPEXP_FWD_BASE wxHashTable_Node;

class WXDLLIMPEXP_FWD_BASE wxStringToAnyHashMap;
class WXDLLIMPEXP_FWD_BASE wxPropertyInfoMap;
class WXDLLIMPEXP_FWD_BASE wxPropertyAccessor;
class WXDLLIMPEXP_FWD_BASE wxObjectAllocatorAndCreator;
class WXDLLIMPEXP_FWD_BASE wxObjectAllocator;


#define wx_dynamic_cast(t, x) dynamic_cast<t>(x)

#include "wx/xtitypes.h"
#include "wx/xtihandler.h"

// ----------------------------------------------------------------------------
// wxClassInfo
// ----------------------------------------------------------------------------

class WXDLLIMPEXP_BASE wxObjectFunctor
{
public:
    virtual ~wxObjectFunctor();

    // Invoke the actual event handler:
    virtual void operator()(const wxObject *) = 0;
};

class WXDLLIMPEXP_FWD_BASE wxPropertyInfo;
class WXDLLIMPEXP_FWD_BASE wxHandlerInfo;

typedef wxObject *(*wxObjectConstructorFn)(void);
typedef wxPropertyInfo *(*wxPropertyInfoFn)(void);
typedef wxHandlerInfo *(*wxHandlerInfoFn)(void);
typedef void (*wxVariantToObjectConverter)( const wxAny &data, wxObjectFunctor* fn );
typedef wxObject* (*wxVariantToObjectPtrConverter) ( const wxAny& data);
typedef wxAny (*wxObjectToVariantConverter)( wxObject* );

WXDLLIMPEXP_BASE wxString wxAnyGetAsString( const wxAny& data);
WXDLLIMPEXP_BASE const wxObject* wxAnyGetAsObjectPtr( const wxAny& data);

class WXDLLIMPEXP_BASE wxObjectWriter;
class WXDLLIMPEXP_BASE wxObjectWriterCallback;

typedef bool (*wxObjectStreamingCallback) ( const wxObject *, wxObjectWriter *, \
                                            wxObjectWriterCallback *, const wxStringToAnyHashMap & );



class WXDLLIMPEXP_BASE wxClassInfo
{
    friend class WXDLLIMPEXP_BASE wxPropertyInfo;
    friend class /* WXDLLIMPEXP_BASE */ wxHandlerInfo;
    friend wxObject *wxCreateDynamicObject(const wxString& name);

public:
    wxClassInfo(const wxClassInfo **_Parents,
                const wxChar *_UnitName,
                const wxChar *_ClassName,
                int size,
                wxObjectConstructorFn ctor,
                wxPropertyInfoFn _Props,
                wxHandlerInfoFn _Handlers,
                wxObjectAllocatorAndCreator* _Constructor,
                const wxChar ** _ConstructorProperties,
                const int _ConstructorPropertiesCount,
                wxVariantToObjectPtrConverter _PtrConverter1,
                wxVariantToObjectConverter _Converter2,
                wxObjectToVariantConverter _Converter3,
                wxObjectStreamingCallback _streamingCallback = NULL) :
            m_className(_ClassName),
            m_objectSize(size),
            m_objectConstructor(ctor),
            m_next(sm_first),
            m_firstPropertyFn(_Props),
            m_firstHandlerFn(_Handlers),
            m_firstProperty(NULL),
            m_firstHandler(NULL),
            m_firstInited(false),
            m_parents(_Parents),
            m_unitName(_UnitName),
            m_constructor(_Constructor),
            m_constructorProperties(_ConstructorProperties),
            m_constructorPropertiesCount(_ConstructorPropertiesCount),
            m_variantOfPtrToObjectConverter(_PtrConverter1),
            m_variantToObjectConverter(_Converter2),
            m_objectToVariantConverter(_Converter3),
            m_streamingCallback(_streamingCallback)
    {
        sm_first = this;
        Register();
    }

    wxClassInfo(const wxChar *_UnitName, const wxChar *_ClassName,
                const wxClassInfo **_Parents) :
            m_className(_ClassName),
            m_objectSize(0),
            m_objectConstructor(NULL),
            m_next(sm_first),
            m_firstPropertyFn(NULL),
            m_firstHandlerFn(NULL),
            m_firstProperty(NULL),
            m_firstHandler(NULL),
            m_firstInited(true),
            m_parents(_Parents),
            m_unitName(_UnitName),
            m_constructor(NULL),
            m_constructorProperties(NULL),
            m_constructorPropertiesCount(0),
            m_variantOfPtrToObjectConverter(NULL),
            m_variantToObjectConverter(NULL),
            m_objectToVariantConverter(NULL),
            m_streamingCallback(NULL)
    {
        sm_first = this;
        Register();
    }

    // ctor compatible with old RTTI system
    wxClassInfo(const wxChar *_ClassName,
                const wxClassInfo *_Parent1,
                const wxClassInfo *_Parent2,
                int size,
                wxObjectConstructorFn ctor) :
            m_className(_ClassName),
            m_objectSize(size),
            m_objectConstructor(ctor),
            m_next(sm_first),
            m_firstPropertyFn(NULL),
            m_firstHandlerFn(NULL),
            m_firstProperty(NULL),
            m_firstHandler(NULL),
            m_firstInited(true),
            m_parents(NULL),
            m_unitName(NULL),
            m_constructor(NULL),
            m_constructorProperties(NULL),
            m_constructorPropertiesCount(0),
            m_variantOfPtrToObjectConverter(NULL),
            m_variantToObjectConverter(NULL),
            m_objectToVariantConverter(NULL),
            m_streamingCallback(NULL)
    {
        sm_first = this;
        m_parents[0] = _Parent1;
        m_parents[1] = _Parent2;
        m_parents[2] = NULL;
        Register();
    }

    virtual ~wxClassInfo();

    // allocates an instance of this class, this object does not have to be 
    // initialized or fully constructed as this call will be followed by a call to Create
    virtual wxObject *AllocateObject() const 
        { return m_objectConstructor ? (*m_objectConstructor)() : 0; }

    // 'old naming' for AllocateObject staying here for backward compatibility
    wxObject *CreateObject() const { return AllocateObject(); }

    // direct construction call for classes that cannot construct instances via alloc/create
    wxObject *ConstructObject(int ParamCount, wxAny *Params) const;

    bool NeedsDirectConstruction() const;
    
    const wxChar       *GetClassName() const 
        { return m_className; }
    const wxChar       *GetBaseClassName1() const
        { return m_parents[0] ? m_parents[0]->GetClassName() : NULL; }
    const wxChar       *GetBaseClassName2() const
        { return (m_parents[0] && m_parents[1]) ? m_parents[1]->GetClassName() : NULL; }

    const wxClassInfo  *GetBaseClass1() const
        { return m_parents[0]; }
    const wxClassInfo  *GetBaseClass2() const
        { return m_parents[0] ? m_parents[1] : NULL; }

    const wxChar       *GetIncludeName() const 
        { return m_unitName; }
    const wxClassInfo **GetParents() const 
        { return m_parents; }
    int                 GetSize() const 
        { return m_objectSize; }
    bool                IsDynamic() const 
        { return (NULL != m_objectConstructor); }

    wxObjectConstructorFn      GetConstructor() const 
        { return m_objectConstructor; }
    const wxClassInfo         *GetNext() const 
        { return m_next; }

    // statics:

    static void                CleanUp();
    static wxClassInfo        *FindClass(const wxString& className);
    static const wxClassInfo  *GetFirst() 
        { return sm_first; }


    // Climb upwards through inheritance hierarchy.
    // Dual inheritance is catered for.

    bool IsKindOf(const wxClassInfo *info) const;

    wxDECLARE_CLASS_INFO_ITERATORS();

    // if there is a callback registered with that class it will be called
    // before this object will be written to disk, it can veto streaming out
    // this object by returning false, if this class has not registered a
    // callback, the search will go up the inheritance tree if no callback has
    // been registered true will be returned by default
    bool BeforeWriteObject( const wxObject *obj, wxObjectWriter *streamer, 
                            wxObjectWriterCallback *writercallback, const wxStringToAnyHashMap &metadata) const;

    // gets the streaming callback from this class or any superclass
    wxObjectStreamingCallback GetStreamingCallback() const;

    // returns the first property
    wxPropertyInfo* GetFirstProperty() const 
        { EnsureInfosInited(); return m_firstProperty; }

    // returns the first handler
    wxHandlerInfo* GetFirstHandler() const 
        { EnsureInfosInited(); return m_firstHandler; }

    // Call the Create upon an instance of the class, in the end the object is fully
    // initialized
    virtual bool Create (wxObject *object, int ParamCount, wxAny *Params) const;

    // get number of parameters for constructor
    virtual int GetCreateParamCount() const 
        { return m_constructorPropertiesCount; }

    // get n-th constructor parameter
    virtual const wxChar* GetCreateParamName(int n) const 
        { return m_constructorProperties[n]; }

    // Runtime access to objects for simple properties (get/set) by property 
    // name and variant data
    virtual void SetProperty (wxObject *object, const wxChar *propertyName, 
                              const wxAny &value) const;
    virtual wxAny GetProperty (wxObject *object, const wxChar *propertyName) const;

    // Runtime access to objects for collection properties by property name
    virtual wxAnyList GetPropertyCollection(wxObject *object, 
                                                  const wxChar *propertyName) const;
    virtual void AddToPropertyCollection(wxObject *object, const wxChar *propertyName, 
                                         const wxAny& value) const;

    // we must be able to cast variants to wxObject pointers, templates seem 
    // not to be suitable
    void CallOnAny( const wxAny &data, wxObjectFunctor* functor ) const;

    wxObject* AnyToObjectPtr( const wxAny &data) const;

    wxAny ObjectPtrToAny( wxObject *object ) const;

    // find property by name
    virtual const wxPropertyInfo *FindPropertyInfo (const wxChar *PropertyName) const;

    // find handler by name
    virtual const wxHandlerInfo *FindHandlerInfo (const wxChar *handlerName) const;

    // find property by name
    virtual wxPropertyInfo *FindPropertyInfoInThisClass (const wxChar *PropertyName) const;

    // find handler by name
    virtual wxHandlerInfo *FindHandlerInfoInThisClass (const wxChar *handlerName) const;

    // puts all the properties of this class and its superclasses in the map, 
    // as long as there is not yet an entry with the same name (overriding mechanism)
    void GetProperties( wxPropertyInfoMap &map ) const;

private:
    const wxChar            *m_className;
    int                      m_objectSize;
    wxObjectConstructorFn     m_objectConstructor;

    // class info object live in a linked list:
    // pointers to its head and the next element in it

    static wxClassInfo      *sm_first;
    wxClassInfo              *m_next;

    static wxHashTable      *sm_classTable;

    wxPropertyInfoFn          m_firstPropertyFn;
    wxHandlerInfoFn           m_firstHandlerFn;


protected:
    void                      EnsureInfosInited() const
    {
        if ( !m_firstInited)
        {
            if ( m_firstPropertyFn != NULL)
                m_firstProperty = (*m_firstPropertyFn)();
            if ( m_firstHandlerFn != NULL)
                m_firstHandler = (*m_firstHandlerFn)();
            m_firstInited = true;
        }
    }
    mutable wxPropertyInfo*   m_firstProperty;
    mutable wxHandlerInfo*    m_firstHandler;

private:
    mutable bool              m_firstInited;

    const wxClassInfo**       m_parents;
    const wxChar*             m_unitName;

    wxObjectAllocatorAndCreator*     m_constructor;
    const wxChar **           m_constructorProperties;
    const int                 m_constructorPropertiesCount;
    wxVariantToObjectPtrConverter m_variantOfPtrToObjectConverter;
    wxVariantToObjectConverter m_variantToObjectConverter;
    wxObjectToVariantConverter m_objectToVariantConverter;
    wxObjectStreamingCallback  m_streamingCallback;

    const wxPropertyAccessor *FindAccessor (const wxChar *propertyName) const;

protected:
    // registers the class
    void Register();
    void Unregister();

    DECLARE_NO_COPY_CLASS(wxClassInfo)
};

WXDLLIMPEXP_BASE wxObject *wxCreateDynamicObject(const wxString& name);

// ----------------------------------------------------------------------------
// wxDynamicClassInfo
// ----------------------------------------------------------------------------

// this object leads to having a pure runtime-instantiation

class WXDLLIMPEXP_BASE wxDynamicClassInfo : public wxClassInfo
{
    friend class WXDLLIMPEXP_BASE wxDynamicObject;

public:
    wxDynamicClassInfo( const wxChar *_UnitName, const wxChar *_ClassName, 
                        const wxClassInfo* superClass );
    virtual ~wxDynamicClassInfo();

    // constructs a wxDynamicObject with an instance
    virtual wxObject *AllocateObject() const;

    // Call the Create method for a class
    virtual bool Create (wxObject *object, int ParamCount, wxAny *Params) const;

    // get number of parameters for constructor
    virtual int GetCreateParamCount() const;

    // get i-th constructor parameter
    virtual const wxChar* GetCreateParamName(int i) const;

    // Runtime access to objects by property name, and variant data
    virtual void SetProperty (wxObject *object, const wxChar *PropertyName, 
                              const wxAny &Value) const;
    virtual wxAny GetProperty (wxObject *object, const wxChar *PropertyName) const;

    // adds a property to this class at runtime
    void AddProperty( const wxChar *propertyName, const wxTypeInfo* typeInfo );

    // removes an existing runtime-property
    void RemoveProperty( const wxChar *propertyName );

    // renames an existing runtime-property
    void RenameProperty( const wxChar *oldPropertyName, const wxChar *newPropertyName );

    // as a handler to this class at runtime
    void AddHandler( const wxChar *handlerName, wxObjectEventFunction address, 
                     const wxClassInfo* eventClassInfo );

    // removes an existing runtime-handler
    void RemoveHandler( const wxChar *handlerName );

    // renames an existing runtime-handler
    void RenameHandler( const wxChar *oldHandlerName, const wxChar *newHandlerName );

private:
    struct wxDynamicClassInfoInternal;
    wxDynamicClassInfoInternal* m_data;
};

// ----------------------------------------------------------------------------
// wxDECLARE class macros
// ----------------------------------------------------------------------------

#define _DECLARE_DYNAMIC_CLASS(name)                        \
    public:                                                 \
        static wxClassInfo ms_classInfo;                    \
        static const wxClassInfo* ms_classParents[];        \
        static wxPropertyInfo* GetPropertiesStatic();       \
        static wxHandlerInfo* GetHandlersStatic();          \
        static wxClassInfo *GetClassInfoStatic()            \
            { return &name::ms_classInfo; }                 \
        virtual wxClassInfo *GetClassInfo() const           \
            { return &name::ms_classInfo; }

#define wxDECLARE_DYNAMIC_CLASS(name)                       \
    static wxObjectAllocatorAndCreator* ms_constructor;           \
    static const wxChar * ms_constructorProperties[];       \
    static const int ms_constructorPropertiesCount;         \
    _DECLARE_DYNAMIC_CLASS(name)

#define wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(name)             \
    wxDECLARE_NO_ASSIGN_CLASS(name);                        \
    wxDECLARE_DYNAMIC_CLASS(name)

#define wxDECLARE_DYNAMIC_CLASS_NO_COPY(name)               \
    wxDECLARE_NO_COPY_CLASS(name);                          \
    wxDECLARE_DYNAMIC_CLASS(name)

#define wxDECLARE_CLASS(name)                               \
    wxDECLARE_DYNAMIC_CLASS(name)

#define wxDECLARE_ABSTRACT_CLASS(name)    _DECLARE_DYNAMIC_CLASS(name)
#define wxCLASSINFO(name)                 (&name::ms_classInfo)

#endif  // wxUSE_EXTENDED_RTTI
#endif // _WX_XTIH__