From 6bd094ad68fe41c4245863b855d9653a4e636287 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niklas=20S=C3=B6derlund?= Date: Sun, 26 May 2019 02:28:20 +0200 Subject: libcamera: geometry: SizeRange: Add toString() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Jacopo Mondi Reviewed-by: Laurent Pinchart --- src/libcamera/geometry.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src') 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 @@ -266,6 +266,20 @@ bool operator<(const Size &lhs, const Size &rhs) * \brief The vertical step */ +/** + * \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 -- cgit v1.2.1