diff options
author | Michi Henning <michi@zeroc.com> | 2009-02-11 16:02:22 +1000 |
---|---|---|
committer | Michi Henning <michi@zeroc.com> | 2009-02-11 16:02:22 +1000 |
commit | 69b75f3ccde03365be46980e1871607ae7dfc494 (patch) | |
tree | ebd8e9cb46453b2c07100a120d7f6dcbfa7c29a3 /cpp/src/Slice/Util.cpp | |
parent | Bug 3717: Bizarre magic numbery code in cs/demo/Ice/latency. (diff) | |
parent | bug 3021 - replace StringBuffer with StringBuilder (diff) | |
download | ice-69b75f3ccde03365be46980e1871607ae7dfc494.tar.bz2 ice-69b75f3ccde03365be46980e1871607ae7dfc494.tar.xz ice-69b75f3ccde03365be46980e1871607ae7dfc494.zip |
Merge branch 'R3_3_branch' of ssh://cvs.zeroc.com/home/git/ice into R3_3_branch
Diffstat (limited to 'cpp/src/Slice/Util.cpp')
-rw-r--r-- | cpp/src/Slice/Util.cpp | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/cpp/src/Slice/Util.cpp b/cpp/src/Slice/Util.cpp index 6a691df8fb3..106a14d989b 100644 --- a/cpp/src/Slice/Util.cpp +++ b/cpp/src/Slice/Util.cpp @@ -251,3 +251,53 @@ Slice::emitRaw(const char* message) { *errorStream << message << flush; } + +vector<string> +Slice::filterMcppWarnings(const string& message) +{ + static const int messagesSize = 2; + static const char* messages[messagesSize] = {"Converted [CR+LF] to [LF]", "End of input with no newline, supplemented newline"}; + + static const string delimiters = "\n"; + + // Skip delimiters at beginning. + string::size_type lastPos = message.find_first_not_of(delimiters, 0); + // Find first "non-delimiter". + string::size_type pos = message.find_first_of(delimiters, lastPos); + + vector<string> tokens; + bool skiped; + while (string::npos != pos || string::npos != lastPos) + { + skiped = false; + string token = message.substr(lastPos, pos - lastPos); + static const string warningPrefix = "warning:"; + if(token.find_first_of(warningPrefix) != string::npos) + { + for(int j = 0; j < messagesSize; ++j) + { + if(token.find_first_of(messages[j]) != string::npos) + { + skiped = true; + //Skip Next token. + + // Skip delimiters. Note the "not_of" + lastPos = message.find_first_not_of(delimiters, pos); + // Find next "non-delimiter" + pos = message.find_first_of(delimiters, lastPos); + break; + } + } + } + + if(!skiped) + { + tokens.push_back(token); + } + // Skip delimiters. Note the "not_of" + lastPos = message.find_first_not_of(delimiters, pos); + // Find next "non-delimiter" + pos = message.find_first_of(delimiters, lastPos); + } + return tokens; +} |