summaryrefslogtreecommitdiff
path: root/src/libcamera/geometry.cpp
diff options
context:
space:
mode:
authorNiklas Söderlund <niklas.soderlund@ragnatech.se>2019-05-26 02:28:20 +0200
committerNiklas Söderlund <niklas.soderlund@ragnatech.se>2019-06-19 02:20:11 +0200
commit6bd094ad68fe41c4245863b855d9653a4e636287 (patch)
tree058359f5469e2c5f29a0d77e554c649b4508fb48 /src/libcamera/geometry.cpp
parented56f16c4b1bb61a459a005d64794fec5d4aa19e (diff)
libcamera: geometry: SizeRange: Add toString()
It's useful to be able to print a string representation of a SizeRange to the log or console, add a toString() method. While at it turn the structure into a class as it contains functions as well as data. Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Diffstat (limited to 'src/libcamera/geometry.cpp')
-rw-r--r--src/libcamera/geometry.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/libcamera/geometry.cpp b/src/libcamera/geometry.cpp
index 1ea10293..e598f6ad 100644
--- a/src/libcamera/geometry.cpp
+++ b/src/libcamera/geometry.cpp
@@ -267,6 +267,20 @@ bool operator<(const Size &lhs, const Size &rhs)
*/
/**
+ * \brief Assemble and return a string describing the size range
+ * \return A string describing the SizeRange
+ */
+std::string SizeRange::toString() const
+{
+ std::stringstream ss;
+
+ ss << "(" << min.toString() << ")-(" << max.toString() << ")/(+"
+ << hStep << ",+" << vStep << ")";
+
+ return ss.str();
+}
+
+/**
* \brief Compare size ranges for equality
* \return True if the two size ranges are equal, false otherwise
*/