vrj::test::Message Class Reference

Message with extra details. More...

#include <vrj/Test/Message.h>

List of all members.

Public Member Functions

 Message ()
 Message (const std::string &shortDesc)
 Message (const std::string &shortDesc, const std::string &detail1)
 Message (const std::string &shortDesc, const std::string &detail1, const std::string &detail2)
 Message (const std::string &shortDesc, const std::string &detail1, const std::string &detail2, const std::string &detail3)
const std::string & shortDesc ()
 Returns the short description.
std::string details () const
 Returns a string that represents a list of the detail strings.
void clearDetails ()
 Removes all detail strings.
const std::vector< std::string > & getDetails ()
 Returns a list of the details.
void addDetail (const std::string &detail)
 Adds a detail.
void addDetail (const std::string &detail1, const std::string &detail2)
 Adds two details.
void addDetail (const std::string &detail1, const std::string &detail2, const std::string &detail3)
 Adds three details.
void setShortDesc (const std::string &shortDesc)
 Sets the short description.


Detailed Description

Message with extra details.

Really just a wrapper around a vector of std::strings that describe the type of problem encountered

Definition at line 53 of file Message.h.


Constructor & Destructor Documentation

vrj::test::Message::Message (  )  [inline]

Definition at line 56 of file Message.h.

00057    {;}

vrj::test::Message::Message ( const std::string &  shortDesc  )  [inline, explicit]

Definition at line 59 of file Message.h.

00060       : mShortDesc(shortDesc)
00061    {
00062       mShortDesc = shortDesc;
00063    }

vrj::test::Message::Message ( const std::string &  shortDesc,
const std::string &  detail1 
) [inline]

Definition at line 65 of file Message.h.

References addDetail().

00066       : mShortDesc(shortDesc)
00067    {
00068       addDetail(detail1);
00069    }

vrj::test::Message::Message ( const std::string &  shortDesc,
const std::string &  detail1,
const std::string &  detail2 
) [inline]

Definition at line 71 of file Message.h.

References addDetail().

00073       : mShortDesc(shortDesc)
00074    {
00075       addDetail(detail1, detail2);
00076    }

vrj::test::Message::Message ( const std::string &  shortDesc,
const std::string &  detail1,
const std::string &  detail2,
const std::string &  detail3 
) [inline]

Definition at line 78 of file Message.h.

References addDetail().

00080      : mShortDesc(shortDesc)
00081    {
00082       addDetail(detail1, detail2, detail3);
00083    }


Member Function Documentation

const std::string& vrj::test::Message::shortDesc (  )  [inline]

Returns the short description.

Returns:
Short description.

Definition at line 88 of file Message.h.

Referenced by vrj::test::TestFailure::getFullDescription().

00089    {
00090       return mShortDesc;
00091    }

std::string vrj::test::Message::details (  )  const [inline]

Returns a string that represents a list of the detail strings.

Example:

 Message message( "not equal", "Expected: 3", "Actual: 7" );
 std::string details = message.details();
 // details contains:
 // "- Expected: 3\n- Actual: 7\n"  

Returns:
A string that is a concatenation of all the detail strings. Each detail string is prefixed with '- ' and suffixed with '
' before being concatenated to the other.

Definition at line 106 of file Message.h.

Referenced by vrj::test::TestFailure::getFullDescription().

00107    {
00108       std::stringstream oss;
00109 
00110       for(unsigned i=0;i<mDetails.size();++i)
00111       {
00112          oss << "- " << mDetails[i] << "\n";
00113       }
00114 
00115       return oss.str();
00116    }

void vrj::test::Message::clearDetails (  )  [inline]

Removes all detail strings.

Definition at line 120 of file Message.h.

00121    {
00122       mDetails.clear();
00123    }

const std::vector<std::string>& vrj::test::Message::getDetails (  )  [inline]

Returns a list of the details.

Definition at line 126 of file Message.h.

00127    {
00128       return mDetails;
00129    }

void vrj::test::Message::addDetail ( const std::string &  detail  )  [inline]

Adds a detail.

Definition at line 132 of file Message.h.

Referenced by addDetail(), and Message().

00133    {
00134       mDetails.push_back(detail);
00135    }

void vrj::test::Message::addDetail ( const std::string &  detail1,
const std::string &  detail2 
) [inline]

Adds two details.

Definition at line 138 of file Message.h.

References addDetail().

00139    {
00140       addDetail(detail1);
00141       addDetail(detail2);
00142    }

void vrj::test::Message::addDetail ( const std::string &  detail1,
const std::string &  detail2,
const std::string &  detail3 
) [inline]

Adds three details.

Definition at line 145 of file Message.h.

References addDetail().

00147    {
00148       addDetail(detail1);
00149       addDetail(detail2);
00150       addDetail(detail3);
00151    }

void vrj::test::Message::setShortDesc ( const std::string &  shortDesc  )  [inline]

Sets the short description.

Definition at line 154 of file Message.h.

00155    {
00156       mShortDesc = shortDesc;
00157    }


The documentation for this class was generated from the following file:
Generated on Thu Jan 4 10:58:32 2007 for VR Juggler by  doxygen 1.5.1