Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Review #1

Merged
merged 1 commit into from
Apr 14, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions source/cppfs/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ set(headers
${include_path}/Tree.h
${include_path}/Diff.h
${include_path}/Change.h
${include_path}/units.h

${include_path}/${localfs}/LocalFileSystem.h
${include_path}/${localfs}/LocalFileHandle.h
Expand Down
9 changes: 9 additions & 0 deletions source/cppfs/include/cppfs/AbstractFileSystem.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,15 @@ class CPPFS_API AbstractFileSystem
* Path to file or directory
*/
virtual FileHandle open(const std::string & path) = 0;

/**
* @brief
* Open file or directory in file system
*
* @param[in] path
* Path to file or directory
*/
virtual FileHandle open(std::string && path) = 0;
};


Expand Down
31 changes: 30 additions & 1 deletion source/cppfs/include/cppfs/Change.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,17 @@ class CPPFS_API Change
*/
Change(Operation operation, const std::string & path);

/**
* @brief
* Constructor
*
* @param[in] operation
* Operation type
* @param[in] path
* Path on which the operation takes place
*/
Change(Operation operation, std::string && path);

/**
* @brief
* Copy constructor
Expand All @@ -59,6 +70,15 @@ class CPPFS_API Change
*/
Change(const Change & change);

/**
* @brief
* Move constructor
*
* @param[in] change
* Other change
*/
Change(Change && change);

/**
* @brief
* Destructor
Expand All @@ -74,6 +94,15 @@ class CPPFS_API Change
*/
Change & operator=(const Change & change);

/**
* @brief
* Move operator
*
* @param[in] change
* Other change
*/
Change & operator=(Change && change);

/**
* @brief
* Get string representation of the change
Expand All @@ -99,7 +128,7 @@ class CPPFS_API Change
* @return
* Path on which the operation takes place
*/
std::string path() const;
const std::string & path() const;


protected:
Expand Down
30 changes: 30 additions & 0 deletions source/cppfs/include/cppfs/Diff.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@


#include <vector>
#include <iosfwd>

#include <cppfs/Change.h>

Expand Down Expand Up @@ -54,6 +55,15 @@ class CPPFS_API Diff
*/
void add(const Change & change);

/**
* @brief
* Add change
*
* @param[in] change
* Change
*/
void add(Change && change);

/**
* @brief
* Add change
Expand All @@ -65,6 +75,26 @@ class CPPFS_API Diff
*/
void add(Change::Operation operation, const std::string & path);

/**
* @brief
* Add change
*
* @param[in] operation
* Operation type
* @param[in] path
* Path on which the operation takes place
*/
void add(Change::Operation operation, std::string && path);

/**
* @brief
* Print changes to stream
*
* @param[in] stream
* The output stream
*/
void print(std::ostream & stream);

/**
* @brief
* Print changes to console
Expand Down
11 changes: 10 additions & 1 deletion source/cppfs/include/cppfs/FileHandle.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@


#include <memory>
#include <ios>
#include <functional>
#include <vector>
#include <string>
#include <iostream>

#include <cppfs/cppfs_api.h>

Expand Down Expand Up @@ -95,6 +95,15 @@ class CPPFS_API FileHandle
*/
FileHandle & operator=(const FileHandle & fileHandle);

/**
* @brief
* Move operator
*
* @param[in] fileHandle
* Source handle
*/
FileHandle & operator=(FileHandle && fileHandle);

/**
* @brief
* Get path
Expand Down
21 changes: 15 additions & 6 deletions source/cppfs/include/cppfs/FilePath.h
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,15 @@ class CPPFS_API FilePath
*/
void setPath(const std::string & path);

/**
* @brief
* Set path
*
* @param[in] path
* File path
*/
void setPath(std::string && path);

/**
* @brief
* Get native path as string
Expand Down Expand Up @@ -189,7 +198,7 @@ class CPPFS_API FilePath
* If you want trailing separators to remain in the string, use path().
* Calling this function triggers a full analysis of the path (costly operation).
*/
std::string fullPath() const;
const std::string & fullPath() const;

/**
* @brief
Expand All @@ -203,7 +212,7 @@ class CPPFS_API FilePath
* "/path/to/something.ex/".
* Calling this function triggers a full analysis of the path (costly operation).
*/
std::string fileName() const;
const std::string & fileName() const;

/**
* @brief
Expand All @@ -217,7 +226,7 @@ class CPPFS_API FilePath
* "/path/to/something.ex/".
* Calling this function triggers a full analysis of the path (costly operation).
*/
std::string baseName() const;
const std::string & baseName() const;

/**
* @brief
Expand All @@ -232,7 +241,7 @@ class CPPFS_API FilePath
* string is returned.
* Calling this function triggers a full analysis of the path (costly operation).
*/
std::string extension() const;
const std::string & extension() const;

/**
* @brief
Expand All @@ -246,7 +255,7 @@ class CPPFS_API FilePath
* "/path/to/directory" and "/path/to/directory/".
* Calling this function triggers a full analysis of the path (costly operation).
*/
std::string directoryPath() const;
const std::string & directoryPath() const;

/**
* @brief
Expand All @@ -259,7 +268,7 @@ class CPPFS_API FilePath
* If there is no drive letter (Linux, Mac), an empty string is returned.
* Calling this function triggers a full analysis of the path (costly operation).
*/
std::string driveLetter() const;
const std::string & driveLetter() const;

/**
* @brief
Expand Down
15 changes: 13 additions & 2 deletions source/cppfs/include/cppfs/LoginCredentials.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ class CPPFS_API LoginCredentials
* @return
* Reference to this value
*/
LoginCredentials & operator=(const LoginCredentials && loginCredentials);
LoginCredentials & operator=(LoginCredentials && loginCredentials);

/**
* @brief
Expand Down Expand Up @@ -125,7 +125,7 @@ class CPPFS_API LoginCredentials
* @return
* Value for key, "" if key does not exist
*/
std::string value(const std::string & key) const;
const std::string & value(const std::string & key) const;

/**
* @brief
Expand All @@ -138,6 +138,17 @@ class CPPFS_API LoginCredentials
*/
void setValue(const std::string & key, const std::string & value);

/**
* @brief
* Set value for key
*
* @param[in] key
* Key
* @param[in] value
* Value for key
*/
void setValue(const std::string & key, std::string && value);


protected:
std::map<std::string, std::string> m_values; ///< Key/value pairs
Expand Down
33 changes: 30 additions & 3 deletions source/cppfs/include/cppfs/Tree.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class CPPFS_API Tree
* empty (""), the path of the first-order child elements
* will equal their filenames, etc.
*/
std::string path() const;
const std::string & path() const;

/**
* @brief
Expand All @@ -70,14 +70,23 @@ class CPPFS_API Tree
*/
void setPath(const std::string & path);

/**
* @brief
* Set path
*
* @param[in] path
* Path to file or directory
*/
void setPath(std::string && path);

/**
* @brief
* Get filename
*
* @return
* Filename
*/
std::string fileName() const;
const std::string & fileName() const;

/**
* @brief
Expand All @@ -88,6 +97,15 @@ class CPPFS_API Tree
*/
void setFileName(const std::string & filename);

/**
* @brief
* Set filename
*
* @param[in] filename
* Filename
*/
void setFileName(std::string && filename);

/**
* @brief
* Check if item is a file
Expand Down Expand Up @@ -230,7 +248,7 @@ class CPPFS_API Tree
* @return
* SHA1 hash
*/
std::string sha1() const;
const std::string & sha1() const;

/**
* @brief
Expand All @@ -241,6 +259,15 @@ class CPPFS_API Tree
*/
void setSha1(const std::string & hash);

/**
* @brief
* Set sha1 hash
*
* @param[in] hash
* SHA1 hash
*/
void setSha1(std::string && hash);

/**
* @brief
* List files in directory
Expand Down
Loading