MarcoValue
public protocol MarcoValue : AnyObject, CustomStringConvertible
Marco value.
-
Element offset in a parent. Call
MarcoDocument.updateOffsets()to initialize this property.Declaration
Swift
var offset: Int { get } -
Element range.
Declaration
Swift
var range: ClosedRange<Int> { get } -
Value text.
Declaration
Swift
var text: String { get } -
Pass this element to the given
visitor.Declaration
Swift
func accept<V, D, R>(_ visitor: V, data: D) -> R where V : MarcoVisitor, D == V.Data, R == V.ReturnType
-
asObjectExtension methodSafely casts this value to an object value.
Declaration
Swift
public var asObject: MarcoObject? { get } -
asArrayExtension methodSafely casts this value to an array value.
Declaration
Swift
public var asArray: MarcoArray? { get } -
asStringLiteralExtension methodSafely casts this value to a string value.
Declaration
Swift
public var asStringLiteral: MarcoStringLiteral? { get } -
asStringExtension methodSafely casts this value to an string value, and returns the backing
Stringif the cast was successful.Declaration
Swift
public var asString: String? { get } -
asStringOrEmptyExtension methodSafely casts this value to an string value, and returns the backing
Stringif the cast was successful. Returns an empty String otherwise.Declaration
Swift
public var asStringOrEmpty: String { get } -
asNumberLiteralExtension methodSafely casts this value to a number value.
Declaration
Swift
public var asNumberLiteral: MarcoNumberLiteral? { get } -
asIntLiteralExtension methodSafely casts this value to a integer value.
Declaration
Swift
public var asIntLiteral: MarcoIntLiteral? { get } -
asDoubleLiteralExtension methodSafely casts this value to a double value.
Declaration
Swift
public var asDoubleLiteral: MarcoDoubleLiteral? { get } -
asIntExtension methodSafely casts this value to an integer value, and returns the backing
Intif the cast was successful.Declaration
Swift
public var asInt: Int? { get } -
asIntOrZeroExtension methodSafely casts this value to an integer value, and returns the backing
Intif the cast was successful. Returns0otherwise.Declaration
Swift
public var asIntOrZero: Int { get } -
asDoubleExtension methodSafely casts this value to a double value, and returns the backing
Doubleif the cast was successful.Declaration
Swift
public var asDouble: Double? { get } -
asDoubleOrZeroExtension methodSafely casts this value to a double value, and returns the backing
Doubleif the cast was successful. Returns0.0otherwise.Declaration
Swift
public var asDoubleOrZero: Double { get } -
asBoolLiteralExtension methodSafely casts this value to a boolean value.
Declaration
Swift
public var asBoolLiteral: MarcoBoolLiteral? { get } -
asBoolExtension methodSafely casts this value to a boolean value, and returns the backing
Boolif the cast was successful.Declaration
Swift
public var asBool: Bool? { get } -
asBoolOrFalseExtension methodSafely casts this value to a boolean value, and returns the backing
Boolif the cast was successful. Returnsfalseotherwise.Declaration
Swift
public var asBoolOrFalse: Bool { get } -
asBoolOrTrueExtension methodSafely casts this value to a boolean value, and returns the backing
Boolif the cast was successful. Returnstrueotherwise.Declaration
Swift
public var asBoolOrTrue: Bool { get } -
asNullLiteralExtension methodSafely casts this value to a null value.
Declaration
Swift
public var asNullLiteral: MarcoNullLiteral? { get } -
isNullExtension methodTrue if this value is a null value.
Declaration
Swift
public var isNull: Bool { get } -
asColor(useAlpha:)Extension methodSafely casts this value to a color integer value, and converts it into an
NSColor.Declaration
Swift
public func asColor(useAlpha: Bool = false) -> NSColor? -
asColorExtension methodSafely casts this value to a color integer value, and converts it into an
NSColor.Declaration
Swift
public var asColor: NSColor? { get }
-
descriptionExtension methodDeclaration
Swift
public var description: String { get } -
documentExtension methodReturns an underlying Marco document, or
nilif the current value is not currently attached to a document.Declaration
Swift
public var document: MarcoDocument? { get }
MarcoValue Protocol Reference