LCOV - code coverage report
Current view: top level - include/vcl - IconThemeScanner.hxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 2 0.0 %
Date: 2014-04-14 Functions: 0 2 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  */
       9             : 
      10             : #ifndef VCL_ICONTHEMESCANNER_HXX_
      11             : #define VCL_ICONTHEMESCANNER_HXX_
      12             : 
      13             : #include <vcl/dllapi.h>
      14             : #include <tools/solar.h>
      15             : 
      16             : #include <rtl/ustring.hxx>
      17             : 
      18             : #include <boost/shared_ptr.hpp>
      19             : #include <vector>
      20             : 
      21             : // forward declaration of unit test class. Required for friend relationship.
      22             : class IconThemeScannerTest;
      23             : 
      24             : namespace osl {
      25             : class Directory;
      26             : class DirectoryItem;
      27             : }
      28             : 
      29             : namespace vcl {
      30             : class IconThemeInfo;
      31             : 
      32             : /** This class scans a folder for icon themes and provides the results.
      33             :  */
      34           0 : class VCL_DLLPUBLIC IconThemeScanner
      35             : {
      36             : public:
      37             :     ~IconThemeScanner();
      38             : 
      39             :     /** Factory method to create the object.
      40             :      * Provide a path to search for IconThemes.
      41             :      */
      42             :     static boost::shared_ptr<IconThemeScanner>
      43             :     Create(const OUString &path);
      44             : 
      45             :     /** This method will return the standard path where icon themes are located.
      46             :      */
      47             :     static OUString
      48             :     GetStandardIconThemePath();
      49             : 
      50             :     const std::vector<IconThemeInfo>&
      51           0 :     GetFoundIconThemes() const {return mFoundIconThemes;}
      52             : 
      53             :     /** Get the IconThemeInfo for a theme.
      54             :      * If the theme id is not among the found themes, a std::runtime_error will be thrown.
      55             :      * Use IconThemeIsInstalled() to check whether it is available.
      56             :      */
      57             :     const IconThemeInfo& GetIconThemeInfo(const OUString& themeId);
      58             : 
      59             :     /** Checks whether the theme with the provided name has been found in the
      60             :      * scanned directory.
      61             :      */
      62             :     bool
      63             :     IconThemeIsInstalled(const OUString& themeId) const;
      64             : 
      65             : private:
      66             :     IconThemeScanner();
      67             : 
      68             :     /** Scan a directory for icon themes.
      69             :      *
      70             :      * @return
      71             :      * This method will return true on success.
      72             :      * There are several cases when this method will fail:
      73             :      * - The directory does not exist
      74             :      * - There are no files which which match the pattern images_xxx.zip
      75             :      */
      76             :     bool
      77             :     ScanDirectoryForIconThemes(const OUString &path);
      78             : 
      79             :     /** Adds the provided icon theme by path.
      80             :      */
      81             :     bool
      82             :     AddIconThemeByPath(const OUString &path);
      83             : 
      84             :     /** Scans the provided directory for icon themes.
      85             :      * The returned strings will contain the URLs to the icon themes.
      86             :      */
      87             :     static std::vector<OUString>
      88             :     ReadIconThemesFromPath(const OUString& dir);
      89             : 
      90             :     /** Check whether a single file is valid */
      91             :     static bool
      92             :     FileIsValidIconTheme(const OUString&);
      93             : 
      94             :     std::vector<IconThemeInfo> mFoundIconThemes;
      95             : 
      96             :     friend class ::IconThemeScannerTest;
      97             : };
      98             : 
      99             : } // end namespace vcl
     100             : 
     101             : #endif /* VCL_ICONTHEMESCANNER_HXX_ */
     102             : 
     103             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10