-
Notifications
You must be signed in to change notification settings - Fork 3
/
folder.cpp
59 lines (49 loc) · 937 Bytes
/
folder.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
/*
* This file is a part of the source code of "byenow" program.
*
* Copyright (c) 2020- Alexander Pankratov and IO Bureau SA.
* All rights reserved.
*
* The source code is distributed under the terms of 2-clause
* BSD license with the Commons Clause condition. See LICENSE
* file for details.
*/
#include "folder.h"
//
fsi_item::fsi_item()
{
}
fsi_item::fsi_item(const wc_range & _name, const fsi_info & _info)
{
_name.to_str(name);
info = _info;
}
//
folder::folder()
{
parent = NULL;
items = 0;
}
folder::~folder()
{
for (auto & d : folders)
delete d;
}
wstring folder::get_path() const
{
const folder * d = this;
wstring path;
for ( ; d->parent; d = d->parent)
path = L'\\' + d->self.name + path;
return d->self.name + path;
}
void folder::census(folder_vec & vec)
{
for (auto & x : folders)
x->census(vec);
vec.push_back(this);
}
bool folder::ready_for_delete() const
{
return (items == 0);
}