/usr/include/dclib-0.3/dclib/cfilemanager.h is in libdc-dev 0.3.24~svn3121-2.1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 | /***************************************************************************
cfilemanager.h - description
-------------------
begin : Sat Aug 03 2002
copyright : (C) 2002-2004 by Mathias Küster
email : mathen@users.berlios.de
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef CFILEMANAGER_H
#define CFILEMANAGER_H
/**
*@author Mathias Küster
*
* This handles the files in the share and the filelist, much of which
* is handled by the CSearchIndex and CShareList classes.
*
* This handles putting data into CSearchIndex. Looking for files
* by TTH is done in CSearchIndex but keyword searches are now
* handled here.
*/
#include <dclib/dcos.h>
#include <dclib/core/types.h>
#include <dclib/core/cthread.h>
#include <dclib/core/csingleton.h>
#include <dclib/core/cstring.h>
#include <dclib/core/clist.h>
#include <dclib/dclib-stl-use.h>
#include <set>
#include <list>
#if ( (DCLIB_USES_UNORDERED_SET == 1) && (DCLIB_ALLOWS_CSTRING_KEY == 1) )
#include <algorithm>
#include <unordered_set>
#include <dclib/core/cstringhash.h>
typedef std::unordered_set<CString> FileNameSet;
#elif ( (DCLIB_USES_TR1_UNORDERED_SET == 1) && (DCLIB_ALLOWS_CSTRING_KEY == 1) )
#include <algorithm>
#include <tr1/unordered_set>
#include <dclib/core/cstringhash.h>
typedef std::tr1::unordered_set<CString> FileNameSet;
#else
typedef std::set<CString> FileNameSet;
#endif
#include <map>
typedef std::map<CString, eFileTypes> FileTypeMap;
class CFileManagerInfo;
class CByteArray;
class CSearchIndex;
class CShareList;
class DCConfigShareFolder;
class _CCallback0;
class CFileManager : public CSingleton<CFileManager>, public CThread {
public:
/** */
CFileManager();
/** */
virtual ~CFileManager();
/** */
ulonglong GetShareSize();
/** */
unsigned long GetShareBufferSize( eShareBufferType type );
/** */
int GetShareBuffer( eShareBufferType type, CByteArray * sharebuffer, bool decompress = false );
/**
* Gets a partial XML list, use depth = -1 for all,
*/
void GetPartialListing( const CString & dir, CString & result, int depth = 0 );
/** Search with any size any type */
std::set<unsigned long> * Search( unsigned int maxresults, std::list<CString> * words );
/** Search with any size of specified type */
std::set<unsigned long> * Search( unsigned int maxresults, std::list<CString> * words, eFileTypes type );
/** Search for at least size any type */
std::set<unsigned long> * SearchAtLeast( unsigned int maxresults, std::list<CString> * words, ulonglong size );
/** Search for at least size of specified type */
std::set<unsigned long> * SearchAtLeast( unsigned int maxresults, std::list<CString> * words, ulonglong size, eFileTypes type );
/** Search for at most size any type */
std::set<unsigned long> * SearchAtMost( unsigned int maxresults, std::list<CString> * words, ulonglong size );
/** Search for at most size of specified type */
std::set<unsigned long> * SearchAtMost( unsigned int maxresults, std::list<CString> * words, ulonglong size, eFileTypes type );
/** */
std::set<unsigned long> * SearchHash( CString s );
/** */
bool GetFileBaseObject( unsigned long index, struct filebaseobject * fbo, CString & filename );
/** */
CString GetHash( unsigned long hbi );
/** Get the TTH leaves for the given TTH */
CByteArray * GetHashLeaves( CString tth );
/** */
bool CreateShareList();
/** */
bool CreateHashList();
/** */
void CreateSearchIndex();
/** called on /rebuild command */
bool RebuildLists();
/** called to start hash leaf data verification */
bool ValidateLeaves();
/** */
ulonglong CalcShareSize();
/** thread callbackfunction */
virtual void Thread();
/** */
CString GetFileName( unsigned long fboid );
/** Returns true if a filelist refresh is in progress, otherwise returns false. */
bool IsCreateShareListRunning();
/** return the filetype */
eFileTypes GetFileType( CString file );
private:
/** */
void ThreadCreateSearchIndex();
/** */
void ThreadCreateHashList();
/** */
void ThreadCreateShareList();
/** */
void ThreadCreateShareList( int depth, CString curr, CString relpath, double percent );
/** /rebuild lists */
void ThreadRebuildLists();
/** */
void ThreadValidateLeaves();
/** Called by CManager (via the callback) */
int FileManagerCallback();
/** */
ulonglong CalcShareSize( int depth, CString base, CString curr, CString relpath );
/** */
void InitFileTypeList();
/** */
FileNameSet * m_pFileNameSet;
/** */
FileTypeMap m_FileTypeMap;
/** */
CList<DCConfigShareFolder> m_SharedFolders;
/** */
DCConfigShareFolder * m_pShareFolder;
/** */
unsigned long m_nFileBaseIndex;
/** */
CString m_sShareIndexBuffer;
/** */
time_t m_tCreateShareListTimeout;
/** */
CFileManagerInfo * m_pFileManagerInfo;
/** */
_CCallback0 * m_pFileManagerCallback;
/** search index class */
CSearchIndex * m_pSearchIndex;
/** sharelist class */
CShareList * m_pShareList;
/** */
CByteArray * m_pHashMemory;
};
#endif
|