This file is indexed.

/usr/include/wx-3.0/wx/cmdargs.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
///////////////////////////////////////////////////////////////////////////////
// Name:        wx/cmdargs.h
// Purpose:     declaration of wxCmdLineArgsArray helper class
// Author:      Vadim Zeitlin
// Created:     2007-11-12
// Copyright:   (c) 2007 Vadim Zeitlin <vadim@wxwindows.org>
// Licence:     wxWindows licence
///////////////////////////////////////////////////////////////////////////////

#ifndef _WX_CMDARGS_H_
#define _WX_CMDARGS_H_

#include "wx/arrstr.h"

// ----------------------------------------------------------------------------
// wxCmdLineArgsArray: helper class used by wxApp::argv
// ----------------------------------------------------------------------------

#if wxUSE_UNICODE

// this class is used instead of either "char **" or "wchar_t **" (neither of
// which would be backwards compatible with all the existing code) for argv
// field of wxApp
//
// as it's used for compatibility, it tries to look as much as traditional
// (char **) argv as possible, in particular it provides implicit conversions
// to "char **" and also array-like operator[]
class WXDLLIMPEXP_BASE wxCmdLineArgsArray
{
public:
    wxCmdLineArgsArray() { m_argsA = NULL; m_argsW = NULL; }

    template <typename T>
    wxCmdLineArgsArray& operator=(T **argv)
    {
        FreeArgs();

        m_args.clear();

        if ( argv )
        {
            while ( *argv )
                m_args.push_back(*argv++);
        }

        return *this;
    }

    operator char**() const
    {
        if ( !m_argsA )
        {
            const size_t count = m_args.size();
            m_argsA = new char *[count + 1];
            for ( size_t n = 0; n < count; n++ )
                m_argsA[n] = wxStrdup(m_args[n].ToAscii());

            m_argsA[count] = NULL;
        }

        return m_argsA;
    }

    operator wchar_t**() const
    {
        if ( !m_argsW )
        {
            const size_t count = m_args.size();
            m_argsW = new wchar_t *[count + 1];
            for ( size_t n = 0; n < count; n++ )
                m_argsW[n] = wxStrdup(m_args[n].wc_str());

            m_argsW[count] = NULL;
        }

        return m_argsW;
    }

    // existing code does checks like "if ( argv )" and we want it to continue
    // to compile, so provide this conversion even if it is pretty dangerous
    operator bool() const
    {
        return !m_args.empty();
    }

    // and the same for "if ( !argv )" checks
    bool operator!() const
    {
        return m_args.empty();
    }

    wxString operator[](size_t n) const
    {
        return m_args[n];
    }

    // we must provide this overload for g++ 3.4 which can't choose between
    // our operator[](size_t) and ::operator[](char**, int) otherwise
    wxString operator[](int n) const
    {
        return m_args[n];
    }


    // convenience methods, i.e. not existing only for backwards compatibility

    // do we have any arguments at all?
    bool IsEmpty() const { return m_args.empty(); }

    // access the arguments as a convenient array of wxStrings
    const wxArrayString& GetArguments() const { return m_args; }

    ~wxCmdLineArgsArray()
    {
        FreeArgs();
    }

private:
    template <typename T>
    void Free(T **args)
    {
        if ( !args )
            return;

        const size_t count = m_args.size();
        for ( size_t n = 0; n < count; n++ )
            free(args[n]);

        delete [] args;
    }

    void FreeArgs()
    {
        Free(m_argsA);
        Free(m_argsW);
    }

    wxArrayString m_args;
    mutable char **m_argsA;
    mutable wchar_t **m_argsW;

    wxDECLARE_NO_COPY_CLASS(wxCmdLineArgsArray);
};

// provide global operator overload for compatibility with the existing code
// doing things like "if ( condition && argv )"
inline bool operator&&(bool cond, const wxCmdLineArgsArray& array)
{
    return cond && !array.IsEmpty();
}

#endif // wxUSE_UNICODE

#endif // _WX_CMDARGS_H_