summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2017-07-24 01:58:25 +0100
committerCarl Hetherington <cth@carlh.net>2017-07-24 01:58:25 +0100
commit140ebe37bde0c9c9b84e8961573a7e65d3bd7b19 (patch)
tree830d6de2e1aae3498a47fd12539542ac07bb440c /src
parent91d8979878ba731b2d86d7aa5dc30f6a3c1a75f1 (diff)
Add some operator==.
Diffstat (limited to 'src')
-rw-r--r--src/font_size.cc6
-rw-r--r--src/font_size.h2
-rw-r--r--src/subtitle.cc19
-rw-r--r--src/subtitle.h6
-rw-r--r--src/wscript1
5 files changed, 34 insertions, 0 deletions
diff --git a/src/font_size.cc b/src/font_size.cc
index a208867..00a74cf 100644
--- a/src/font_size.cc
+++ b/src/font_size.cc
@@ -62,3 +62,9 @@ FontSize::specified () const
{
return _proportional || _points;
}
+
+bool
+sub::operator== (FontSize const & a, FontSize const & b)
+{
+ return a.proportional() == b.proportional() && a.points() == b.points();
+}
diff --git a/src/font_size.h b/src/font_size.h
index 4f49eb7..eeb09ef 100644
--- a/src/font_size.h
+++ b/src/font_size.h
@@ -65,6 +65,8 @@ private:
};
+extern bool operator== (FontSize const & a, FontSize const & b);
+
}
#endif
diff --git a/src/subtitle.cc b/src/subtitle.cc
index c146480..2b98cb2 100644
--- a/src/subtitle.cc
+++ b/src/subtitle.cc
@@ -62,3 +62,22 @@ Block::Block (RawSubtitle s)
{
}
+
+bool
+sub::operator== (Subtitle const & a, Subtitle const & b)
+{
+ return a.from == b.from && a.to == b.to && a.fade_up == b.fade_up && a.fade_down == b.fade_down && a.lines == b.lines;
+}
+
+bool
+sub::operator== (Line const & a, Line const & b)
+{
+ return a.horizontal_position == b.horizontal_position && a.vertical_position == b.vertical_position && a.blocks == b.blocks;
+}
+
+bool
+sub::operator== (Block const & a, Block const & b)
+{
+ return a.text == b.text && a.font == b.font && a.font_size == b.font_size && a.effect == b.effect && a.effect_colour == b.effect_colour
+ && a.colour == b.colour && a.bold == b.bold && a.italic == b.italic && a.underline == b.underline;
+}
diff --git a/src/subtitle.h b/src/subtitle.h
index af9ac33..f4295a2 100644
--- a/src/subtitle.h
+++ b/src/subtitle.h
@@ -67,6 +67,8 @@ public:
bool underline; ///< true to underline
};
+extern bool operator== (Block const & a, Block const & b);
+
/** @class Line
* @brief A line of text within a subtitle.
*
@@ -92,6 +94,8 @@ public:
bool same_metadata (RawSubtitle) const;
};
+extern bool operator== (Line const & a, Line const & b);
+
/** @class Subtitle
* @brief A subtitle which has been collected into lines and blocks.
*
@@ -120,6 +124,8 @@ public:
bool same_metadata (RawSubtitle) const;
};
+extern bool operator== (Subtitle const & a, Subtitle const & b);
+
}
#endif
diff --git a/src/wscript b/src/wscript
index 4f0426a..0840c72 100644
--- a/src/wscript
+++ b/src/wscript
@@ -48,6 +48,7 @@ def build(bld):
rational.h
raw_subtitle.h
reader.h
+ reader_factory.h
ssa_reader.h
stl_binary_tables.h
stl_binary_reader.h