/usr/include/cppunit/Message.h is in libcppunit-dev 1.14.0-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 | #ifndef CPPUNIT_MESSAGE_H
#define CPPUNIT_MESSAGE_H
#include <cppunit/Portability.h>
#if CPPUNIT_NEED_DLL_DECL
#pragma warning( push )
#pragma warning( disable: 4251 ) // X needs to have dll-interface to be used by clients of class Z
#endif
#include <deque>
#include <string>
CPPUNIT_NS_BEGIN
/*! \brief Message associated to an Exception.
* \ingroup CreatingNewAssertions
* A message is composed of two items:
* - a short description (~20/30 characters)
* - a list of detail strings
*
* The short description is used to indicate how the detail strings should be
* interpreted. It usually indicates the failure types, such as
* "assertion failed", "forced failure", "unexpected exception caught",
* "equality assertion failed"... It should not contains new line character (\n).
*
* Detail strings are used to provide more information about the failure. It
* can contains the asserted expression, the expected and actual values in an
* equality assertion, some addional messages... Detail strings can contains
* new line characters (\n).
*/
class CPPUNIT_API Message
{
public:
Message() {};
// Ensure thread-safe copy by detaching the string.
Message( const Message &other );
explicit Message( const std::string &shortDescription );
Message( const std::string &shortDescription,
const std::string &detail1 );
Message( const std::string &shortDescription,
const std::string &detail1,
const std::string &detail2 );
Message( const std::string &shortDescription,
const std::string &detail1,
const std::string &detail2,
const std::string &detail3 );
virtual ~Message();
Message &operator =( const Message &other );
/*! \brief Returns the short description.
* \return Short description.
*/
const std::string &shortDescription() const;
/*! \brief Returns the number of detail string.
* \return Number of detail string.
*/
int detailCount() const;
/*! \brief Returns the detail at the specified index.
* \param index Zero based index of the detail string to return.
* \returns Detail string at the specified index.
* \exception std::invalid_argument if \a index < 0 or index >= detailCount().
*/
std::string detailAt( int index ) const;
/*! \brief Returns a string that represents a list of the detail strings.
*
* Example:
* \code
* Message message( "not equal", "Expected: 3", "Actual: 7" );
* std::string details = message.details();
* // details contains:
* // "- Expected: 3\n- Actual: 7\n" \endcode
*
* \return A string that is a concatenation of all the detail strings. Each detail
* string is prefixed with '- ' and suffixed with '\n' before being
* concatenated to the other.
*/
std::string details() const;
/*! \brief Removes all detail strings.
*/
void clearDetails();
/*! \brief Adds a single detail string.
* \param detail Detail string to add.
*/
void addDetail( const std::string &detail );
/*! \brief Adds two detail strings.
* \param detail1 Detail string to add.
* \param detail2 Detail string to add.
*/
void addDetail( const std::string &detail1,
const std::string &detail2 );
/*! \brief Adds three detail strings.
* \param detail1 Detail string to add.
* \param detail2 Detail string to add.
* \param detail3 Detail string to add.
*/
void addDetail( const std::string &detail1,
const std::string &detail2,
const std::string &detail3 );
/*! \brief Adds the detail strings of the specified message.
* \param message All the detail strings of this message are added to this one.
*/
void addDetail( const Message &message );
/*! \brief Sets the short description.
* \param shortDescription New short description.
*/
void setShortDescription( const std::string &shortDescription );
/*! \brief Tests if a message is identical to another one.
* \param other Message this message is compared to.
* \return \c true if the two message are identical, \c false otherwise.
*/
bool operator ==( const Message &other ) const;
/*! \brief Tests if a message is different from another one.
* \param other Message this message is compared to.
* \return \c true if the two message are not identical, \c false otherwise.
*/
bool operator !=( const Message &other ) const;
private:
std::string m_shortDescription;
typedef std::deque<std::string> Details;
Details m_details;
};
CPPUNIT_NS_END
#if CPPUNIT_NEED_DLL_DECL
#pragma warning( pop )
#endif
#endif // CPPUNIT_MESSAGE_H
|