2 * Copyright (C) 2005-2013 Team XBMC
5 * This Program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2, or (at your option)
10 * This Program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with XBMC; see the file COPYING. If not, see
17 * <http://www.gnu.org/licenses/>.
23 #include "dbwrappers/Database.h"
24 #include "TextureCacheJob.h"
26 class CTextureDatabase : public CDatabase
30 virtual ~CTextureDatabase();
33 bool GetCachedTexture(const CStdString &originalURL, CTextureDetails &details);
34 bool AddCachedTexture(const CStdString &originalURL, const CTextureDetails &details);
35 bool SetCachedTextureValid(const CStdString &originalURL, bool updateable);
36 bool ClearCachedTexture(const CStdString &originalURL, CStdString &cacheFile);
37 bool IncrementUseCount(const CTextureDetails &details);
39 /*! \brief Invalidate a previously cached texture
40 Invalidates the texture hash, and sets the texture update time to the current time so that
41 next texture load it will be re-cached.
42 \param url texture path
44 bool InvalidateCachedTexture(const CStdString &originalURL);
46 /*! \brief Get a texture associated with the given path
47 Used for retrieval of previously discovered images to save
48 stat() on the filesystem all the time
49 \param url path that may be associated with a texture
50 \param type type of image to look for
51 \return URL of the texture associated with the given path
53 CStdString GetTextureForPath(const CStdString &url, const CStdString &type);
55 /*! \brief Set a texture associated with the given path
56 Used for setting of previously discovered images to save
57 stat() on the filesystem all the time. Should be used to set
58 the actual image path, not the cached image path (the image will be
60 \param url path that was used to find the texture
61 \param type type of image to associate
62 \param texture URL of the texture to associate with the path
64 void SetTextureForPath(const CStdString &url, const CStdString &type, const CStdString &texture);
66 /*! \brief Clear a texture associated with the given path
67 \param url path that was used to find the texture
68 \param type type of image to associate
69 \param texture URL of the texture to associate with the path
70 \sa GetTextureForPath, SetTextureForPath
72 void ClearTextureForPath(const CStdString &url, const CStdString &type);
75 /*! \brief retrieve a hash for the given url
76 Computes a hash of the current url to use for lookups in the database
77 \param url url to hash
78 \return a hash for this url
80 unsigned int GetURLHash(const CStdString &url) const;
82 virtual bool CreateTables();
83 virtual bool UpdateOldVersion(int version);
84 virtual int GetMinVersion() const { return 13; };
85 const char *GetBaseDBName() const { return "Textures"; };