IFileSystemFactory.h 2.99 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
/*****************************************************************************
 * Media Library
 *****************************************************************************
 * Copyright (C) 2015 Hugo Beauzée-Luyssen, Videolabs
 *
 * Authors: Hugo Beauzée-Luyssen<hugo@beauzee.fr>
 *
 * This program is free software; you can redistribute it and/or modify it
 * under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this program; if not, write to the Free Software Foundation,
 * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
 *****************************************************************************/

23 24 25
#pragma once

#include <memory>
Hugo Beauzée-Luyssen's avatar
Hugo Beauzée-Luyssen committed
26
#include <string>
27

28 29 30
namespace medialibrary
{

31 32 33
namespace fs
{
    class IDirectory;
34
    class IFile;
Hugo Beauzée-Luyssen's avatar
Hugo Beauzée-Luyssen committed
35
    class IDevice;
36

37
    class IFileSystemFactory
38 39
    {
    public:
40
        virtual ~IFileSystemFactory() = default;
41 42
        ///
        /// \brief createDirectory creates a representation of a directory
43 44 45
        /// \note This method can fail by throwing an exception if the
        ///       directory doesn't exist, or any other I/O issue occurs.
        ///       Once created, the path of this IDirectory will be sanitized.
46
        /// \param mrl An MRL describing the desired directory
47
        ///
48
        virtual std::shared_ptr<fs::IDirectory> createDirectory( const std::string& mrl ) = 0;
49
        ///
50 51 52 53 54
        /// \brief createDevice creates a representation of a device
        /// \param uuid The device UUID
        /// \return A representation of the device, or nullptr if the device is currently unavailable.
        ///
        virtual std::shared_ptr<fs::IDevice> createDevice( const std::string& uuid ) = 0;
55
        ///
56 57 58 59
        /// \brief createDeviceFromPath creates a representation of a device
        /// \param path A path.
        /// \return A representation of the device.
        ///
Hugo Beauzée-Luyssen's avatar
Hugo Beauzée-Luyssen committed
60
        virtual std::shared_ptr<fs::IDevice> createDeviceFromMrl( const std::string& path ) = 0;
61
        ///
62 63
        /// \brief refresh Will cause any FS cache to be refreshed.
        ///
64
        virtual void refreshDevices() = 0;
65 66 67 68 69
        ///
        /// \brief isPathSupported Checks for support of a path by this FS facotry
        /// \param path The path to probe for support
        /// \return True if supported, false otherwise
        ///
Hugo Beauzée-Luyssen's avatar
Hugo Beauzée-Luyssen committed
70
        virtual bool isMrlSupported( const std::string& path ) const = 0;
71 72 73 74
        ///
        /// \brief isNetworkFileSystem Returns true if this FS factory handles network file systems
        ///
        virtual bool isNetworkFileSystem() const = 0;
75 76
    };
}
77 78

}