/* $Id$ */ /* * Cantus Tag Editor * Copyright © 2002-2004 by Samuel Abels * Copyright © 2007 by Tim Huetz * * 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 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see **/ #ifdef HAVE_CONFIG_H # include #endif class FileInfoCache; #ifndef HAVE_FILEINFOCACHE_H #define HAVE_FILEINFOCACHE_H #include #include #include #include #include #include #define _(String) gettext (String) #define gettext_noop(String) (String) #define N_(String) gettext_noop (String) class FileInfoCache : public sigc::trackable { protected: // Prevent copies. FileInfoCache(FileInfoCache &f) { g_assert_not_reached(); } // Prevent assignments. FileInfoCache& operator=(FileInfoCache &f) { g_assert_not_reached(); } public: FileInfoCache(); ~FileInfoCache(); /* Triggered whenever a file could not be stated (e.g. wrong permissions). */ SigC::Signal1 signal_file_stat_failed; /* Triggered whenever we have insufficient rights for a file. */ SigC::Signal1 signal_file_permission_failed; /* Receive a FileInfo object from the cache. If the object is not yet cached, * an empty object will be created, stored in the cache, and returned. */ FileInfo *operator[](std::string filename); private: friend class FileInfoManager; // A hash mapping filename to inode. __gnu_cxx::hash_map inodemap; // A hash mapping inode to FileInfo object. __gnu_cxx::hash_map cache; }; #endif