-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRepository.cpp
79 lines (65 loc) · 1.64 KB
/
Repository.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#include "Repository.hpp"
#include <QDebug>
#include <QDir>
#include <QDirIterator>
#include <QFile>
#include <QSet>
#include <QString>
#include <QStringList>
#include <QTextStream>
Repository::Repository()
:m_Repositories(0)
{
QDebug(QtDebugMsg) << "Uninitialized Repository object.";
}
Repository::Repository(const Repository& other)
:m_Parser(other.m_Parser)
,m_Repositories(other.m_Repositories)
{
}
Repository::Repository(const RepositoryParser& parser, Repositories* repositories)
:m_Parser(parser)
,m_Repositories(repositories)
{
}
Repository::Categories Repository::getCategories() const
{
Categories categories(m_Parser.getCategories());
if(m_Repositories)
{
Masters masters = getMasters();
for(Masters::const_iterator iter = masters.constBegin(); iter != masters.constEnd(); ++iter)
{
if(m_Repositories->contains(*iter))
{
categories.unite(m_Repositories->find(*iter)->getCategories());
}
}
}
categories.intersect(Categories::fromList(getDir().entryList(QDir::Dirs)));
return categories;
}
const QDir& Repository::getDir() const
{
return m_Parser.getDir();
}
Repository::Masters Repository::getMasters() const
{
return m_Parser.getMasters();
}
QString Repository::getName() const
{
return m_Parser.getName();
}
const RepositoryParser& Repository::getParser() const
{
return m_Parser;
}
Repository::Packages Repository::getPackages() const
{
return m_Parser.getPackages();
}
Repository::Packages Repository::getPackages(const QString& strCategory) const
{
return m_Parser.getPackages(strCategory);
}