This file is indexed.

/usr/include/olad/Plugin.h is in libola-dev 0.9.1-1.1.

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
/*
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Library General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 *
 * Plugin.h
 * Header file for plugin class - plugins inherit from this.
 * Copyright (C) 2005 Simon Newton
 */

#ifndef INCLUDE_OLAD_PLUGIN_H_
#define INCLUDE_OLAD_PLUGIN_H_

#include <ola/base/Macro.h>
#include <ola/plugin_id.h>

#include <set>
#include <string>
#include <functional>

namespace ola {

class PluginAdaptor;

/*
 * The interface for a plugin
 */
class AbstractPlugin {
 public :
  AbstractPlugin() {}
  virtual ~AbstractPlugin() {}

  // load the preferences for a plugin
  virtual bool LoadPreferences() = 0;
  // The location for preferences. This can be anything really but should
  // indicate to the user how how the preferences were loaded.
  virtual std::string PreferenceSource() const = 0;
  // true if this plugin is enabled
  virtual bool IsEnabled() const = 0;
  // start the plugin
  virtual bool Start() = 0;
  // stop the plugin
  virtual bool Stop() = 0;
  // return the plugin_id of this plugin
  virtual ola_plugin_id Id() const = 0;
  // return the name of this plugin
  virtual std::string Name() const = 0;
  // return the description of this plugin
  virtual std::string Description() const = 0;

  virtual void ConflictsWith(std::set<ola_plugin_id> *conflict_set) = 0;

  // used to sort plugins
  virtual bool operator<(const AbstractPlugin &other) const = 0;
};


struct PluginLessThan: public std::binary_function<AbstractPlugin*,
                                                   AbstractPlugin*, bool> {
  bool operator()(AbstractPlugin *x, AbstractPlugin *y) {
    return x->Id() < y->Id();
  }
};


class Plugin: public AbstractPlugin {
 public :
  explicit Plugin(PluginAdaptor *plugin_adaptor):
    AbstractPlugin(),
    m_plugin_adaptor(plugin_adaptor),
    m_preferences(NULL),
    m_enabled(false) {
  }
  virtual ~Plugin() {}

  bool LoadPreferences();
  std::string PreferenceSource() const;
  bool IsEnabled() const;
  virtual bool Start();
  virtual bool Stop();
  // return true if this plugin is enabled by default
  virtual bool DefaultMode() const { return true; }
  virtual ola_plugin_id Id() const = 0;

  // return the prefix used to identify this plugin
  virtual std::string PluginPrefix() const = 0;

  // by default we don't conflict with any other plugins
  virtual void ConflictsWith(std::set<ola_plugin_id>*) {}

  bool operator<(const AbstractPlugin &other) const {
    return Id() < other.Id();
  }

 protected:
  virtual bool StartHook() { return 0; }
  virtual bool StopHook() { return 0; }
  virtual bool SetDefaultPreferences() { return true; }

  PluginAdaptor *m_plugin_adaptor;
  class Preferences *m_preferences;  // preferences container
  static const char ENABLED_KEY[];

 private:
  bool m_enabled;  // are we running

  DISALLOW_COPY_AND_ASSIGN(Plugin);
};
}  // namespace ola

// interface functions
typedef ola::AbstractPlugin* create_t(ola::PluginAdaptor *plugin_adaptor);

#endif  // INCLUDE_OLAD_PLUGIN_H_