#pragma region CPL License
/*
Nuclex Native Framework
Copyright (C) 2002-2021 Nuclex Development Labs
This library is free software; you can redistribute it and/or
modify it under the terms of the IBM Common Public License as
published by the IBM Corporation; either version 1.0 of the
License, or (at your option) any later version.
This library 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
IBM Common Public License for more details.
You should have received a copy of the IBM Common Public
License along with this library
*/
#pragma endregion // CPL License
#ifndef NUCLEX_STORAGE_FILESYSTEM_LINUX_LINUXDIRECTORYCONTAINER_H
#define NUCLEX_STORAGE_FILESYSTEM_LINUX_LINUXDIRECTORYCONTAINER_H
#include "Nuclex/Storage/Config.h"
#if defined(NUCLEX_STORAGE_LINUX)
#include "Nuclex/Storage/FileSystem/Container.h"
namespace Nuclex { namespace Storage { namespace FileSystem { namespace Linux {
  // ------------------------------------------------------------------------------------------- //
  /// Container that represents a real directory in the file system
  class LinuxDirectoryContainer : public Container {
    /// Initializes a new container for a file system directory
    /// Absolute path to the directory in the file system
    public: LinuxDirectoryContainer(const std::string &absolutePath);
    /// Frees all resources owned by the directory container
    public: virtual ~LinuxDirectoryContainer() = default;
    /// Returns the name of the container
    /// The container's name
    public: const std::string &GetName() const override { return this->name; }
    /// Returns the path the container is stored at in the native format
    /// The container's absolute path in the native OS format
    public: virtual const std::string &GetNativePath() const override {
      return this->absolutePath;
    }
    /// Creates a list of all directories below this directory
    /// Wild card by which to filter the enumerated directories
    /// A list of all directories below this one
    public: std::vector EnumerateContainers(
      const std::string &wildcard = u8"*"
    ) const override;
    /// Creates a list of all files in this directory
    /// Wild card by which to filter the enumerated files
    /// A list of all files in this directory
    public: std::vector EnumerateFiles(
      const std::string &wildcard = u8"*"
    ) const override;
    /// Accesses a sub-container within this container
    /// Name of the sub-container that will be accessed
    /// The sub-container with the specified name
    public: std::shared_ptr AccessContainer(const std::string &name) override;
    /// Accesses a sub-container within this container
    /// Name of the sub-container that will be accessed
    /// The sub-container with the specified name
    public: std::shared_ptr AccessContainer(
      const std::string &name
    ) const override;
    /// Absolute path of the directory in the actual file system
    private: std::string absolutePath;
    /// Name of the container
    private: mutable std::string name;
  };
  // ------------------------------------------------------------------------------------------- //
}}}} // namespace Nuclex::Storage::FileSystem::Linux
#endif // defined(NUCLEX_STORAGE_LINUX)
#endif // NUCLEX_STORAGE_FILESYSTEM_LINUX_LINUXDIRECTORYCONTAINER_H