#pragma region CPL License
/*
Nuclex Native Framework
Copyright (C) 2002-2013 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_LINUXCONTAINER_H
#define NUCLEX_STORAGE_FILESYSTEM_LINUXCONTAINER_H
#include "Nuclex/Storage/Config.h"
#if defined(NUCLEX_STORAGE_LINUX)
#include "Nuclex/Storage/FileSystem/Container.h"
namespace Nuclex { namespace Storage { namespace FileSystem {
// ------------------------------------------------------------------------------------------- //
/// Directory on a Linux system
class LinuxContainer : public Container {
/// Smart pointer to a constant container
private: typedef std::shared_ptr ConstContainerPointer;
/// Smart pointer to a container
private: typedef std::shared_ptr ContainerPointer;
/// Smart pointer to a constant file
private: typedef std::shared_ptr ConstFilePointer;
/// Smart pointer to a file
private: typedef std::shared_ptr FilePointer;
/// A vector of strings
private: typedef std::vector StringVector;
/// Initializes a new windows container
/// Codecs used to open files as containers
/// Absolute path of the directory
public: LinuxContainer(
const std::shared_ptr &codecs,
const std::string &absolutePath
);
/// Destroys the container interface
public: virtual ~LinuxContainer();
/// Returns the name of the file
/// The file's name
public: const std::string &GetName() const { return this->name; }
/// Returns the path the file is stored at in the native format
/// The file's absolute path in the native OS format
public: const std::string &GetNativePath() const { return this->path; }
/// Retrieves a list of the containers located in this container
/// Wildcard of the containers to list
/// A list of all containers matching the wildcard
public: std::vector GetContainers(
const std::string &wildcard = std::string()
) const;
/// Retrieves a list of the containers located in this container
/// Wildcard of the containers to list
/// A list of all containers matching the wildcard
public: virtual std::vector GetContainers(
const std::string &wildcard = std::string()
);
/// Retrieves the container with the specified name
/// Name of the container that will be retrieved
/// The container with the specified name
public: virtual ConstContainerPointer GetContainer(const std::string &name) const;
/// Retrieves the container with the specified name
/// Name of the container that will be retrieved
/// The container with the specified name
public: virtual ContainerPointer GetContainer(const std::string &name);
/// Checks if the container contains the specified child container
/// Child container the container will be checked for
/// True if the container has a child container with the specified name
public: virtual bool HasContainer(const std::string &name) const;
/// Creates a new container in this container
/// Name of the created container
/// The created container
public: virtual ContainerPointer CreateContainer(const std::string &name);
/// Deletes a container in this container
/// Name of the deleted container
public: virtual void DeleteContainer(const std::string &name);
/// Retrieves a list of the files located in this container
/// Wildcard of the files to list
/// A list of all files matching the wildcard
public: virtual std::vector GetFiles(
const std::string &wildcard = std::string()
) const;
/// Retrieves a list of the files located in this container
/// Wildcard of the files to list
/// A list of all files matching the wildcard
public: virtual std::vector GetFiles(
const std::string &wildcard = std::string()
);
/// Retrieves the file with the specified name
/// Name of the file that will be retrieved
/// The file with the specified name
public: virtual ConstFilePointer GetFile(const std::string &name) const;
/// Retrieves the file with the specified name
/// Name of the file that will be retrieved
/// The file with the specified name
public: virtual FilePointer GetFile(const std::string &name);
/// Checks if the container contains the specified file
/// File the container will be checked for
/// True if the container contains a file with the specified name
public: virtual bool HasFile(const std::string &name) const;
/// Retrieves the file with the specified name
/// Name of the file that will be retrieved
/// The file with the specified name
public: virtual FilePointer CreateFile(const std::string &name);
/// Deletes the file with the specified name
/// Name of the file that will be deleted
public: virtual void DeleteFile(const std::string &name);
/// Absolute path of the directory
private: std::string path;
/// The directory's name
private: std::string name;
};
// ------------------------------------------------------------------------------------------- //
}}} // namespace Nuclex::Storage::FileSystem
#endif // defined(NUCLEX_STORAGE_LINUX)
#endif // NUCLEX_STORAGE_FILESYSTEM_LINUXCONTAINER_H