#include <Node.h>
 
  
 | Public Types | |
| enum | Type { root = 0, folder, file } | 
| enum | MediaType { audio = 0, document, video, image, unknown, folder } | 
| enum | MergePolicy { override = 0, ignore, renameSource, renameDest } | 
| typedef std::unique_ptr < std::pair< std::unique_ptr < Sha1Calculator >, pplx::task < std::shared_ptr < FileUploader > > > > | UploadingFile | 
| Public Member Functions | |
| Node (Node &&)=default | |
| Node & | operator= (Node &&)=default | 
| Node (const Node &rhs) | |
| Node & | operator= (const Node &rhs) | 
| const std::string & | id () const | 
| Type | type () const | 
| const utility::string_t & | name () const | 
| const std::string & | parentId () const | 
| const std::vector< std::string > & | ancestors () const | 
| uint64_t | ownerId () const | 
| std::chrono::system_clock::time_point | creationDate () const | 
| std::chrono::system_clock::time_point | lastUpdateDate () const | 
| uint64_t | nbChildren () const | 
| uint64_t | nbFiles () const | 
| uint64_t | size () const | 
| virtual const std::vector < std::unique_ptr< Node > > & | getChildren () const =0 | 
| Load the children node if needed then return them. The children nodes are stored in a local cache variable.  More... | |
| virtual FolderNode & | addChildFolder (const utility::string_t &name)=0 | 
| Create a new FolderNode and add it to the children list.  More... | |
| virtual FolderNode | createChildFolder (const utility::string_t &name) const =0 | 
| Create a new FolderNode (Do not add it to the local children list)  More... | |
| virtual UploadingFile | uploadFile (const boost::filesystem::path &filepath, pplx::cancellation_token_source cts=pplx::cancellation_token_source{})=0 | 
| Upload a file into this FolderNode.  More... | |
| virtual FileDownloader | download (const utility::string_t &destinationPath, FileDownloader::Policy policy=FileDownloader::Policy::ignore)=0 | 
| Download a FileNode.  More... | |
| virtual const FileNodeData & | fileData () const =0 | 
| Get the data associated with a FileNode.  More... | |
| void | remove () | 
| Remove this node. Set its id to ""More... | |
| const utility::string_t & | rename (const utility::string_t &name) | 
| Rename this node.  More... | |
| std::unique_ptr< core::Node > | copyTo (const FolderNode &node, MergePolicy policy=MergePolicy::renameSource) const | 
| Shortcut for copyOrMoveTo(const FolderNode&, false, MergePolicy) | |
| std::unique_ptr< core::Node > | moveTo (const FolderNode &node, MergePolicy policy=MergePolicy::renameSource) const | 
| Shortcut for copyOrMoveTo(const FolderNode&, bool, MergePolicy) | |
| std::unique_ptr< core::Node > | copyOrMoveTo (const FolderNode &node, bool isMove, MergePolicy policy=MergePolicy::renameSource) const | 
| Copy or move a node.  More... | |
| const std::shared_ptr< data::Node > | handle () const | 
| Static Public Member Functions | |
| static std::unique_ptr< Node > | create (std::shared_ptr< data::Node > n, const Application &app) | 
| static std::unique_ptr< Node > | create (const Node &node) | 
| Static Public Attributes | |
| static const utils::EnumConvertor < core::Node::Type, 3 > | typeCvrt | 
| static const utils::EnumConvertor < MediaType, 6 > | mediaTypeCvrt | 
| static const utils::EnumConvertor < MergePolicy, 4 > | mergePolicyCvrt | 
| Protected Member Functions | |
| Node (std::shared_ptr< data::Node > n, const Application &app) | |
| Protected Attributes | |
| std::shared_ptr< data::Node > | _data | 
| const Application * | _app | 
Detailed Description
The class Node represents a file or a folder. It is the base class of a composite pattern, with the FileNode and FolderNode classes. 
Member Enumeration Documentation
| 
 | strong | 
The MergePolicy is used when inserting / uploading / copying / moving files and folders. It dictate what to do when there is a name conflict between 2 files / folders.
The possible values are :
- override: Override the destination file with the file being copied/moved/...
- ignore: Ignore the copy/move/... and keep the destination file
- renameSource: Rename the file being copied/moved/... before inserting it.
- renameDest: Rename the conflicting file in the destination folder before inserting the new file.
The way the mergePolicy is applied is different whether it's applied on files or folders:
| Destination: File | Destination: Folder | |
|---|---|---|
| Source: File | Use policy (Ignore on same files)₁ | Use policy (renameSource on override)₂ | 
| Source: Folder | Use policy (renameSource on override)₂ | Always merge the 2 folders.₃ | 
- 1) If the 2 files are the same, the specified policy is ignored, and ignorepolicy is used instead. If the 2 files are different, the policy is used as specified.
- 2) When there is a folder/file or file/folder conflict, even if the overridepolicy is specified, no file/folder gets overridden. In this case, therenameSourcepolicy is used instead of theoverridepolicy
- 3) When there is a folder/folder conflict, the policy is ignored, and the 2 folder are merged together.
Member Function Documentation
| 
 | pure virtual | 
Create a new FolderNode and add it to the children list.
- Returns
- The new FolderNode
- Exceptions
- 
  HttpError 
Implemented in giga::core::FileNode, and giga::core::FolderNode.
| std::unique_ptr< core::Node > giga::core::Node::copyOrMoveTo | ( | const FolderNode & | node, | 
| bool | isMove, | ||
| MergePolicy | policy = MergePolicy::renameSource | ||
| ) | const | 
Copy or move a node.
- If thisis a file andnodecontains a file with the same name, thepolicyis used
- If thisis a folder andnodecontains a folder with the same name, the two folders will be merged..
- For more information on merge policy see giga::core::Node::MergePolicy
The copy/move operation is a long lasting operation (more than 1s). The operation will timeout after 465 seconds
- Parameters
- 
  node is the destination folder. You may want to reload node(usesApplication::getNodeById())isMove true for a move, false for a copy policy the merge policy is used when there are name conflicts. 
- Returns
- the copied or move node (this node should not be used after being moved)
| 
 | pure virtual | 
Create a new FolderNode (Do not add it to the local children list)
- Returns
- The new FolderNode
- Exceptions
- 
  HttpError 
Implemented in giga::core::FileNode, and giga::core::FolderNode.
| 
 | pure virtual | 
Download a FileNode.
- Parameters
- 
  destinationPath a path to a folder where the FileNode will be downloaded policy what to do if the file already exists at destinationPath
- Returns
- A FileDownloader to control the download.
- Exceptions
- 
  ErrorException if this node is a FolderNode 
- See Also
- Downloader to download folders.
Implemented in giga::core::FileNode, and giga::core::FolderNode.
| 
 | pure virtual | 
Get the data associated with a FileNode.
- Exceptions
- 
  ErrorException if this node is a FolderNode 
Implemented in giga::core::FileNode, and giga::core::FolderNode.
| 
 | pure virtual | 
Load the children node if needed then return them. The children nodes are stored in a local cache variable.
- Returns
- The list of children nodes
- Exceptions
- 
  HttpError 
Implemented in giga::core::FileNode, and giga::core::FolderNode.
| void giga::core::Node::remove | ( | ) | 
Remove this node. Set its id to "" 
- Exceptions
- 
  HttpError 
| const utility::string_t & giga::core::Node::rename | ( | const utility::string_t & | name | ) | 
Rename this node.
The new name may be different from the name parameter (some characters may be changed to have a valid filename).
- Parameters
- 
  name must not exceed 255 chars 
- Returns
- The new name.
- Exceptions
- 
  HttpError ErrorException if the name is not valid. 
| 
 | pure virtual | 
Upload a file into this FolderNode.
- Parameters
- 
  filepath the path to the file to upload 
- Returns
- A FileUploader object to control the upload.
- Exceptions
- 
  ErrorException if this node is a FileNode. 
- See Also
- Uploader to upload folders.
Implemented in giga::core::FileNode, and giga::core::FolderNode.
Member Data Documentation
| 
 | static | 
| 
 | static | 
| 
 | static | 
The documentation for this class was generated from the following files:
- /home/thomas/code/GiGaSdk/src/giga/core/Node.h
- /home/thomas/code/GiGaSdk/src/giga/core/Node.cpp
 1.8.6
 1.8.6