summaryrefslogtreecommitdiff
path: root/cpp/src/Slice/Util.cpp
diff options
context:
space:
mode:
authorMark Spruiell <mes@zeroc.com>2009-02-02 10:15:06 -0800
committerMark Spruiell <mes@zeroc.com>2009-02-02 10:15:06 -0800
commitc1ce7caa97b3dd6f7536d5c3b8b482d823c51891 (patch)
tree85be09ca58cee5a9dffa27cbcf3ce67a0d2b25f2 /cpp/src/Slice/Util.cpp
parentRemoved old makedist scripts (diff)
downloadice-c1ce7caa97b3dd6f7536d5c3b8b482d823c51891.tar.bz2
ice-c1ce7caa97b3dd6f7536d5c3b8b482d823c51891.tar.xz
ice-c1ce7caa97b3dd6f7536d5c3b8b482d823c51891.zip
bug 3644 - improve integration between eclipse plugin and translator
bug 3657 - improve error reporting in translators
Diffstat (limited to 'cpp/src/Slice/Util.cpp')
-rw-r--r--cpp/src/Slice/Util.cpp79
1 files changed, 79 insertions, 0 deletions
diff --git a/cpp/src/Slice/Util.cpp b/cpp/src/Slice/Util.cpp
index cf2e77ed32f..6a691df8fb3 100644
--- a/cpp/src/Slice/Util.cpp
+++ b/cpp/src/Slice/Util.cpp
@@ -172,3 +172,82 @@ Slice::changeInclude(const string& orig, const vector<string>& includePaths)
return result;
}
+static ostream* errorStream = &cerr;
+
+void
+Slice::setErrorStream(ostream& stream)
+{
+ errorStream = &stream;
+}
+
+ostream&
+Slice::getErrorStream()
+{
+ return *errorStream;
+}
+
+void
+Slice::emitError(const string& file, int line, const string& message)
+{
+ if(!file.empty())
+ {
+ *errorStream << file;
+ if(line != -1)
+ {
+ *errorStream << ':' << line;
+ }
+ *errorStream << ": ";
+ }
+ *errorStream << message << endl;
+}
+
+void
+Slice::emitWarning(const string& file, int line, const string& message)
+{
+ if(!file.empty())
+ {
+ *errorStream << file;
+ if(line != -1)
+ {
+ *errorStream << ':' << line;
+ }
+ *errorStream << ": ";
+ }
+ *errorStream << "warning: " << message << endl;
+}
+
+void
+Slice::emitError(const string& file, const std::string& line, const string& message)
+{
+ if(!file.empty())
+ {
+ *errorStream << file;
+ if(!line.empty())
+ {
+ *errorStream << ':' << line;
+ }
+ *errorStream << ": ";
+ }
+ *errorStream << message << endl;
+}
+
+void
+Slice::emitWarning(const string& file, const std::string& line, const string& message)
+{
+ if(!file.empty())
+ {
+ *errorStream << file;
+ if(!line.empty())
+ {
+ *errorStream << ':' << line;
+ }
+ *errorStream << ": ";
+ }
+ *errorStream << "warning: " << message << endl;
+}
+
+void
+Slice::emitRaw(const char* message)
+{
+ *errorStream << message << flush;
+}