ZDCTreesystemPath

@interface ZDCTreesystemPath : NSObject <NSCoding, NSCopying>

ZDCTreesystemPath is a standardized class for storing paths to nodes in the tree.

For more information about the ZeroDark.cloud treesystem, check out the docs:

  • Constructs a path from the given components in the home container.

    For example, if the string based representation of the path is /foo/bar, then you’d pass in [foo, bar].

    Declaration

    Objective-C

    - (nonnull instancetype)initWithPathComponents:
        (nonnull NSArray<NSString *> *)pathComponents;

    Swift

    init(pathComponents: [String])

    Parameters

    pathComponents

    The ordered list of pathComponents, with the destination node being the last item in the array.

  • Creates a path with the given components in the given trunk.

    For example, if the string based representation of the path is /foo/bar, then you’d pass in [foo, bar].

    Declaration

    Objective-C

    - (nonnull instancetype)initWithPathComponents:
                                (nonnull NSArray<NSString *> *)pathComponents
                                             trunk:(ZDCTreesystemTrunk)trunk;

    Swift

    init(pathComponents: [String], trunk: ZDCTreesystemTrunk)

    Parameters

    pathComponents

    The ordered list of pathComponents, with the destination node being the last item in the array.

    trunk

    The specific trunk for the node. For most nodes, this is the home trunk (ZDCTreesystemTrunk_Home).

  • The trunk (top-level root node) in which the path is rooted. Typically this is home, which is the primary trunk for the user’s data.

    Declaration

    Objective-C

    @property (readonly, assign, nonatomic) ZDCTreesystemTrunk trunk;

    Swift

    var trunk: ZDCTreesystemTrunk { get }
  • An array of node-names, leading from the container node to the target node.

    Declaration

    Objective-C

    @property (readonly, copy, nonatomic)
        NSArray<NSString *> *_Nonnull pathComponents;

    Swift

    var pathComponents: [String] { get }
  • Returns the name of the target node. In other words, this method returns the last item in the pathComponents array.

    Declaration

    Objective-C

    @property (readonly, nonatomic) NSString *_Nonnull nodeName;

    Swift

    var nodeName: String { get }
  • Returns YES if the path represents the root node (i.e. the trunk itself). That is, the pathComponents array is empty.

    Declaration

    Objective-C

    @property (readonly, nonatomic) BOOL isTrunk;

    Swift

    var isTrunk: Bool { get }
  • Returns the pathComponents, joined using the separator ‘/’. For example: /foo/bar/buzz

    The path is relative to it’s container, which is not specified in the string.

    Note

    This method is a convenience method primarily intended for debugging. You are discouraged from treating paths as strings because names are allowed to contain any character, which includes the traditional separator ‘/’. This method does nothing to protect against this possibility.

    Declaration

    Objective-C

    - (nonnull NSString *)relativePath;

    Swift

    func relativePath() -> String
  • Returns the container, plus the relativePath. For example: home:/foo/bar/buzz

    Note

    This method is a convenience method primarily intended for debugging. You are discouraged from treating paths as strings because names are allowed to contain any character, which includes the traditional separator ‘/’. This method does nothing to protect against this possibility.

    Declaration

    Objective-C

    - (nonnull NSString *)fullPath;

    Swift

    func fullPath() -> String
  • Returns the parent’s path by removing the last item from the pathComponents array. If the pathComponents array is empty (i.e. isTrunk == true), then this method returns nil.

    This method does not modify the receiver.

    Declaration

    Objective-C

    - (nullable ZDCTreesystemPath *)parentPath;

    Swift

    func parent() -> ZDCTreesystemPath?
  • Returns a new path instance with the given component appended to the end.

    Declaration

    Objective-C

    - (nonnull ZDCTreesystemPath *)pathByAppendingComponent:
        (nonnull NSString *)pathComponent;

    Swift

    func appendingComponent(_ pathComponent: String) -> ZDCTreesystemPath