summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2021-04-02 11:37:42 +0900
committerTomaž Vajngerl <quikee@gmail.com>2021-04-02 15:23:26 +0200
commit711ec7b6c71410b850cdf6d1411d054ca34ec5a0 (patch)
tree3d65f3db6a414c04f741ebf513146c82c7aa6880 /include
parentd7d487875246ba00d5be7e4fb0fd82b78fea5205 (diff)
vcl: move Fraction reading/writing to GenericTypeSerializer
Change-Id: Iccacaa7fd9cffe1d99f76def854c2150bb4d94f4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113499 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'include')
-rw-r--r--include/tools/GenericTypeSerializer.hxx4
-rw-r--r--include/tools/fract.hxx9
2 files changed, 10 insertions, 3 deletions
diff --git a/include/tools/GenericTypeSerializer.hxx b/include/tools/GenericTypeSerializer.hxx
index cb54e693c118..f67d92c845c5 100644
--- a/include/tools/GenericTypeSerializer.hxx
+++ b/include/tools/GenericTypeSerializer.hxx
@@ -23,6 +23,7 @@
#include <tools/color.hxx>
#include <tools/gen.hxx>
#include <tools/stream.hxx>
+#include <tools/fract.hxx>
namespace tools
{
@@ -47,6 +48,9 @@ public:
void readRectangle(Rectangle& rRectangle);
void writeRectangle(const Rectangle& rRectangle);
+
+ void readFraction(Fraction& rFraction);
+ void writeFraction(Fraction const& rFraction);
};
} // end namespace tools
diff --git a/include/tools/fract.hxx b/include/tools/fract.hxx
index c37859d7c17a..73d22fcaf430 100644
--- a/include/tools/fract.hxx
+++ b/include/tools/fract.hxx
@@ -33,7 +33,6 @@ class SAL_WARN_UNUSED TOOLS_DLLPUBLIC Fraction final
sal_Int32 mnNumerator = 0;
sal_Int32 mnDenominator = 1;
bool mbValid = true;
-
public:
Fraction() = default;
Fraction( const Fraction & rFrac ) = default;
@@ -85,8 +84,12 @@ public:
TOOLS_DLLPUBLIC friend bool operator<=( const Fraction& rVal1, const Fraction& rVal2 );
TOOLS_DLLPUBLIC friend bool operator>=( const Fraction& rVal1, const Fraction& rVal2 );
- TOOLS_DLLPUBLIC friend SvStream& ReadFraction( SvStream& rIStream, Fraction & rFract );
- TOOLS_DLLPUBLIC friend SvStream& WriteFraction( SvStream& rOStream, const Fraction& rFract );
+ static Fraction createInvalid()
+ {
+ Fraction aFraction;
+ aFraction.mbValid = false;
+ return aFraction;
+ }
};
TOOLS_DLLPUBLIC Fraction operator+( const Fraction& rVal1, const Fraction& rVal2 );