annotate Core/LoggingUtils.h @ 3519:fc26659493b6

added support for COLUMNS/ROWS tags with invalid 800\0 value observed in some US images
author amazy
date Thu, 19 Sep 2019 13:10:10 +0200
parents 815b81142ff7
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3359
815b81142ff7 Enable custom logging functions to redirect to emscripten specific logging calls
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
1 #include <sstream>
815b81142ff7 Enable custom logging functions to redirect to emscripten specific logging calls
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
2 #include <iostream>
815b81142ff7 Enable custom logging functions to redirect to emscripten specific logging calls
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
3
815b81142ff7 Enable custom logging functions to redirect to emscripten specific logging calls
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
4 namespace Orthanc
815b81142ff7 Enable custom logging functions to redirect to emscripten specific logging calls
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
5 {
815b81142ff7 Enable custom logging functions to redirect to emscripten specific logging calls
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
6 namespace Logging
815b81142ff7 Enable custom logging functions to redirect to emscripten specific logging calls
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
7 {
815b81142ff7 Enable custom logging functions to redirect to emscripten specific logging calls
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
8
815b81142ff7 Enable custom logging functions to redirect to emscripten specific logging calls
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
9 /**
815b81142ff7 Enable custom logging functions to redirect to emscripten specific logging calls
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
10 std::streambuf subclass used in FunctionCallingStream
815b81142ff7 Enable custom logging functions to redirect to emscripten specific logging calls
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
11 */
815b81142ff7 Enable custom logging functions to redirect to emscripten specific logging calls
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
12 template<typename T>
815b81142ff7 Enable custom logging functions to redirect to emscripten specific logging calls
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
13 class FuncStreamBuf : public std::stringbuf
815b81142ff7 Enable custom logging functions to redirect to emscripten specific logging calls
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
14 {
815b81142ff7 Enable custom logging functions to redirect to emscripten specific logging calls
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
15 public:
815b81142ff7 Enable custom logging functions to redirect to emscripten specific logging calls
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
16 FuncStreamBuf(T func) : func_(func) {}
815b81142ff7 Enable custom logging functions to redirect to emscripten specific logging calls
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
17
815b81142ff7 Enable custom logging functions to redirect to emscripten specific logging calls
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
18 virtual int sync()
815b81142ff7 Enable custom logging functions to redirect to emscripten specific logging calls
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
19 {
815b81142ff7 Enable custom logging functions to redirect to emscripten specific logging calls
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
20 std::string text = this->str();
815b81142ff7 Enable custom logging functions to redirect to emscripten specific logging calls
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
21 const char* buf = text.c_str();
815b81142ff7 Enable custom logging functions to redirect to emscripten specific logging calls
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
22 func_(buf);
815b81142ff7 Enable custom logging functions to redirect to emscripten specific logging calls
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
23 this->str("");
815b81142ff7 Enable custom logging functions to redirect to emscripten specific logging calls
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
24 return 0;
815b81142ff7 Enable custom logging functions to redirect to emscripten specific logging calls
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
25 }
815b81142ff7 Enable custom logging functions to redirect to emscripten specific logging calls
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
26 private:
815b81142ff7 Enable custom logging functions to redirect to emscripten specific logging calls
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
27 T func_;
815b81142ff7 Enable custom logging functions to redirect to emscripten specific logging calls
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
28 };
815b81142ff7 Enable custom logging functions to redirect to emscripten specific logging calls
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
29 }
815b81142ff7 Enable custom logging functions to redirect to emscripten specific logging calls
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
30 }