diff options
author | Daniel Wilhelm <daniel@wili.li> | 2014-04-18 17:05:30 +0200 |
---|---|---|
committer | Daniel Wilhelm <daniel@wili.li> | 2014-04-18 17:05:30 +0200 |
commit | c0fce877c478ddbf71a1b651c789e5ea00a00144 (patch) | |
tree | de01b0ae8fd296bd24fbca54a80f2f0ba071d461 /library/iconBuffer.h | |
parent | 3.3 (diff) | |
download | FreeFileSync-c0fce877c478ddbf71a1b651c789e5ea00a00144.tar.gz FreeFileSync-c0fce877c478ddbf71a1b651c789e5ea00a00144.tar.bz2 FreeFileSync-c0fce877c478ddbf71a1b651c789e5ea00a00144.zip |
3.4
Diffstat (limited to 'library/iconBuffer.h')
-rw-r--r-- | library/iconBuffer.h | 30 |
1 files changed, 20 insertions, 10 deletions
diff --git a/library/iconBuffer.h b/library/iconBuffer.h index 703f7eb7..cb2d809f 100644 --- a/library/iconBuffer.h +++ b/library/iconBuffer.h @@ -1,3 +1,9 @@ +// ************************************************************************** +// * This file is part of the FreeFileSync project. It is distributed under * +// * GNU General Public License: http://www.gnu.org/licenses/gpl.html * +// * Copyright (C) 2008-2010 ZenJu (zhnmju123 AT gmx.de) * +// ************************************************************************** +// #ifndef ICONBUFFER_H_INCLUDED #define ICONBUFFER_H_INCLUDED @@ -8,25 +14,21 @@ header should be used in the windows build only! #include <vector> #include "../shared/zstring.h" #include <memory> +#include <boost/shared_ptr.hpp> class wxCriticalSection; -class WorkerThread; -class IconDB; -class IconDbSequence; class wxIcon; namespace FreeFileSync { + class IconBuffer { - friend class ::WorkerThread; - public: - static IconBuffer& getInstance(); - static const wxIcon& getDirectoryIcon(); //one folder icon should be sufficient... + static IconBuffer& getInstance(); bool requestFileIcon(const Zstring& fileName, wxIcon* icon = NULL); //returns false if icon is not in buffer void setWorkload(const std::vector<Zstring>& load); //(re-)set new workload of icons to be retrieved; @@ -37,16 +39,24 @@ private: IconBuffer(); ~IconBuffer(); + class WorkerThread; + friend class WorkerThread; + + class IconDB; + class IconHolder; + class IconDbSequence; + typedef boost::shared_ptr<IconHolder> CountedIconPtr; + + //methods used by worker thread - void insertIntoBuffer(const DefaultChar* entryName, const wxIcon& icon); + void insertIntoBuffer(const DefaultChar* entryName, IconHolder& icon); //icon is invalidated by this call!! //---------------------- Shared Data ------------------------- std::auto_ptr<wxCriticalSection> lockIconDB; std::auto_ptr<IconDB> buffer; //use synchronisation when accessing this! + std::auto_ptr<IconDbSequence> bufSequence; //save sequence of buffer entry to delete oldest elements (implicitly shared by sharing Zstring with IconDB!!!) //------------------------------------------------------------ - std::auto_ptr<IconDbSequence> bufSequence; //save sequence of buffer entry to delte olderst elements - std::auto_ptr<WorkerThread> worker; }; } |