Skip to content

Commit

Permalink
Make docset type information private
Browse files Browse the repository at this point in the history
Also fixes Coverty CID 57632.
  • Loading branch information
trollixx committed Apr 13, 2015
1 parent fe47a63 commit eefaffe
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 22 deletions.
16 changes: 3 additions & 13 deletions src/registry/docset.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,6 @@ Docset::Docset(const QString &path) :
}

countSymbols();

m_isValid = true;
}

Docset::~Docset()
Expand All @@ -86,7 +84,7 @@ Docset::~Docset()

bool Docset::isValid() const
{
return m_isValid;
return m_type != Type::Invalid;
}

QString Docset::name() const
Expand Down Expand Up @@ -114,11 +112,6 @@ QString Docset::revision() const
return m_revision;
}

Docset::Type Docset::type() const
{
return m_type;
}

QString Docset::path() const
{
return m_path;
Expand Down Expand Up @@ -365,11 +358,9 @@ void Docset::loadSymbols(const QString &symbolType, const QString &symbolString)
return;

QString queryStr;
switch (m_type) {
case Docset::Type::Dash:
if (m_type == Docset::Type::Dash) {
queryStr = QStringLiteral("SELECT name, path FROM searchIndex WHERE type='%1' ORDER BY name ASC");
break;
case Docset::Type::ZDash:
} else {
queryStr = QStringLiteral("SELECT ztokenname AS name, "
"CASE WHEN (zanchor IS NULL) THEN zpath "
"ELSE (zpath || '#' || zanchor) "
Expand All @@ -378,7 +369,6 @@ void Docset::loadSymbols(const QString &symbolType, const QString &symbolString)
"JOIN zfilepath ON ztokenmetainformation.zfile = zfilepath.z_pk "
"JOIN ztokentype ON ztoken.ztokentype = ztokentype.z_pk WHERE ztypename='%1' "
"ORDER BY ztokenname ASC");
break;
}

QSqlQuery query(queryStr.arg(symbolString), database());
Expand Down
16 changes: 7 additions & 9 deletions src/registry/docset.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,6 @@ class Docset : public QObject
{
Q_OBJECT
public:
enum class Type {
Dash,
ZDash
};

explicit Docset(const QString &path);
~Docset() override;

Expand All @@ -31,7 +26,6 @@ class Docset : public QObject
QString version() const;
QString revision() const;

Docset::Type type() const;
QString path() const;
QString documentPath() const;
QIcon icon() const;
Expand All @@ -54,22 +48,26 @@ class Docset : public QObject
static void normalizeName(QString &name, QString &parentName);

private:
enum class Type {
Invalid,
Dash,
ZDash
};

void loadMetadata();
void countSymbols();
void loadSymbols(const QString &symbolType) const;
void loadSymbols(const QString &symbolType, const QString &symbolString) const;

static QString parseSymbolType(const QString &str);

bool m_isValid = false;

QString m_sourceId;
QString m_name;
QString m_title;
QString m_keyword;
QString m_version;
QString m_revision;
Docset::Type m_type;
Docset::Type m_type = Type::Invalid;
QString m_path;
QIcon m_icon;

Expand Down

0 comments on commit eefaffe

Please sign in to comment.