Debian Codegraph @

libqnapi/src/subconvert/formats/mpl2.cpp

raw symbols SCIP
1 /*****************************************************************************
2 ** QNapi
3 ** Copyright (C) 2008-2017 Piotr KrzemiƄski <[email protected]>
4 **
5 ** This program is free software; you can redistribute it and/or modify
6 ** it under the terms of the GNU General Public License as published by
7 ** the Free Software Foundation; either version 2 of the License, or
8 ** (at your option) any later version.
9 **
10 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
11 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
12 **
13 *****************************************************************************/
14
15 #include "mpl2.h"cxx . . $ `<file>/libqnapi/src/subconvert/formats/mpl2.h`/
16
17 bool MPL2SubtitleFormatcxx . . $ MPL2SubtitleFormat#::detectcxx . . $ MPL2SubtitleFormat#detect(5f1b03c390062051).(const QStringListcxx . . $ QStringList# &lines) const {
18 foreachcxx . . $ `<external>/15045578679651060896/qglobal.h:1145:13`! (QString line, lines) {
19 if (!line.trimmedcxx . . $ QString#trimmed(dca2c5857e9adf82).().isEmptycxx . . $ QString#isEmpty(50ce9a9e25b4a850).()) {
20 QRegExpcxx . . $ QRegExp# rcxx . . $ QRegExp#QRegExp(31e086911ff70bd0).("^\\[(\\d+)\\]\\[(\\d+)\\](.*)"cxx . . $ QString#QString(85c52e162fed56f9).);
21 r.setPatternSyntaxcxx . . $ QRegExp#setPatternSyntax(e2983a6a777435d7).(QRegExpcxx . . $ QRegExp#::RegExp2cxx . . $ QRegExp#RegExp2.);
22 return r.exactMatchcxx . . $ QRegExp#exactMatch(f3b39adf77d9c36c).(line);
23 }
24 }
25
26 return false;
27 }
28
29 SubFilecxx . . $ SubFile# MPL2SubtitleFormatcxx . . $ MPL2SubtitleFormat#::decodecxx . . $ MPL2SubtitleFormat#decode(a10217bac3d52496).(const QStringListcxx . . $ QStringList# &lines) const {
30 SubFilecxx . . $ SubFile# sf;
31
32 foreachcxx . . $ `<external>/15045578679651060896/qglobal.h:1145:13`! (QString line, lines) {
33 if (!line.trimmedcxx . . $ QString#trimmed(dca2c5857e9adf82).().isEmptycxx . . $ QString#isEmpty(50ce9a9e25b4a850).()) {
34 QRegExpcxx . . $ QRegExp# rcxx . . $ QRegExp#QRegExp(31e086911ff70bd0).("^\\[(\\d+)\\]\\[(\\d+)\\](.*)"cxx . . $ QString#QString(85c52e162fed56f9).);
35 r.setPatternSyntaxcxx . . $ QRegExp#setPatternSyntax(e2983a6a777435d7).(QRegExpcxx . . $ QRegExp#::RegExp2cxx . . $ QRegExp#RegExp2.);
36 if (r.exactMatchcxx . . $ QRegExp#exactMatch(f3b39adf77d9c36c).(line)) {
37 SubEntrycxx . . $ SubEntry# se;
38 se.frameStartcxx . . $ SubEntry#frameStart. = 100L * r.capcxx . . $ QRegExp#cap(ce915ed341d4a7f0).(1).toLongcxx . . $ QString#toLong(9627c40b2a14c302).();
39 se.frameStopcxx . . $ SubEntry#frameStop. = 100L * r.capcxx . . $ QRegExp#cap(ce915ed341d4a7f0).(2).toLongcxx . . $ QString#toLong(9627c40b2a14c302).();
40 QStringcxx . . $ QString# tokenStream = rcxx . . $ QString#QString(e1217c004a86c950)..capcxx . . $ QRegExp#cap(ce915ed341d4a7f0).(3);
41
42 se.tokenscxx . . $ SubEntry#tokens. =cxx . . $ QVector#`operator=`(a1d068f9d22786ee). decodeTokenStreamcxx . . $ SubtitleFormat#decodeTokenStream(8709a708f98d071b).(tokenStreamcxx . . $ QString#QString(3520e46b33348bf6).);
43
44 sf.entriescxx . . $ SubFile#entries..push_backcxx . . $ QVector#push_back(77d9f17553126ecb).(se);
45 }
46 }
47 }
48
49 return sf;
50 }
51
52 QStringListcxx . . $ QStringList# MPL2SubtitleFormatcxx . . $ MPL2SubtitleFormat#::encodecxx . . $ MPL2SubtitleFormat#encode(547b88c4cc907c03).(const SubFilecxx . . $ SubFile# &subFile) const {
53 QStringListcxx . . $ QStringList# linescxx . . $ QStringList#QStringList(49f6e7a06ebc5aa8).;
54 foreachcxx . . $ `<external>/15045578679651060896/qglobal.h:1145:13`! (const SubEntry &entry, subFile.entries) {
55 lines.appendcxx . . $ QList#append(77d9f17553126ecb).(encodeEntrycxx . . $ MPL2SubtitleFormat#encodeEntry(ca3a0ff6d305d01e).(entry));
56 }
57 return lines;
58 }
59
60 QStringcxx . . $ QString# MPL2SubtitleFormatcxx . . $ MPL2SubtitleFormat#::encodeEntrycxx . . $ MPL2SubtitleFormat#encodeEntry(ca3a0ff6d305d01e).(const SubEntrycxx . . $ SubEntry# &entry) const {
61 QStringcxx . . $ QString# tokensBuffcxx . . $ QString#QString(49f6e7a06ebc5aa8).;
62 foreachcxx . . $ `<external>/15045578679651060896/qglobal.h:1145:13`! (const SubToken &token, entry.tokens) {
63 tokensBuff +=cxx . . $ QString#`operator+=`(6a89d0b7f4d2681c). encodeTokencxx . . $ MPL2SubtitleFormat#encodeToken(a468b8cbbcf05ae6).(token);
64 }
65 return QStringcxx . . $ QString#QString(e1217c004a86c950).("[%1][%2]%3")
66 .argcxx . . $ QString#arg(def43e8914d794d2).(entry.frameStartcxx . . $ SubEntry#frameStart. / 100)
67 .argcxx . . $ QString#arg(def43e8914d794d2).(entry.frameStopcxx . . $ SubEntry#frameStop. / 100)
68 .argcxx . . $ QString#arg(bc823072288cbbb5).(tokensBuff);
69 }
70
71 QStringcxx . . $ QString# MPL2SubtitleFormatcxx . . $ MPL2SubtitleFormat#::encodeTokencxx . . $ MPL2SubtitleFormat#encodeToken(a468b8cbbcf05ae6).(const SubTokencxx . . $ SubToken# &entry) const {
72 switch (entry.typecxx . . $ SubToken#type.) {
73 case STT_WScxx . . $ STT_WS.:
74 returncxx . . $ QString#QString(e1217c004a86c950). " "cxx . . $ QString#QString(85c52e162fed56f9).;
75 case STT_WORDcxx . . $ STT_WORD.:
76 return entrycxx . . $ QString#QString(3520e46b33348bf6)..payloadcxx . . $ SubToken#payload.;
77 case STT_NEWLINEcxx . . $ STT_NEWLINE.:
78 returncxx . . $ QString#QString(e1217c004a86c950). "|"cxx . . $ QString#QString(85c52e162fed56f9).;
79 case STT_BOLDcxx . . $ STT_BOLD.:
80 returncxx . . $ QString#QString(e1217c004a86c950). "{y:b}"cxx . . $ QString#QString(85c52e162fed56f9).;
81 case STT_ITALICcxx . . $ STT_ITALIC.:
82 returncxx . . $ QString#QString(e1217c004a86c950). "{y:i}"cxx . . $ QString#QString(85c52e162fed56f9).;
83 case STT_UNDERLINEcxx . . $ STT_UNDERLINE.:
84 returncxx . . $ QString#QString(e1217c004a86c950). "{y:u}"cxx . . $ QString#QString(85c52e162fed56f9).;
85 case STT_FONTCOLORcxx . . $ STT_FONTCOLOR.:
86 return QStringcxx . . $ QString#QString(e1217c004a86c950).("{c:$%1}").argcxx . . $ QString#arg(bc823072288cbbb5).(entry.payloadcxx . . $ SubToken#payload.);
87 default:
88 returncxx . . $ QString#QString(e1217c004a86c950). ""cxx . . $ QString#QString(85c52e162fed56f9).;
89 }
90 }