rm printError, Report::error throws exception

This commit is contained in:
James Cherry
2020-12-24 16:31:52 -08:00
parent 6fb6c93847
commit 078d69fc8d
13 changed files with 163 additions and 185 deletions
+11 -1
View File
@@ -17,7 +17,7 @@
#pragma once
#include <exception>
#include "DisallowCopyAssign.hh"
#include "Report.hh"
namespace sta {
@@ -31,6 +31,16 @@ public:
virtual const char *what() const noexcept = 0;
};
class ExceptionMsg : public Exception
{
public:
ExceptionMsg(const char *msg);
virtual const char *what() const noexcept;
private:
string msg_;
};
class ExceptionLine : public Exception
{
public:
+8 -25
View File
@@ -47,27 +47,7 @@ public:
va_list args);
void print(const string *str);
void print(const string &str);
// Print to debug stream (same as output stream).
virtual void printDebug(const char *fmt, ...)
__attribute__((format (printf, 2, 3)));
virtual void vprintDebug(const char *fmt,
va_list args);
// Print to error stream.
// Return the number of characters written.
virtual size_t printError(const char *buffer,
size_t length);
virtual void printError(const char *fmt, ...)
__attribute__((format (printf, 2, 3)));
virtual void vprintError(const char *fmt,
va_list args);
// Print to warning stream (same as error stream).
virtual void printWarn(const char *fmt, ...)
__attribute__((format (printf, 2, 3)));
virtual void vprintWarn(const char *fmt,
va_list args);
virtual void flush() {}
////////////////////////////////////////////////////////////////
@@ -137,12 +117,15 @@ protected:
// Return the number of characters written.
virtual size_t printConsole(const char *buffer,
size_t length) = 0;
// Primitive to print warning, error, critical and debug output.
// Return the number of characters written.
virtual size_t printErrorConsole(const char *buffer,
size_t length) = 0;
void printToBuffer(const char *fmt,
...);
void printToBuffer(const char *fmt,
va_list args);
void printToBufferAppend(const char *fmt,
...);
void printToBufferAppend(const char *fmt,
va_list args);
void printBuffer();
void redirectStringPrint(const char *buffer,
size_t length);
+1 -1
View File
@@ -46,7 +46,7 @@ public:
protected:
virtual size_t printConsole(const char *buffer, size_t length);
virtual size_t printErrorConsole(const char *buffer, size_t length);
void flush();
private:
DISALLOW_COPY_AND_ASSIGN(ReportTcl);