summaryrefslogtreecommitdiff
path: root/cpp/src/qpid/log/Statement.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/src/qpid/log/Statement.cpp')
-rw-r--r--cpp/src/qpid/log/Statement.cpp28
1 files changed, 1 insertions, 27 deletions
diff --git a/cpp/src/qpid/log/Statement.cpp b/cpp/src/qpid/log/Statement.cpp
index 6a32b50096..85b4d1f155 100644
--- a/cpp/src/qpid/log/Statement.cpp
+++ b/cpp/src/qpid/log/Statement.cpp
@@ -24,35 +24,9 @@
#include <ctype.h>
namespace qpid {
+std::string quote(const std::string& str); // Defined in Msg.cpp
namespace log {
-namespace {
-using namespace std;
-
-struct NonPrint { bool operator()(unsigned char c) { return !isprint(c) && !isspace(c); } };
-
-const char hex[] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' };
-
-std::string quote(const std::string& str) {
- NonPrint nonPrint;
- size_t n = std::count_if(str.begin(), str.end(), nonPrint);
- if (n==0) return str;
- std::string ret;
- ret.reserve(str.size()+2*n); // Avoid extra allocations.
- for (string::const_iterator i = str.begin(); i != str.end(); ++i) {
- if (nonPrint(*i)) {
- ret.push_back('\\');
- ret.push_back('x');
- ret.push_back(hex[((*i) >> 4)&0xf]);
- ret.push_back(hex[(*i) & 0xf]);
- }
- else ret.push_back(*i);
- }
- return ret;
-}
-
-}
-
void Statement::log(const std::string& message) {
Logger::instance().log(*this, quote(message));
}