summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2014-05-27 14:50:56 +0100
committerCarl Hetherington <cth@carlh.net>2014-05-27 14:50:56 +0100
commitf0de0c63504446714ab642f9db872bd31f9c070b (patch)
tree45ea6c4219a3a3dbd1dedde65f071ab092c5c290
parent170aa07b0c45d031b89815a5d07c8eb7e9226bbe (diff)
Rename STL -> STLText
-rw-r--r--src/stl_text_reader.cc (renamed from src/stl_reader.cc)10
-rw-r--r--src/stl_text_reader.h (renamed from src/stl_reader.h)4
-rw-r--r--src/stl_text_writer.cc (renamed from src/stl_writer.cc)4
-rw-r--r--src/stl_text_writer.h (renamed from src/stl_writer.h)4
-rw-r--r--src/wscript8
-rw-r--r--test/data/test_text.stl (renamed from test/data/test.stl)0
-rw-r--r--test/dcp_to_stl_text_test.cc (renamed from test/dcp_to_stl_test.cc)7
-rw-r--r--test/stl_text_reader_test.cc (renamed from test/stl_reader_test.cc)10
-rw-r--r--test/stl_text_writer_test.cc (renamed from test/stl_writer_test.cc)8
-rw-r--r--test/test.cc11
-rw-r--r--test/wscript6
11 files changed, 42 insertions, 30 deletions
diff --git a/src/stl_reader.cc b/src/stl_text_reader.cc
index 0ed66c0..f9e9b65 100644
--- a/src/stl_reader.cc
+++ b/src/stl_text_reader.cc
@@ -17,7 +17,7 @@
*/
-#include "stl_reader.h"
+#include "stl_text_reader.h"
#include "compose.hpp"
#include <boost/algorithm/string.hpp>
#include <boost/lexical_cast.hpp>
@@ -36,7 +36,7 @@ using boost::optional;
using boost::lexical_cast;
using namespace sub;
-STLReader::STLReader (istream& in)
+STLTextReader::STLTextReader (istream& in)
{
while (in.good ()) {
string line;
@@ -128,7 +128,7 @@ STLReader::STLReader (istream& in)
}
optional<FrameTime>
-STLReader::time (string t) const
+STLTextReader::time (string t) const
{
vector<string> b;
split (b, t, is_any_of (":"));
@@ -141,7 +141,7 @@ STLReader::time (string t) const
}
void
-STLReader::set (string name, string value)
+STLTextReader::set (string name, string value)
{
if (name == "$FontName") {
_current.font = value;
@@ -157,7 +157,7 @@ STLReader::set (string name, string value)
}
void
-STLReader::maybe_push ()
+STLTextReader::maybe_push ()
{
if (!_current.text.empty ()) {
_subs.push_back (_current);
diff --git a/src/stl_reader.h b/src/stl_text_reader.h
index 891bc6d..c48a8e5 100644
--- a/src/stl_reader.h
+++ b/src/stl_text_reader.h
@@ -22,10 +22,10 @@
namespace sub {
-class STLReader : public Reader
+class STLTextReader : public Reader
{
public:
- STLReader (std::istream &);
+ STLTextReader (std::istream &);
private:
void set (std::string name, std::string value);
diff --git a/src/stl_writer.cc b/src/stl_text_writer.cc
index 126ad76..3b43fc1 100644
--- a/src/stl_writer.cc
+++ b/src/stl_text_writer.cc
@@ -17,7 +17,7 @@
*/
-#include "stl_writer.h"
+#include "stl_text_writer.h"
#include <boost/optional.hpp>
using std::list;
@@ -26,7 +26,7 @@ using std::string;
using boost::optional;
using namespace sub;
-STLWriter::STLWriter (list<Subtitle> subtitles, int screen_height_in_points, float frames_per_second, ostream& out)
+STLTextWriter::STLTextWriter (list<Subtitle> subtitles, int screen_height_in_points, float frames_per_second, ostream& out)
: Writer (subtitles, screen_height_in_points, frames_per_second)
{
optional<string> font;
diff --git a/src/stl_writer.h b/src/stl_text_writer.h
index 7e37f16..a3020f6 100644
--- a/src/stl_writer.h
+++ b/src/stl_text_writer.h
@@ -22,10 +22,10 @@
namespace sub {
-class STLWriter : public Writer
+class STLTextWriter : public Writer
{
public:
- STLWriter (std::list<Subtitle> subtitles, int screen_height_in_points, float frames_per_second, std::ostream &);
+ STLTextWriter (std::list<Subtitle> subtitles, int screen_height_in_points, float frames_per_second, std::ostream &);
};
}
diff --git a/src/wscript b/src/wscript
index 7e91edb..4b54b41 100644
--- a/src/wscript
+++ b/src/wscript
@@ -18,8 +18,8 @@ def build(bld):
frame_time.cc
metric_time.cc
reader.cc
- stl_reader.cc
- stl_writer.cc
+ stl_text_reader.cc
+ stl_text_writer.cc
subtitle.cc
vertical_reference.cc
"""
@@ -32,8 +32,8 @@ def build(bld):
frame_time.h
metric_time.h
reader.h
- stl_reader.h
- stl_writer.h
+ stl_text_reader.h
+ stl_text_writer.h
subtitle.h
vertical_reference.h
writer.h
diff --git a/test/data/test.stl b/test/data/test_text.stl
index abb755a..abb755a 100644
--- a/test/data/test.stl
+++ b/test/data/test_text.stl
diff --git a/test/dcp_to_stl_test.cc b/test/dcp_to_stl_text_test.cc
index 95a5842..b96fc6c 100644
--- a/test/dcp_to_stl_test.cc
+++ b/test/dcp_to_stl_text_test.cc
@@ -21,13 +21,13 @@
#include <boost/test/unit_test.hpp>
#include "test.h"
#include "dcp_reader.h"
-#include "stl_writer.h"
+#include "stl_text_writer.h"
using std::string;
using std::ifstream;
using std::ofstream;
-BOOST_AUTO_TEST_CASE (dcp_to_stl_test)
+BOOST_AUTO_TEST_CASE (dcp_to_stl_text_test)
{
if (private_test.empty ()) {
return;
@@ -38,7 +38,8 @@ BOOST_AUTO_TEST_CASE (dcp_to_stl_test)
sub::DCPReader r (f);
string const q = "build/test/fd586c30-6d38-48f2-8241-27359acf184c_sub.stl";
ofstream g (q.c_str ());
- sub::STLWriter w (r.subtitles (), 72 * 11, 24, g);
+ sub::STLTextWriter w (r.subtitles (), 72 * 11, 24, g);
string const c = private_test + "/fd586c30-6d38-48f2-8241-27359acf184c_sub.stl";
+ g.close ();
check_text (q, c);
}
diff --git a/test/stl_reader_test.cc b/test/stl_text_reader_test.cc
index 07e1616..fa9d448 100644
--- a/test/stl_reader_test.cc
+++ b/test/stl_text_reader_test.cc
@@ -19,17 +19,17 @@
#include <boost/test/unit_test.hpp>
#include <fstream>
-#include "stl_reader.h"
+#include "stl_text_reader.h"
#include "subtitle.h"
using std::list;
using std::ifstream;
-/* Test reading of an STL file */
-BOOST_AUTO_TEST_CASE (stl_reader_test)
+/* Test reading of a textual STL file */
+BOOST_AUTO_TEST_CASE (stl_text_reader_test)
{
- ifstream file ("test/data/test.stl");
- sub::STLReader reader (file);
+ ifstream file ("test/data/test_text.stl");
+ sub::STLTextReader reader (file);
list<sub::Subtitle> subs = reader.subtitles ();
list<sub::Subtitle>::iterator i = subs.begin ();
diff --git a/test/stl_writer_test.cc b/test/stl_text_writer_test.cc
index 8f16f1f..9e987a9 100644
--- a/test/stl_writer_test.cc
+++ b/test/stl_text_writer_test.cc
@@ -19,7 +19,7 @@
#include <boost/test/unit_test.hpp>
#include <fstream>
-#include "stl_writer.h"
+#include "stl_text_writer.h"
#include "subtitle.h"
#include "test.h"
@@ -44,8 +44,8 @@ make (string text, bool bold, bool italic, bool underline, int line, sub::FrameT
return s;
}
-/* Test writing of an STL file */
-BOOST_AUTO_TEST_CASE (stl_writer_test)
+/* Test writing of an textual STL file */
+BOOST_AUTO_TEST_CASE (stl_text_writer_test)
{
list<sub::Subtitle> subs;
subs.push_back (make (" This is a subtitle ", false, false, false, 0, sub::FrameTime (0, 0, 41, 9), sub::FrameTime (0, 0, 42, 21)));
@@ -59,7 +59,7 @@ BOOST_AUTO_TEST_CASE (stl_writer_test)
subs.push_back (make (".", false, false, false, 0, sub::FrameTime (0, 1, 1, 1), sub::FrameTime (0, 1, 2, 10)));
ofstream f ("build/test/test.stl");
- sub::STLWriter writer (subs, 24, 72 * 11, f);
+ sub::STLTextWriter writer (subs, 24, 72 * 11, f);
f.close ();
check_text ("test/ref/test.stl", "build/test/test.stl");
diff --git a/test/test.cc b/test/test.cc
index 423906b..feeba36 100644
--- a/test/test.cc
+++ b/test/test.cc
@@ -24,6 +24,7 @@
#include <string>
using std::string;
+using std::cerr;
using std::ifstream;
using std::getline;
@@ -46,6 +47,16 @@ BOOST_GLOBAL_FIXTURE (TestConfig);
void
check_text (string a, string b)
{
+ if (access (a.c_str(), F_OK) == -1) {
+ cerr << "File not found: " << a << "\n";
+ }
+
+ if (access (b.c_str(), F_OK) == -1) {
+ cerr << "File not found: " << b << "\n";
+ }
+
+ BOOST_CHECK_EQUAL (access (a.c_str(), F_OK), 0);
+
ifstream p (a.c_str ());
ifstream q (b.c_str ());
diff --git a/test/wscript b/test/wscript
index 765771e..c6abb1d 100644
--- a/test/wscript
+++ b/test/wscript
@@ -17,9 +17,9 @@ def build(bld):
obj.use = 'libsub'
obj.source = """
dcp_reader_test.cc
- dcp_to_stl_test.cc
- stl_reader_test.cc
- stl_writer_test.cc
+ dcp_to_stl_text_test.cc
+ stl_text_reader_test.cc
+ stl_text_writer_test.cc
time_test.cc
test.cc
"""