--- /dev/null
+// ---\r
+//\r
+// $Id: cpptest-compileroutput.h,v 1.3 2005/06/08 08:08:06 nilu Exp $\r
+//\r
+// CppTest - A C++ Unit Testing Framework\r
+// Copyright (c) 2003 Niklas Lundell\r
+//\r
+// ---\r
+//\r
+// This library is free software; you can redistribute it and/or\r
+// modify it under the terms of the GNU Lesser General Public\r
+// License as published by the Free Software Foundation; either\r
+// version 2 of the License, or (at your option) any later version.\r
+//\r
+// This library is distributed in the hope that it will be useful,\r
+// but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\r
+// Lesser General Public License for more details.\r
+//\r
+// You should have received a copy of the GNU Lesser General Public\r
+// License along with this library; if not, write to the\r
+// Free Software Foundation, Inc., 59 Temple Place - Suite 330,\r
+// Boston, MA 02111-1307, USA.\r
+//\r
+// ---\r
+\r
+/** \file */\r
+\r
+#ifndef CPPTEST_COMPILEROUTPUT_H\r
+#define CPPTEST_COMPILEROUTPUT_H\r
+\r
+#include <iostream>\r
+#include <stdexcept>\r
+\r
+#include "cpptest-output.h"\r
+\r
+namespace Test\r
+{\r
+ /// \brief Compiler-like output handler.\r
+ ///\r
+ /// %Test suite output handler that only outputs failures in compiler\r
+ /// warning/error format. This way, you can use your IDE to browse between\r
+ /// failures.\r
+ ///\r
+ /// The output format is configurable to be able to emulate different\r
+ /// compiler outputs. The following modifiers exist:\r
+ /// - \e %file Outputs the file containing the test function.\r
+ /// - \e %line Line number for the the test function.\r
+ /// - \e %text Expression (or message) that caused the assertment.\r
+ /// Note that each modifier can only be specified once.\r
+ ///\r
+ class CompilerOutput : public Output\r
+ {\r
+ public:\r
+ /// \brief Compiler output exception.\r
+ ///\r
+ /// Indicates that an invalid message format was given when creating\r
+ /// a compiler output. The failing format may be retrieved using the\r
+ /// what() method.\r
+ ///\r
+ class InvalidFormat : public std::logic_error\r
+ {\r
+ public:\r
+ InvalidFormat(const std::string& what)\r
+ : std::logic_error(what) {}\r
+ };\r
+ \r
+ /// Pre-defined compiler output formats.\r
+ ///\r
+ enum Format\r
+ {\r
+ /// Generic compiler format, which equals:\r
+ /// <tt>%%file:%%line: %%text</tt>\r
+ /// \r
+ Generic,\r
+\r
+ /// <a href="http://www.borland.com/products/downloads/download_cbuilder.html">\r
+ /// Borland C++ Compiler</a> (BCC) format, which equals:\r
+ /// <tt>Error cpptest %%file %%line: %%text</tt>.\r
+ ///\r
+ BCC,\r
+ \r
+ /// <a href="http://gcc.gnu.org">GNU Compiler Collection</a> \r
+ /// (GCC) format, which equals:\r
+ /// <tt>%%file:%%line: %%text</tt>\r
+ ///\r
+ GCC,\r
+\r
+ /// <a href="http://www.microsoft.com">Microsoft Visual C++</a> \r
+ /// (MSVC) format, which equals:\r
+ /// <tt>%%file(%%line) : %%text</tt>\r
+ ///\r
+ MSVC\r
+ };\r
+ \r
+ explicit CompilerOutput(Format format = Generic,\r
+ std::ostream& stream = std::cout);\r
+ \r
+ explicit CompilerOutput(const std::string& format,\r
+ std::ostream& stream = std::cout);\r
+ \r
+ virtual void assertment(const Source& s);\r
+ \r
+ private:\r
+ std::string _format;\r
+ std::ostream& _stream;\r
+ };\r
+\r
+} // namespace Test\r
+ \r
+#endif // #ifndef CPPTEST_COMPILEROUTPUT_H\r
+\r