MarcoObject

public protocol MarcoObject : MarcoValue

Marco object value.

  • Element count.

    Declaration

    Swift

    var count: Int { get }
  • All value keys.

    Declaration

    Swift

    var keys: [String] { get }
  • subscript(_:) Default implementation

    Returns an element for a specified key.

    Default Implementation

    Returns an element with a specified key sequence.

    Returns an element with a specified key sequence.

    Declaration

    Swift

    subscript(key: String) -> MarcoValue? { get set }
  • Returns a key identifier for a specified key.

    Declaration

    Swift

    func identifier(key: String) -> MarcoIdentifier?
  • Removes an element with a specified key.

    Declaration

    Swift

    @discardableResult
    func remove(for key: String) -> Bool
  • isEmpty Extension method

    True if the object is empty.

    Declaration

    Swift

    public var isEmpty: Bool { get }
  • isNotEmpty Extension method

    True if the object is not empty.

    Declaration

    Swift

    public var isNotEmpty: Bool { get }
  • elements Extension method

    Returns all elements. The new array instance will be created.

    Declaration

    Swift

    public var elements: [String : MarcoValue] { get }
  • forEach(_:) Extension method

    Iterates over all elements.

    Declaration

    Swift

    public func forEach(_ body: (String, MarcoValue) throws -> ()) rethrows
  • all(predicate:) Extension method

    Returns true if predicate returns true for all elements.

    Declaration

    Swift

    public func all(predicate: (String, MarcoValue) throws -> Bool) rethrows -> Bool
  • none(predicate:) Extension method

    Returns true if predicate returns false for all elements.

    Declaration

    Swift

    public func none(predicate: (String, MarcoValue) throws -> Bool) rethrows -> Bool
  • any(predicate:) Extension method

    Returns true if predicate returns true at least for one element.

    Declaration

    Swift

    public func any(predicate: (String, MarcoValue) throws -> Bool) rethrows -> Bool
  • sequence() Extension method

    Returns a Sequence representation of the object.

    Declaration

    Swift

    public func sequence() -> MarcoObjectSequence
  • accept(_:data:) Extension method

    Declaration

    Swift

    public func accept<V, D, R>(_ visitor: V, data: D) -> R where V : MarcoVisitor, D == V.Data, R == V.ReturnType