diff options
| author | Carl Hetherington <cth@carlh.net> | 2015-01-22 19:59:07 +0000 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2015-01-22 19:59:07 +0000 |
| commit | 305c00f13c929478de39123008d93b52ed2ec7ca (patch) | |
| tree | 782fce23c14185378ede55d0f5393f2024fddaff /src/types.cc | |
| parent | 14e4eac6689b5ffe3542d45ad62708507efcd791 (diff) | |
| parent | 6986647a7ec79fe1a83da96c50bbf414dda859c5 (diff) | |
Merge branch 'master' of ssh://main.carlh.net/home/carl/git/libdcp
Diffstat (limited to 'src/types.cc')
| -rw-r--r-- | src/types.cc | 41 |
1 files changed, 34 insertions, 7 deletions
diff --git a/src/types.cc b/src/types.cc index f45e3345..920cc5e9 100644 --- a/src/types.cc +++ b/src/types.cc @@ -159,11 +159,11 @@ string libdcp::valign_to_string (VAlign v) { switch (v) { - case TOP: + case VERTICAL_TOP: return "top"; - case CENTER: + case VERTICAL_CENTER: return "center"; - case BOTTOM: + case VERTICAL_BOTTOM: return "bottom"; } @@ -174,14 +174,41 @@ VAlign libdcp::string_to_valign (string s) { if (s == "top") { - return TOP; + return VERTICAL_TOP; } else if (s == "center") { - return CENTER; + return VERTICAL_CENTER; } else if (s == "bottom") { - return BOTTOM; + return VERTICAL_BOTTOM; } boost::throw_exception (DCPReadError ("unknown subtitle valign type")); } - +string +libdcp::halign_to_string (HAlign h) +{ + switch (h) { + case HORIZONTAL_LEFT: + return "left"; + case HORIZONTAL_CENTER: + return "center"; + case HORIZONTAL_RIGHT: + return "right"; + } + + boost::throw_exception (MiscError ("unknown halign type")); +} + +HAlign +libdcp::string_to_halign (string s) +{ + if (s == "left") { + return HORIZONTAL_LEFT; + } else if (s == "center") { + return HORIZONTAL_CENTER; + } else if (s == "right") { + return HORIZONTAL_RIGHT; + } + + boost::throw_exception (DCPReadError ("unknown subtitle halign type")); +} |
