| 1 |
/* |
| 2 |
* This file is part of the apvlv package |
| 3 |
* Copyright (C) <2008> <Alf> |
| 4 |
* |
| 5 |
* Contact: Alf <[email protected]> |
| 6 |
* |
| 7 |
* This program is free software; you can redistribute it and/or modify |
| 8 |
* it under the terms of the GNU General Public License as published by |
| 9 |
* the Free Software Foundation; either version 2 of the License, or |
| 10 |
* (at your option) any later version. |
| 11 |
* |
| 12 |
* This program is distributed in the hope that it will be useful, |
| 13 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 |
* GNU General Public License for more details. |
| 16 |
* |
| 17 |
* You should have received a copy of the GNU General Public License along |
| 18 |
* with this program; if not, write to the Free Software Foundation, Inc., |
| 19 |
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
| 20 |
* |
| 21 |
*/ |
| 22 |
/* @CPPFILE File.h |
| 23 |
* |
| 24 |
* Author: Alf <[email protected]> |
| 25 |
*/ |
| 26 |
|
| 27 |
#ifndef _APVLV_FILE_INDEX_H_ |
| 28 |
#define _APVLV_FILE_INDEX_H_ |
| 29 |
|
| 30 |
#include <QImage> |
| 31 |
#include <list> |
| 32 |
#include <string> |
| 33 |
|
| 34 |
#include "ApvlvSearch.h" |
| 35 |
|
| 36 |
namespace apvlv |
| 37 |
{ |
| 38 |
|
| 39 |
enum class FileIndexType |
| 40 |
{ |
| 41 |
PAGE, |
| 42 |
FILE, |
| 43 |
DIR |
| 44 |
}; |
| 45 |
|
| 46 |
class FileIndex |
| 47 |
{ |
| 48 |
public: |
| 49 |
FileIndex () = default; |
| 50 |
FileIndex (const std::string &title, int page, const std::string &path, |
| 51 |
FileIndexType type); |
| 52 |
~FileIndex (); |
| 53 |
|
| 54 |
friend bool |
| 55 |
operator== (const FileIndex &a, const FileIndex &b) |
| 56 |
{ |
| 57 |
return a.title == b.title && a.page == b.page && a.path == b.path |
| 58 |
&& a.anchor == b.anchor; |
| 59 |
} |
| 60 |
|
| 61 |
void loadDirectory (const std::string &path1); |
| 62 |
void moveChildChildren (const FileIndex &other_index); |
| 63 |
void removeChild (const FileIndex &child); |
| 64 |
|
| 65 |
/* public variables */ |
| 66 |
FileIndexType type{ FileIndexType::PAGE }; |
| 67 |
std::string title; |
| 68 |
int page{ 0 }; |
| 69 |
std::string path; |
| 70 |
std::string anchor; |
| 71 |
std::list<FileIndex> mChildrenIndex; |
| 72 |
|
| 73 |
/* public file variables */ |
| 74 |
std::int64_t size{ 0 }; |
| 75 |
std::int64_t mtime{ 0 }; |
| 76 |
}; |
| 77 |
|
| 78 |
} |
| 79 |
|
| 80 |
#endif |
| 81 |
|
| 82 |
/* Local Variables: */ |
| 83 |
/* mode: c++ */ |
| 84 |
/* End: */ |