[Scummvm-git-logs] scummvm master -> e2cd2e6ed75a51dfed6934999871d0f68a276375
aquadran
aquadran at gmail.com
Fri Oct 16 19:47:25 UTC 2020
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
e2cd2e6ed7 COMMON: Rename Common::Debug to Common::StreamDebug
Commit: e2cd2e6ed75a51dfed6934999871d0f68a276375
https://github.com/scummvm/scummvm/commit/e2cd2e6ed75a51dfed6934999871d0f68a276375
Author: PaweÅ KoÅodziejski (aquadran at users.sourceforge.net)
Date: 2020-10-16T21:47:16+02:00
Commit Message:
COMMON: Rename Common::Debug to Common::StreamDebug
Changed paths:
common/streamdebug.cpp
common/streamdebug.h
engines/stark/resources/bookmark.cpp
engines/stark/resources/camera.cpp
engines/stark/resources/floor.cpp
engines/stark/resources/light.cpp
math/angle.cpp
math/angle.h
math/line2d.cpp
math/line2d.h
math/matrix.h
math/vector.h
diff --git a/common/streamdebug.cpp b/common/streamdebug.cpp
index 8ca5897d6b..ad78708a37 100644
--- a/common/streamdebug.cpp
+++ b/common/streamdebug.cpp
@@ -39,23 +39,23 @@ public:
int level;
};
-Debug::Debug(int level) :
+StreamDebug::StreamDebug(int level) :
_stream(new MessageStream()) {
_stream->level = level;
}
-Debug::Debug(const Debug &other) {
+StreamDebug::StreamDebug(const StreamDebug &other) {
*this = other;
}
-Debug::~Debug() {
+StreamDebug::~StreamDebug() {
if (--_stream->ref == 0) {
debug(_stream->level, "%s", _stream->msg.c_str());
delete _stream;
}
}
-Debug &Debug::space() {
+StreamDebug &StreamDebug::space() {
if (!_stream->space) {
_stream->msg += String(" ");
_stream->space = true;
@@ -63,66 +63,66 @@ Debug &Debug::space() {
return *this;
}
-Debug &Debug::nospace() {
+StreamDebug &StreamDebug::nospace() {
_stream->space = false;
return *this;
}
-Debug &Debug::maybeSpace() {
+StreamDebug &StreamDebug::maybeSpace() {
if (_stream->space) {
_stream->msg += " ";
}
return *this;
}
-Debug &Debug::operator<<(const String &str) {
+StreamDebug &StreamDebug::operator<<(const String &str) {
_stream->msg += str;
return maybeSpace();
}
-Debug &Debug::operator<<(const char *str) {
+StreamDebug &StreamDebug::operator<<(const char *str) {
_stream->msg += str;
return maybeSpace();
}
-Debug &Debug::operator<<(char str) {
+StreamDebug &StreamDebug::operator<<(char str) {
_stream->msg += str;
return maybeSpace();
}
-Debug &Debug::operator<<(int num) {
+StreamDebug &StreamDebug::operator<<(int num) {
_stream->msg += String::format("%d", num);
return maybeSpace();
}
-Debug &Debug::operator<<(unsigned int num) {
+StreamDebug &StreamDebug::operator<<(unsigned int num) {
_stream->msg += String::format("%d", num);
return maybeSpace();
}
#if !defined(__DC__) && !defined(__DS__)
-Debug &Debug::operator<<(double num) {
+StreamDebug &StreamDebug::operator<<(double num) {
_stream->msg += String::format("%g", num);
return maybeSpace();
}
#endif
-Debug &Debug::operator<<(float num) {
+StreamDebug &StreamDebug::operator<<(float num) {
_stream->msg += String::format("%g", num);
return maybeSpace();
}
-Debug &Debug::operator<<(bool value) {
+StreamDebug &StreamDebug::operator<<(bool value) {
_stream->msg += (value ? "true" : "false");
return maybeSpace();
}
-Debug &Debug::operator<<(void *p) {
+StreamDebug &StreamDebug::operator<<(void *p) {
_stream->msg += String::format("%p", p);
return maybeSpace();
}
-Debug &Debug::operator=(const Debug &other) {
+StreamDebug &StreamDebug::operator=(const StreamDebug &other) {
_stream = other._stream;
++_stream->ref;
@@ -131,6 +131,6 @@ Debug &Debug::operator=(const Debug &other) {
}
-Common::Debug streamDbg(int level) {
- return Common::Debug(level);
+Common::StreamDebug streamDbg(int level) {
+ return Common::StreamDebug(level);
}
diff --git a/common/streamdebug.h b/common/streamdebug.h
index 86ed0fb09a..42efd08cec 100644
--- a/common/streamdebug.h
+++ b/common/streamdebug.h
@@ -28,39 +28,39 @@ namespace Common {
class String;
class MessageStream;
-class Debug {
+class StreamDebug {
public:
- Debug(int level);
- Debug(const Debug &other);
- ~Debug();
+ StreamDebug(int level);
+ StreamDebug(const StreamDebug &other);
+ ~StreamDebug();
- Debug &space();
- Debug &nospace();
+ StreamDebug &space();
+ StreamDebug &nospace();
- Debug &operator<<(const String &str);
- Debug &operator<<(const char *str);
- Debug &operator<<(char str);
- Debug &operator<<(int number);
- Debug &operator<<(unsigned int number);
+ StreamDebug &operator<<(const String &str);
+ StreamDebug &operator<<(const char *str);
+ StreamDebug &operator<<(char str);
+ StreamDebug &operator<<(int number);
+ StreamDebug &operator<<(unsigned int number);
// DC and DS has float and double equal
#if !defined(__DC__) && !defined(__DS__)
- Debug &operator<<(double number);
+ StreamDebug &operator<<(double number);
#endif
- Debug &operator<<(float number);
- Debug &operator<<(bool value);
- Debug &operator<<(void *p);
+ StreamDebug &operator<<(float number);
+ StreamDebug &operator<<(bool value);
+ StreamDebug &operator<<(void *p);
- Debug &operator=(const Debug &other);
+ StreamDebug &operator=(const StreamDebug &other);
private:
- Debug &maybeSpace();
+ StreamDebug &maybeSpace();
MessageStream *_stream;
};
}
-Common::Debug streamDbg(int level = -1);
+Common::StreamDebug streamDbg(int level = -1);
#endif
diff --git a/engines/stark/resources/bookmark.cpp b/engines/stark/resources/bookmark.cpp
index a371bfab2e..ac537c3ebe 100644
--- a/engines/stark/resources/bookmark.cpp
+++ b/engines/stark/resources/bookmark.cpp
@@ -58,7 +58,7 @@ void Bookmark::readData(Formats::XRCReadStream *stream) {
}
void Bookmark::printData() {
- Common::Debug debug = streamDbg();
+ Common::StreamDebug debug = streamDbg();
debug << "position: " << _position << "\n";
}
diff --git a/engines/stark/resources/camera.cpp b/engines/stark/resources/camera.cpp
index 126e65b920..b5ead13de7 100644
--- a/engines/stark/resources/camera.cpp
+++ b/engines/stark/resources/camera.cpp
@@ -91,7 +91,7 @@ Math::Angle Camera::getHorizontalAngle() const {
}
void Camera::printData() {
- Common::Debug debug = streamDbg();
+ Common::StreamDebug debug = streamDbg();
debug << "position: " << _position << "\n";
debug << "lookDirection: " << _lookDirection << "\n";
debug << "f1: " << _f1 << "\n";
diff --git a/engines/stark/resources/floor.cpp b/engines/stark/resources/floor.cpp
index a60eed10c8..31f4f50950 100644
--- a/engines/stark/resources/floor.cpp
+++ b/engines/stark/resources/floor.cpp
@@ -217,7 +217,7 @@ void Floor::enableFloorField(FloorField *floorfield, bool enable) {
void Floor::printData() {
debug("face count: %d", _facesCount);
- Common::Debug debug = streamDbg();
+ Common::StreamDebug debug = streamDbg();
for (uint i = 0; i < _vertices.size(); i++) {
debug << i << ": " << _vertices[i] << "\n";
}
diff --git a/engines/stark/resources/light.cpp b/engines/stark/resources/light.cpp
index 3cbe7236ef..58afc4d925 100644
--- a/engines/stark/resources/light.cpp
+++ b/engines/stark/resources/light.cpp
@@ -97,7 +97,7 @@ Gfx::LightEntry *Light::getLightEntry() {
}
void Light::printData() {
- Common::Debug debug = streamDbg();
+ Common::StreamDebug debug = streamDbg();
debug << "color: " << _color << "\n";
debug << "position: " << _position << "\n";
debug << "direction: " << _direction << "\n";
diff --git a/math/angle.cpp b/math/angle.cpp
index b72f2b5439..c40bad399d 100644
--- a/math/angle.cpp
+++ b/math/angle.cpp
@@ -171,7 +171,7 @@ Angle Angle::arcTangent2(float y, float x) {
return a;
}
-Common::Debug &operator<<(Common::Debug &dbg, const Math::Angle &a) {
+Common::StreamDebug &operator<<(Common::StreamDebug &dbg, const Math::Angle &a) {
dbg.nospace() << "Angle(" << a.getDegrees(-180) << ")";
return dbg.space();
diff --git a/math/angle.h b/math/angle.h
index fb83a058ac..157b203d9d 100644
--- a/math/angle.h
+++ b/math/angle.h
@@ -26,7 +26,7 @@
#include "common/scummsys.h"
namespace Common {
-class Debug;
+class StreamDebug;
}
namespace Math {
@@ -160,7 +160,7 @@ inline bool operator>(const Angle &a1, const Angle &a2) {
return a1.getDegrees() > a2.getDegrees();
}
-Common::Debug &operator<<(Common::Debug &dbg, const Math::Angle &a);
+Common::StreamDebug &operator<<(Common::StreamDebug &dbg, const Math::Angle &a);
}
diff --git a/math/line2d.cpp b/math/line2d.cpp
index c6969f66db..5a269ebddd 100644
--- a/math/line2d.cpp
+++ b/math/line2d.cpp
@@ -105,7 +105,7 @@ float Line2d::getYatX(float x) const {
return -(_a * x + _c) / _b;
}
-Common::Debug &operator<<(Common::Debug &dbg, const Math::Line2d &line) {
+Common::StreamDebug &operator<<(Common::StreamDebug &dbg, const Math::Line2d &line) {
if (fabsf(line._a) < 0.0001f) {
dbg.nospace() << "Line2d: <y = " << (-line._a / line._b) << " * x + " << -line._c / line._b << ">";
} else {
diff --git a/math/line2d.h b/math/line2d.h
index 89d7d2c635..5aa5a44a6b 100644
--- a/math/line2d.h
+++ b/math/line2d.h
@@ -41,7 +41,7 @@ public:
float getYatX(float x) const;
- friend Common::Debug &operator<<(Common::Debug &dbg, const Line2d &line);
+ friend Common::StreamDebug &operator<<(Common::StreamDebug &dbg, const Line2d &line);
private:
float _a, _b, _c;
diff --git a/math/matrix.h b/math/matrix.h
index 90a2abd972..0025e9f26e 100644
--- a/math/matrix.h
+++ b/math/matrix.h
@@ -469,7 +469,7 @@ bool operator!=(const Matrix<r, c> &m1, const Matrix<r, c> &m2) {
}
template<int r, int c>
-Common::Debug &operator<<(Common::Debug dbg, const Math::Matrix<r, c> &m) {
+Common::StreamDebug &operator<<(Common::StreamDebug dbg, const Math::Matrix<r, c> &m) {
dbg.nospace() << "Matrix<" << r << ", " << c << ">(";
for (int col = 0; col < c; ++col) {
dbg << m(0, col) << ", ";
diff --git a/math/vector.h b/math/vector.h
index 1e2bd36a75..9c45063fee 100644
--- a/math/vector.h
+++ b/math/vector.h
@@ -126,7 +126,7 @@ void MatrixType<dim, 1>::readFromStream(Common::ReadStream *stream) {
template<int dim>
-Common::Debug &operator<<(Common::Debug dbg, const Math::Matrix<dim, 1> &v) {
+Common::StreamDebug &operator<<(Common::StreamDebug dbg, const Math::Matrix<dim, 1> &v) {
dbg.nospace() << "Vector<" << dim << ">(" << v.getValue(0);
for (int i = 1; i < dim; ++i) {
dbg << ", " << v.getValue(i);
More information about the Scummvm-git-logs
mailing list