This file is indexed.

/usr/include/codeblocks/logmanager.h is in codeblocks-dev 13.12+dfsg-4.

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
/*
 * This file is part of the Code::Blocks IDE and licensed under the GNU Lesser General Public License, version 3
 * http://www.gnu.org/licenses/lgpl-3.0.html
 */

#ifndef LOGMGR_H
#define LOGMGR_H

#include "manager.h"
#include "logger.h"
#include <map>

//namespace cb
//{
    inline wxString F(const wxChar* msg, ...)
    {
        va_list arg_list;
        va_start(arg_list, msg);
#if wxCHECK_VERSION(2,9,0) && wxUSE_UNICODE
// in wx >=  2.9 unicode-build (default) we need the %ls here, or the strings get
// cut after the first character
        ::temp_string = msg;
        ::temp_string.Replace(_T("%s"), _T("%ls"));
        msg = ::temp_string.wx_str();
#endif
        ::temp_string = wxString::FormatV(msg, arg_list);
        va_end(arg_list);

        return ::temp_string;
    }
//} // namespace cb


struct LogSlot
{
    friend class LogManager;

    Logger*   log;
    size_t    index;
    wxBitmap* icon;
    wxString  title;

    LogSlot();
    ~LogSlot();

    size_t Index() const;

    void    SetLogger(Logger* in);
    Logger* GetLogger() const;
};


class DLLIMPORT LogManager : public Mgr<LogManager>
{
public:
        struct InstantiatorBase
        {
            virtual Logger* New()                 { return nullptr; };
            virtual bool RequiresFilename() const { return false; };
            virtual ~InstantiatorBase()           { ; };
        };
        template<typename type, bool requires_filename = false> struct Instantiator : public InstantiatorBase
        {
            virtual Logger* New()                 { return new type; };
            virtual bool RequiresFilename() const { return requires_filename; };
        };

        enum { max_logs = 32 };
private:
        typedef std::map<wxString, InstantiatorBase*> inst_map_t;
        inst_map_t instMap;

        LogSlot slot[max_logs+1];

        LogManager();
        ~LogManager();


        friend class Mgr<LogManager>;
        friend class Manager;

        void ClearLogInternal(int i);
        void LogInternal(const wxString& msg, int i, Logger::level lv);

public:
        enum { no_index = -1, invalid_log, stdout_log, app_log, debug_log};

        /* ------------------------------------------------------------------------------------------------------
         * Management functions
         * ------------------------------------------------------------------------------------------------------
         * Unless you are writing your own loggers, you will probably not need any of these.
         * SetLog() transfers ownership of the Logger object to the LogManager. Loggers must be heap allocated.
         * On error, SetLog() returns invalid_log
         */
        size_t SetLog(Logger* l, int index = no_index);
        void DeleteLog(int i);
        LogSlot& Slot(int i);
        size_t FindIndex(Logger* l);

        /* ------------------------------------------------------------------------------------------------------
         * Logging functions
         * ------------------------------------------------------------------------------------------------------
         * This section is what most people will be interested in.
         *   - Log(), LogWarning(), and LogError() output "info", "warning", or "error" messages to a log.
         *     Log() is almost certainly the function that you want to use, if you don't know what to pick.
         *     By default, logging is directed to the application log.
         *   - DebugLog() and DebugLogError() direct their output into the debug log.
         *   - LogToStdOut() outputs a message on stdout. Normally you will not want to use this function, it
         *     exists solely for some special cases.
         *   - Panic() signals a condition that does not allow proper continuation of the application or significant
         *     parts of it, but it is slightly less harsh than simply bailing out with an unhandled exception.
         *     Currently, Panic() is simply a wrapper around wxSafeShowMessage(), but it might do something else, too.
         *     When signalling panic, you will usually want to shut down the application as soon as appropriate.
         *     Plugins should call Panic() with the plugin's name as the component argument.
         */

        void Log(const wxString& msg, int i = app_log, Logger::level lv = Logger::info) { LogInternal(msg, i, lv); };
        void LogWarning(const wxString& msg, int i = app_log) { Log(msg, i, Logger::warning); };
        void LogError(const wxString& msg, int i = app_log) { Log(msg, i, Logger::error); };

        void Panic(const wxString& msg, const wxString& component = wxEmptyString);

        void DebugLog(const wxString& msg, Logger::level lv = Logger::info) { Log(msg, debug_log, lv); };
        void DebugLogError(const wxString& msg) { DebugLog(msg, Logger::error); };

        void LogToStdOut(const wxString& msg, Logger::level lv = Logger::info) { Log(msg, stdout_log, lv); };

        void ClearLog(int i) { ClearLogInternal(i); };

        /* ------------------------------------------------------------------------------------------------------
         * Logger registry and RTTI
         * ------------------------------------------------------------------------------------------------------
         * These functions allow to obtain a list of names for all generic Loggers that are presently available
         * and to create a new Logger by name without knowing the type at compile time.
         *
         *   logptr = LogManager::Get()->New(_T("stdout"));  // does exactly the same as
         *   logptr = new StdoutLogger();
         *
         * You normally do not need to worry about creating Loggers. Only ever consider using these functions if you
         * really have to (want to) change the global behaviour of Code::Blocks for some reason.
         */
        wxArrayString ListAvailable();
        Logger* New(const wxString& name);
        bool FilenameRequired(const wxString& name);
        /*
         * Add a logger to the registry of "available Logger types". Unless you are adding a general Logger which should
         * be accessible by name, you will not need this function. Having said that, you probably NEVER need this function.
         */
        void Register(const wxString& name, InstantiatorBase* ins);

        /* ------------------------------------------------------------------------------------------------------
         *  Unless your name is "main.cpp" by any chance, you don't ever need to call this.
         *  If you use it, and your name is not "main.cpp", then you better come up with a good excuse, if someone asks.
         * ------------------------------------------------------------------------------------------------------
         */
        void NotifyUpdate();
};

#endif