Class sh::filesystem::ModelBackedFilesystemNodeList

class sh::filesystem::ModelBackedFilesystemNodeList : public sh::filesystem::FilesystemNodeList

This FilesystemNodeList subclass builds a part of the filesystem model.

The listed nodes are actually owned and handled by a sh::filesystem::FilesystemNode. Node additions and removals will directly influence the model.

Public Functions

ModelBackedFilesystemNodeList(sh::filesystem::FilesystemNode *node)

Constructed only internally.

void addItems(QSet<std::shared_ptr<FilesystemNode>> nodes)
void addItem(std::shared_ptr<FilesystemNode> node)
void removeItems(QSet<std::shared_ptr<FilesystemNode>> nodes)
void removeItem(std::shared_ptr<FilesystemNode> node)
void resetItems(sh::filesystem::FilesystemNodeType type, QSet<std::shared_ptr<FilesystemNode>> nodes)
std::shared_ptr<FilesystemNode> mynode()

Returns the node which owns this children list. The result may be 0 for non model-backed lists.

void clear()

Clears the entire list. This is not a high-level operation, but something only used internally (not part of the interface).

void addPermanentItem(std::shared_ptr<sh::filesystem::FilesystemNode> node)

Adds an item to this list. In a model-backed list, this triggers the internal model mounting calls. It is not allowed to call this method twice with the same node.

This list is safe against removing from later item lists. Only removePermanentItem removes it. See also addItem.

void removePermanentItem(std::shared_ptr<sh::filesystem::FilesystemNode> node)

Removes a permanent node from this list. In a model-backed list, this triggers the internal model unmounting calls. It is not allowed to call this method with a node, which is not contained in that list.

void addItems(QSet<std::shared_ptr<sh::filesystem::FilesystemNode>> nodes) = 0

Adds items to this list. In a model-backed list, this triggers the internal model mounting calls. It is not allowed to call this method twice with the same node.

void addItem(std::shared_ptr<sh::filesystem::FilesystemNode> node) = 0

Adds an item to this list. In a model-backed list, this triggers the internal model mounting calls. It is not allowed to call this method twice with the same node.

void removeItems(QSet<std::shared_ptr<sh::filesystem::FilesystemNode>> nodes) = 0

Removes nodes from this list. In a model-backed list, this triggers the internal model unmounting calls. It is not allowed to call this method with a node, which is not contained in that list.

void removeItem(std::shared_ptr<sh::filesystem::FilesystemNode> node) = 0

Removes a node from this list. In a model-backed list, this triggers the internal model unmounting calls. It is not allowed to call this method with a node, which is not contained in that list.

void resetItems(sh::filesystem::FilesystemNodeType type, QSet<std::shared_ptr<sh::filesystem::FilesystemNode>> nodes) = 0

Resets the list for a given node type to a given new list of children nodes.

bool contains(std::shared_ptr<FilesystemNode> node)

Checks if this list contains a given node.

const QList<std::shared_ptr<sh::filesystem::FilesystemNode>> *nodes()

Returns the list of nodes currently stored in this instance.

Private Functions

void addItem_helper(std::shared_ptr<sh::filesystem::FilesystemNode> node)

Private Members

QSet<sh::filesystem::FilesystemNode*> _permanentnodes
sh::filesystem::FilesystemNode *_mynode
sh::filesystem::FilesystemModel *mymodel