This file is indexed.

/usr/include/cppunit/CompilerOutputter.h is in libcppunit-dev 1.13.2-2.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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
#ifndef CPPUNIT_COMPILERTESTRESULTOUTPUTTER_H
#define CPPUNIT_COMPILERTESTRESULTOUTPUTTER_H

#include <cppunit/Portability.h>
#include <cppunit/Outputter.h>
#include <cppunit/portability/Stream.h>

CPPUNIT_NS_BEGIN


class Exception;
class SourceLine;
class Test;
class TestFailure;
class TestResultCollector;

/*! 
 * \brief Outputs a TestResultCollector in a compiler compatible format.
 * \ingroup WritingTestResult
 *
 * Printing the test results in a compiler compatible format (assertion
 * location has the same format as compiler error), allow you to use your
 * IDE to jump to the assertion failure. Location format can be customized (see
 * setLocationFormat() ).
 *
 * For example, when running the test in a post-build with VC++, if an assertion
 * fails, you can jump to the assertion by pressing F4 (jump to next error).
 *
 * Heres is an example of usage (from examples/cppunittest/CppUnitTestMain.cpp):
 * \code
 * int main( int argc, char* argv[] ) {
 *   // if command line contains "-selftest" then this is the post build check
 *   // => the output must be in the compiler error format.
 *   bool selfTest = (argc > 1)  &&  
 *                   (std::string("-selftest") == argv[1]);
 *
 *   CppUnit::TextUi::TestRunner runner;
 *   runner.addTest( CppUnitTest::suite() );   // Add the top suite to the test runner
 * 
 *  if ( selfTest )
 *   { // Change the default outputter to a compiler error format outputter
 *     // The test runner owns the new outputter.
 *     runner.setOutputter( new CppUnit::CompilerOutputter( &runner.result(),
 *                                                          std::cerr ) );
 *   }
 * 
 *  // Run the test and don't wait a key if post build check.
 *   bool wasSuccessful = runner.run( "", !selfTest );
 * 
 *   // Return error code 1 if the one of test failed.
 *   return wasSuccessful ? 0 : 1;
 * }
 * \endcode
 */
class CPPUNIT_API CompilerOutputter : public Outputter
{
public:
  /*! \brief Constructs a CompilerOutputter object.
   * \param result Result of the test run.
   * \param stream Stream used to output test result.
   * \param locationFormat Error location format used by your compiler. Default
   *                       to \c CPPUNIT_COMPILER_LOCATION_FORMAT which is defined
   *                       in the configuration file. See setLocationFormat() for detail.
   * \see setLocationFormat().
   */
  CompilerOutputter( TestResultCollector *result,
                     OStream &stream,
                     const std::string &locationFormat = CPPUNIT_COMPILER_LOCATION_FORMAT );

  /// Destructor.
  virtual ~CompilerOutputter();

  /*! \brief Sets the error location format.
   * 
   * Indicates the format used to report location of failed assertion. This format should
   * match the one used by your compiler.
   *
   * The location format is a string in which the occurence of the following character
   * sequence are replaced:
   *
   * - "%l" => replaced by the line number
   * - "%p" => replaced by the full path name of the file ("G:\prg\vc\cppunit\MyTest.cpp")
   * - "%f" => replaced by the base name of the file ("MyTest.cpp")
   *
   * Some examples:
   *
   * - VC++ error location format: "%p(%l):" => produce "G:\prg\MyTest.cpp(43):"
   * - GCC error location format: "%f:%l:" => produce "MyTest.cpp:43:"
   * 
   * Thoses are the two compilers currently <em>supported</em> (gcc format is used if
   * VC++ is not detected). If you want your compiler to be automatically supported by
   * CppUnit, send a mail to the mailing list (preferred), or submit a feature request
   * that indicates how to detect your compiler with the preprocessor (\#ifdef...) and
   * your compiler location format.
   */
  void setLocationFormat( const std::string &locationFormat );

  /*! \brief Creates an instance of an outputter that matches your current compiler.
   * \deprecated This class is specialized through parameterization instead of subclassing...
   *             Use CompilerOutputter::CompilerOutputter instead.
   */
  static CompilerOutputter *defaultOutputter( TestResultCollector *result,
                                              OStream &stream );

  void write();

  void setNoWrap();

  void setWrapColumn( int wrapColumn );

  int wrapColumn() const;

  virtual void printSuccess();
  virtual void printFailureReport();
  virtual void printFailuresList();
  virtual void printStatistics();
  virtual void printFailureDetail( TestFailure *failure );
  virtual void printFailureLocation( SourceLine sourceLine );
  virtual void printFailureType( TestFailure *failure );
  virtual void printFailedTestName( TestFailure *failure );
  virtual void printFailureMessage( TestFailure *failure );

private:
  /// Prevents the use of the copy constructor.
  CompilerOutputter( const CompilerOutputter &copy );

  /// Prevents the use of the copy operator.
  void operator =( const CompilerOutputter &copy );

  virtual bool processLocationFormatCommand( char command, 
                                             const SourceLine &sourceLine );

  virtual std::string extractBaseName( const std::string &fileName ) const;

private:
  TestResultCollector *m_result;
  OStream &m_stream;
  std::string m_locationFormat;
  int m_wrapColumn;
};


CPPUNIT_NS_END


#endif  // CPPUNIT_COMPILERTESTRESULTOUTPUTTER_H