Skip to main content
Pointer to a project location. #include "Iterator.hpp"

Public Member Functions

Protected Attributes

Detailed Description

Pointer to a project location. An Iterator is a pointer to a project location, the location might be null, invalid or to a good object. The Iterator contains a Error message, functions returning an Iterator as return value might fill the Iterator with the error message indicating the failure.
The Iterator can be used to execute actions on the pointed object. The Iterator has a base type ( getType() = PIFile, PIFolder, PILink ) and only suitable actions to the target type can be executed, type mismatch or the use of an empty iterator will return an error , error iterator or some default/empty state

Constructor & Destructor Documentation

Iterator() [1/3]

Null iterator contructor (ok() is false)

Iterator() [2/3]

Error iterator constructor (ok() is false, error message provided) Parameters

Iterator() [3/3]

Member Function Documentation

accept()

asItem()

clearChecksum()

Clear the stored checksum value for the pointed file.

computeChecksum()

Compute a checksum for the stored file.

find()

Execute a Query onto the current Iterator.
  • pQuery Search query to be executed
  • pFollowSymlink true if the query should go through links or ignore them
Returns The list of Iterator matching the query, empty vector if none.

get()

Folder - return child sub-item at specified Path.

getByURL()

Folder - check if a child points to the specified URL. Parameters

getChild()

Folder - return child item by specified name.

getChildList()

Folder - return list of children Iterator.

getChildListOfSubclass()

Folder - return list of children Iterator of matching subclass. Will also traverse subproject links automatically

getChildNames()

Folder - return list of children names.

getError()

Return the error state of an invalid iterator. An null iteration might not have an error state.

getFolderOtherURLSubItems()

Folder - return list of files in the folder URL, unknown by the project. Only works if the folder URL is accessible.

getFullURL()

File/Folder - returns the absolute, including the project location - if suitable.

getMeta() [1/2]

Returns the Metadata for this project item. The Metadata object can be modified and the changes will be stored in the project. If the iterator is not valid, any changes to the Metadata are ignored and lost.

getMeta() [2/2]

Returns a constant reference to the Metadata for this project item. The Metadata object cannot be modified If the iterator is not valid, the returned Metadata is empty

getName()

Name of the project item (might differ from URL filename)

getParent()

Return the iterator to the parent folder. Returns null iterator in error, or the current iterator is the parent folder of the project already.

getParentOfSubclass()

Go up in the chain of parent and search for matching getSubclass()

getParentOfType()

Go up in the chain of parent and search for matching getTypeAsString()

getPath()

Return the item full Path in the project. The Path in the project is a global path starting by / and identifying components by their project Name (the project Path might differ from the filesystem URL, or might refer to folders/files which only exist in the project index, and not on disk)

getProjectId()

Return the unique project ID for this iterator. Permits to check if an iterator is from a specific project. The project ID might differ across different executions.

getRuntimeMeta() [1/2]

Returns a reference to the runtime Metadata. The runtime Metadata is a second Metadata storage, which contains values which are not saved in the project.

getRuntimeMeta() [2/2]

Constant version of getRuntimeMeta()

getStoredChecksum()

Get the stored checksum for the file, can be used to compare with the current computeChecksum()

getSubclass()

Return name of the subclass (if any) for the item. See Simulation , Run , Output , Result , etc.

getTarget()

Link - Return the Iterator of the link target.

getTargetStr()

getType()

Return the project item type as a PItemType enum.

getTypeAsString()

Return the project item type as a string.

getURL()

File/Folder - returns the URL pointed by this item. See setURL(const URL&)

getURLFromRoot()

File/Folder - returns the relative URL as computed from the root of the project.

isFile()

True if the -valid- pointed object is a File. Checks if the iterator points to an item of the File type in the project index. It might be a project only file or an actual file on disk. See getURL() and urlExists()

isFolder()

True if the -valid- pointed object is a Folder. Checks if the iterator points to an item of the Folder type in the project index. It might be a project only file or an actual file on disk. See getURL() and urlExists()

isLink()

True if the -valid- pointed object is a Link. Checks if the iterator points to an item of the Link type This is a project-level Link concept created by newLink()

isPropertyTree()

isReadOnly()

Indicates if the target project or location is read-only. All iterators of a read-only project are read-only, many iterator actions will have no effect or fail on a read-only project.

isSubProject()

Link - Indicates if this is a link to a subproject. If the link target is not ok() means the subproject is not loaded.

isURLEditable()

Indicates if the URL is ok to be modified by the user. Two items affect this suggested state:
  • URL are not editable by default is a managed project, are editable by default in a free-storage project
  • The runtime metadata ‘url-editable’ can be set on the iterator, or any parent folder, to 0 or 1

moveTo()

Iterator - move from current folder to a target folder. This is a project only operation, URL and disk data need to be udpated separately (Storage::moveFile()) Parameters

newFile() [1/2]

Creates a new project-only file at this location in the project. A project-only file is not created in the disk storage, its only stored in the project index. Will fail if : name already in use, target iterator is not a folder, read-only project, etc.
  • pName Name of the new project file in project Path

newFile() [2/2]

Creates a new file associated with disk storage. If pURL is empty, the existing URL name is assumed the same as the pName argument If pImport is enabled, the source URL is copied in the project folder
  • pName Name of the new project file in project Path
  • pURL URL of the file location
  • pImport true if this is an import operation

newFolder() [1/2]

Creates a new project-only folder at this location in the project. A project-only folder is not created in the disk storage, its only stored in the project index. Will fail if : name already in use, target iterator is not a folder, read-only project, etc.
  • pName Name of the new project folder in project Path

newFolder() [2/2]

Creates a new folder associated with disk storage. If URL is empty, and the project is managed, a new folder is created in the filesystem storage of the project.
If the project is free-storage, an empty URL will create a project-only folder similar to newFolder(const std::string&);
  • pName Name of the new project folder in project Path
  • pURL URL of the folder location

newLink()

Create a project-level symbolic link.

newPropertyTree()

ok()

True if the iterator points to a valid location in the project.

operator!=()

inline

operator<()

inline

operator==()

True if the two iterators point to the same target. Invalid/error iterator will always be unequal to another iterator

removeItem()

Folder - remove an item from the folder. Not erased from storage. Parameters

rename()

Rename the project item.

setError()

Set an error state in the Iterator. Will make it invalid (!ok())

setTarget()

Link - Change the Iterator of the link target.

setURL()

File/Folder - set the URL pointed by this item. The URL can either be relative ( ”./filename” ), and is then assumed to be in the enclosing folder URL. The URL can also be absolute, and is not tied to the location of the enclosing folder.

urlExists()

File/Folder - indicates if the item URL points to a valid/accessible file/folder.

Member Data Documentation

aError

protected

aRef

protected