Debian Codegraph @

libqnapi/src/subtitleinfo.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 "subtitleinfo.h"
16 #include <QFileInfo>
17 #include <algorithm>
18 #include <vector>
19
20 bool SubtitleInfo::operator<(const SubtitleInfo& other) const {
21 std::vector<QString> v1 = {QString::number(other.resolution), name};
22 std::vector<QString> v2 = {QString::number(resolution), other.name};
23
24 return std::lexicographical_compare(v1.begin(), v1.end(), v2.begin(),
25 v2.end());
26 }
27
28 SubtitleInfo SubtitleInfo::fromFailed(const QString& fileName) {
29 return SubtitleInfo("", "", "", QFileInfo(fileName).completeBaseName(), "",
30 "", SUBTITLE_NONE);
31 }