This file is indexed.

/usr/include/ThePEG/Utilities/Exception.h is in libthepeg-dev 1.8.0-3build1.

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
// -*- C++ -*-
//
// Exception.h is a part of ThePEG - Toolkit for HEP Event Generation
// Copyright (C) 1999-2011 Leif Lonnblad
//
// ThePEG is licenced under version 2 of the GPL, see COPYING for details.
// Please respect the MCnet academic guidelines, see GUIDELINES for details.
//
#ifndef ThePEG_Exception_H
#define ThePEG_Exception_H
// This is the declaration of the Exception class.

#include <exception>
#include "ThePEG/Config/ThePEG.h"
#include "Exception.fh"
#include <string>
#include <iosfwd>

extern "C" {
  void breakThePEG();
}

namespace ThePEG {

/**
 * <code>Exception</code> is the base class for all exceptions to be
 * used in ThePEG. It is derived from <code>std::exception</code> and
 * adds information about the severity of the exception to indicate to
 * the Repository and EventGenrator how to act on it.
 *
 * To throw an exception one should inherit from
 * <code>Exception</code> and add information in the constructor of
 * the base class. Alternatively one can use the <code>operator<<
 * </code> operator on a default constructed <code>Exception</code> to
 * add information as for a standard <code>ostream</code> object, in
 * which case one should always end with adding an enum of the type
 * <code>Exception::Severity</code> to indicate the severity of the
 * exception e.g.<br> <code>Exception() << "Something went wrong." <<
 * Exception::eventerror</code>.
 *
 * @see Repository
 * @see EventGenrator
 */
class Exception: public exception {

public:

  /**
   * The levels of severity.
   */
  enum Severity {
    unknown,      /**< Unknown severity */
    info,         /**< Not severe (but the user should be
		   *   informed). */
    warning,      /**< Possibly severe, (the user should be
		   *   warned). */
    setuperror,   /**< Command failed during setup phase,
		   *   execution is continued. */
    eventerror,   /**< Possibly severe, (the event being
		   *   generated should be discarded). */
    runerror,     /**< Severe error, (the run should be
		   *   terminated). */
    maybeabort,   /**< Severe error, (the run should be
		   *   terminated, possibly dumping core). */
    abortnow      /**< Severe error, (the run is aborted
		   *   immediately, before the exception is
		   *   thrown). */
  };

public:

  /**
   * Standard constructor.
   * @param str an error message.
   * @param sev the severity.
   */
  Exception(const string & str, Severity sev);

  /**
   * Default constructor.
   */
  Exception() : handled(false), theSeverity(unknown) { breakThePEG(); }

  /**
   * The copy constructor.
   */
  Exception(const Exception & ex) 
    : std::exception(ex), theMessage(ex.message()), 
      handled(ex.handled), theSeverity(ex.severity()) 
  {
    ex.handle();
  }

  /**
   * The destructor
   */
  virtual ~Exception() throw();

public:

  /**
   * Assignment.
   */
  const Exception & operator=(const Exception & ex) {
    handled = ex.handled;
    theMessage << ex.message();
    theSeverity = ex.severity();
    ex.handle();
    return *this;
  }

  /**
   * Comparison
   */
  bool operator==(const Exception & ex) const {
    return ( message() == ex.message() && severity() == ex.severity() );
  }

  /**
   * Compare severity. If equal compare error message
   * lexicographically.
   */
  bool operator<(const Exception & ex) const {
    return ( severity() == ex.severity() ? 
	     ( message() < ex.message() ) :
	     ( severity() < ex.severity() ) );
  }

public:

  /**
   * Return the error message.
   */
  virtual const char* what() const throw() {
    static string str;
    str = message();
    return str.c_str();
  }

  /**
   * Return the error message.
   */
  string message() const {
    string mess = theMessage.str();
    return mess.empty() ? string("Error message not provided.") : mess;
  }

  /**
   * Write the error message to a stream.
   */
  void writeMessage(ostream & os = *errstream) const;

  /**
   * Return the severity.
   */
  Severity severity() const { return theSeverity; }

  /**
   * Indicate that this exception has been taken care of.
   */
  void handle() const { handled = true; }

  /**
   * Add info to the exception message.
   */
  template <typename T>
  Exception & operator<<(const T & t) {
    theMessage << t;
    return *this;
  }

  /**
   * Set the severity for the exception.
   */
  Exception & operator<<(Severity sev) {
    severity(sev);
    return *this;
  }

protected:

  /**
   * set the severity.
   */
  void severity(Severity);

  /**
   * Stream to write the error message to.
   */
  mutable ostringstream theMessage;

private:

  /**
   * True if this exception has been taken care of.
   */
  mutable bool handled;

  /**
   * The severity.
   */
  Severity theSeverity;

  /**
   * The default stream to write the error message if unhandled.
   */
  static ostream * errstream;

public:

  /**
   * If this flag is set, all abortnow and maybeabort severities will
   * be treated as runerror.
   */
  static bool noabort;

};

}

#endif /* ThePEG_Exception_H */