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
-
asObject
Extension methodSafely casts this value to an object value.
Declaration
Swift
public var asObject: MarcoObject? { get }
-
asArray
Extension methodSafely casts this value to an array value.
Declaration
Swift
public var asArray: MarcoArray? { get }
-
asStringLiteral
Extension methodSafely casts this value to a string value.
Declaration
Swift
public var asStringLiteral: MarcoStringLiteral? { get }
-
asString
Extension methodSafely casts this value to an string value, and returns the backing
String
if the cast was successful.Declaration
Swift
public var asString: String? { get }
-
asStringOrEmpty
Extension methodSafely casts this value to an string value, and returns the backing
String
if the cast was successful. Returns an empty String otherwise.Declaration
Swift
public var asStringOrEmpty: String { get }
-
asNumberLiteral
Extension methodSafely casts this value to a number value.
Declaration
Swift
public var asNumberLiteral: MarcoNumberLiteral? { get }
-
asIntLiteral
Extension methodSafely casts this value to a integer value.
Declaration
Swift
public var asIntLiteral: MarcoIntLiteral? { get }
-
asDoubleLiteral
Extension methodSafely casts this value to a double value.
Declaration
Swift
public var asDoubleLiteral: MarcoDoubleLiteral? { get }
-
asInt
Extension methodSafely casts this value to an integer value, and returns the backing
Int
if the cast was successful.Declaration
Swift
public var asInt: Int? { get }
-
asIntOrZero
Extension methodSafely casts this value to an integer value, and returns the backing
Int
if the cast was successful. Returns0
otherwise.Declaration
Swift
public var asIntOrZero: Int { get }
-
asDouble
Extension methodSafely casts this value to a double value, and returns the backing
Double
if the cast was successful.Declaration
Swift
public var asDouble: Double? { get }
-
asDoubleOrZero
Extension methodSafely casts this value to a double value, and returns the backing
Double
if the cast was successful. Returns0.0
otherwise.Declaration
Swift
public var asDoubleOrZero: Double { get }
-
asBoolLiteral
Extension methodSafely casts this value to a boolean value.
Declaration
Swift
public var asBoolLiteral: MarcoBoolLiteral? { get }
-
asBool
Extension methodSafely casts this value to a boolean value, and returns the backing
Bool
if the cast was successful.Declaration
Swift
public var asBool: Bool? { get }
-
asBoolOrFalse
Extension methodSafely casts this value to a boolean value, and returns the backing
Bool
if the cast was successful. Returnsfalse
otherwise.Declaration
Swift
public var asBoolOrFalse: Bool { get }
-
asBoolOrTrue
Extension methodSafely casts this value to a boolean value, and returns the backing
Bool
if the cast was successful. Returnstrue
otherwise.Declaration
Swift
public var asBoolOrTrue: Bool { get }
-
asNullLiteral
Extension methodSafely casts this value to a null value.
Declaration
Swift
public var asNullLiteral: MarcoNullLiteral? { get }
-
isNull
Extension 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?
-
asColor
Extension methodSafely casts this value to a color integer value, and converts it into an
NSColor
.Declaration
Swift
public var asColor: NSColor? { get }
-
description
Extension methodDeclaration
Swift
public var description: String { get }
-
document
Extension methodReturns an underlying Marco document, or
nil
if the current value is not currently attached to a document.Declaration
Swift
public var document: MarcoDocument? { get }