[Scummvm-git-logs] scummvm master -> 9f5466f3bda0351de6990164cac59227b56944e3
lephilousophe
noreply at scummvm.org
Tue Aug 12 09:49:32 UTC 2025
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://api.github.com/repos/scummvm/scummvm .
Summary:
9f5466f3bd COMMON: Add /, /=, and += operators to Path class
Commit: 9f5466f3bda0351de6990164cac59227b56944e3
https://github.com/scummvm/scummvm/commit/9f5466f3bda0351de6990164cac59227b56944e3
Author: Ori Avtalion (ori at avtalion.name)
Date: 2025-08-12T11:49:28+02:00
Commit Message:
COMMON: Add /, /=, and += operators to Path class
Map them to existing functions Path::join, joinInPlace and
apppendInPlace.
Changed paths:
common/path.h
diff --git a/common/path.h b/common/path.h
index 11a729e5fba..f6a36954c75 100644
--- a/common/path.h
+++ b/common/path.h
@@ -395,6 +395,25 @@ public:
/** @overload */
Path &appendInPlace(const char *str, char separator = '/');
+ /**
+ * Appends the given path to this path (in-place).
+ * Does not automatically add a directory separator.
+ * For string based versions, expects / as a directory separator.
+ */
+ Path &operator+=(const Path &x) {
+ return appendInPlace(x);
+ }
+
+ /** @overload */
+ Path &operator+=(const String &str) {
+ return appendInPlace(str);
+ }
+
+ /** @overload */
+ Path &operator+=(const char *str) {
+ return appendInPlace(str);
+ }
+
/**
* Returns this path with the given path appended (out-of-place).
* Does not automatically add a directory separator.
@@ -442,6 +461,25 @@ public:
/** @overload */
Path &joinInPlace(const char *str, char separator = '/');
+ /**
+ * Joins the given path to this path (in-place).
+ * Automatically adds a directory separator.
+ * For string based versions, expects / as a directory separator.
+ */
+ Path &operator/=(const Path &x) {
+ return joinInPlace(x);
+ }
+
+ /** @overload */
+ Path &operator/=(const String &str) {
+ return joinInPlace(str);
+ }
+
+ /** @overload */
+ Path &operator/=(const char *str) {
+ return joinInPlace(str);
+ }
+
/**
* Returns this path joined with the given path (out-of-place).
* Automatically adds a directory separator.
@@ -464,6 +502,25 @@ public:
return temp;
}
+ /**
+ * Returns this path joined with the given path (out-of-place).
+ * Automatically adds a directory separator.
+ * For string based versions, expects / as a directory separator.
+ */
+ WARN_UNUSED_RESULT Path operator/(const Path &x) const {
+ return join(x);
+ }
+
+ /** @overload */
+ WARN_UNUSED_RESULT Path operator/(const String &str) const {
+ return join(str);
+ }
+
+ /** @overload */
+ WARN_UNUSED_RESULT Path operator/(const char *str) const {
+ return join(str);
+ }
+
/**
* Removes the trainling separators if any in this path (in-place).
*/
More information about the Scummvm-git-logs
mailing list