summaryrefslogtreecommitdiffstats
path: root/src/kbdirinfo.cpp
blob: 220427f4b72680aaf9b21f2dc0871134b8d88daa (plain)
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
//
// C++ Implementation: kbdirinfo
//
// Description: 
//
//
// Author: Magnus Kulke <mkulke@magnusmachine>, (C) 2004
//
// Copyright: See COPYING file that comes with this distribution
//
//

#include <ntqregexp.h>

#include <list>

#include "kbconfig.h"
#include "kbdirinfo.h"

using namespace std;

KbDirInfo::KbDirInfo(KbFileInfo info) : KbFileInfo(info)
{
}

KbDirInfo::KbDirInfo(TQString path) : KbFileInfo(path)
{
}

KbDirInfo::~KbDirInfo()
{
}

bool KbDirInfo::PrioritySort(const KbDirInfo *f1, const KbDirInfo *f2)
{
	TQRegExp m_prioritylist(KbConfig::prioritylist());

	if ((m_prioritylist.search(f1->fileName()) >= 0) > (m_prioritylist.search(f2->fileName()) >= 0)) return true;
	else return false;
}

KbDirInfo* KbDirInfo::AddDirectory(KbFileInfo info)
{
	if ((info.fileName() == ".") || (info.fileName() == "..")) return NULL;
	KbDirInfo* dir = new KbDirInfo(info);
	m_dirlist.push_back(dir);
	return dir;
}

void KbDirInfo::AddFile(KbFileInfo* file)
{
	m_filelist.push_back(file);
}