Functions

The following functions are available globally.

  • Interrogate a JSON object for the existence of a child item with the given name. Has no side effects

    Declaration

    Swift

    public func | (lhs: VJson?, rhs: String?) -> VJson?

    Parameters

    lhs

    The VJson object to interrogate

    rhs

    The name of the sought after item

    Return Value

    Either the sought after item or nil if it does not exist.

  • Interrogate a JSON object for the existence of a child item at the given index. Has no side effects

    Declaration

    Swift

    public func | (lhs: VJson?, rhs: Int?) -> VJson?

    Parameters

    lhs

    The VJson object to interrogate

    rhs

    The index of the sought after item

    Return Value

    Either the sought after item or nil if it does not exist.

  • Assign a given integer value to a JSON item if possible. Fails silently if not possible.

    Changes the JSON item into a NUMBER if necessary and possible. If the integer value is nil, the JSON item becomes a NULL.

    Declaration

    Swift

    public func &= (lhs: VJson?, rhs: Int?)

    Parameters

    lhs

    The JSON item to assign to.

    rhs

    The value to be assigned.

  • Assign the integer value of the JSON item to the integer if possible. Fails silently if not possible.

    Declaration

    Swift

    public func &= (lhs: inout Int?, rhs: VJson?)

    Parameters

    lhs

    The integer to assign to.

    rhs

    The JSON item to extract the integer from.

  • Assign a given integer value to a JSON item if possible. Fails silently if not possible.

    Changes the JSON item into a NUMBER if necessary and possible. If the integer value is nil, the JSON item becomes a NULL.

    Declaration

    Swift

    public func &= (lhs: VJson?, rhs: UInt?)

    Parameters

    lhs

    The JSON item to assign to.

    rhs

    The value to be assigned.

  • Assign the integer value of the JSON item to the integer if possible. Fails silently if not possible.

    Declaration

    Swift

    public func &= (lhs: inout UInt?, rhs: VJson?)

    Parameters

    lhs

    The integer to assign to.

    rhs

    The JSON item to extract the integer from.

  • Assign a given integer value to a JSON item if possible. Fails silently if not possible.

    Changes the JSON item into a NUMBER if necessary and possible. If the integer value is nil, the JSON item becomes a NULL.

    Declaration

    Swift

    public func &= (lhs: VJson?, rhs: Int8?)

    Parameters

    lhs

    The JSON item to assign to.

    rhs

    The value to be assigned.

  • Assign the integer value of the JSON item to the integer if possible. Fails silently if not possible.

    Declaration

    Swift

    public func &= (lhs: inout Int8?, rhs: VJson?)

    Parameters

    lhs

    The integer to assign to.

    rhs

    The JSON item to extract the integer from.

  • Assign a given integer value to a JSON item if possible. Fails silently if not possible.

    Changes the JSON item into a NUMBER if necessary and possible. If the integer value is nil, the JSON item becomes a NULL.

    Declaration

    Swift

    public func &= (lhs: VJson?, rhs: UInt8?)

    Parameters

    lhs

    The JSON item to assign to.

    rhs

    The value to be assigned.

  • Assign the integer value of the JSON item to the integer if possible. Fails silently if not possible.

    Declaration

    Swift

    public func &= (lhs: inout UInt8?, rhs: VJson?)

    Parameters

    lhs

    The integer to assign to.

    rhs

    The JSON item to extract the integer from.

  • Assign a given integer value to a JSON item if possible. Fails silently if not possible.

    Changes the JSON item into a NUMBER if necessary and possible. If the integer value is nil, the JSON item becomes a NULL.

    Declaration

    Swift

    public func &= (lhs: VJson?, rhs: Int16?)

    Parameters

    lhs

    The JSON item to assign to.

    rhs

    The value to be assigned.

  • Assign the integer value of the JSON item to the integer if possible. Fails silently if not possible.

    Declaration

    Swift

    public func &= (lhs: inout Int16?, rhs: VJson?)

    Parameters

    lhs

    The integer to assign to.

    rhs

    The JSON item to extract the integer from.

  • Assign a given integer value to a JSON item if possible. Fails silently if not possible.

    Changes the JSON item into a NUMBER if necessary and possible. If the integer value is nil, the JSON item becomes a NULL.

    Declaration

    Swift

    public func &= (lhs: VJson?, rhs: UInt16?)

    Parameters

    lhs

    The JSON item to assign to.

    rhs

    The value to be assigned.

  • Assign the integer value of the JSON item to the integer if possible. Fails silently if not possible.

    Declaration

    Swift

    public func &= (lhs: inout UInt16?, rhs: VJson?)

    Parameters

    lhs

    The integer to assign to.

    rhs

    The JSON item to extract the integer from.

  • Assign a given integer value to a JSON item if possible. Fails silently if not possible.

    Changes the JSON item into a NUMBER if necessary and possible. If the integer value is nil, the JSON item becomes a NULL.

    Declaration

    Swift

    public func &= (lhs: VJson?, rhs: Int32?)

    Parameters

    lhs

    The JSON item to assign to.

    rhs

    The value to be assigned.

  • Assign the integer value of the JSON item to the integer if possible. Fails silently if not possible.

    Declaration

    Swift

    public func &= (lhs: inout Int32?, rhs: VJson?)

    Parameters

    lhs

    The integer to assign to.

    rhs

    The JSON item to extract the integer from.

  • Assign a given integer value to a JSON item if possible. Fails silently if not possible.

    Changes the JSON item into a NUMBER if necessary and possible. If the integer value is nil, the JSON item becomes a NULL.

    Declaration

    Swift

    public func &= (lhs: VJson?, rhs: UInt32?)

    Parameters

    lhs

    The JSON item to assign to.

    rhs

    The value to be assigned.

  • Assign the integer value of the JSON item to the integer if possible. Fails silently if not possible.

    Declaration

    Swift

    public func &= (lhs: inout UInt32?, rhs: VJson?)

    Parameters

    lhs

    The integer to assign to.

    rhs

    The JSON item to extract the integer from.

  • Assign a given integer value to a JSON item if possible. Fails silently if not possible.

    Changes the JSON item into a NUMBER if necessary and possible. If the integer value is nil, the JSON item becomes a NULL.

    Declaration

    Swift

    public func &= (lhs: VJson?, rhs: Int64?)

    Parameters

    lhs

    The JSON item to assign to.

    rhs

    The value to be assigned.

  • Assign the integer value of the JSON item to the integer if possible. Fails silently if not possible.

    Declaration

    Swift

    public func &= (lhs: inout Int64?, rhs: VJson?)

    Parameters

    lhs

    The integer to assign to.

    rhs

    The JSON item to extract the integer from.

  • Assign a given integer value to a JSON item if possible. Fails silently if not possible.

    Changes the JSON item into a NUMBER if necessary and possible. If the integer value is nil, the JSON item becomes a NULL.

    Declaration

    Swift

    public func &= (lhs: VJson?, rhs: UInt64?)

    Parameters

    lhs

    The JSON item to assign to.

    rhs

    The value to be assigned.

  • Assign the integer value of the JSON item to the integer if possible. Fails silently if not possible.

    Declaration

    Swift

    public func &= (lhs: inout UInt64?, rhs: VJson?)

    Parameters

    lhs

    The integer to assign to.

    rhs

    The JSON item to extract the integer from.

  • Assign a given float value to a JSON item if possible. Fails silently if not possible.

    Changes the JSON item into a NUMBER if necessary and possible. If the float value is nil, the JSON item becomes a NULL.

    Declaration

    Swift

    public func &= (lhs: VJson?, rhs: Float?)

    Parameters

    lhs

    The JSON item to assign to.

    rhs

    The value to be assigned.

  • Assign the float value of the JSON item to the float if possible. Fails silently if not possible.

    Declaration

    Swift

    public func &= (lhs: inout Float?, rhs: VJson?)

    Parameters

    lhs

    The float to assign to.

    rhs

    The JSON item to extract the float from.

  • Assign a given double value to a JSON item if possible. Fails silently if not possible.

    Changes the JSON item into a NUMBER if necessary and possible. If the double value is nil, the JSON item becomes a NULL.

    Declaration

    Swift

    public func &= (lhs: VJson?, rhs: Double?) -> VJson?

    Parameters

    lhs

    The JSON item to assign to.

    rhs

    The value to be assigned.

  • Assign the double value of the JSON item to the double if possible. Fails silently if not possible.

    Declaration

    Swift

    public func &= (lhs: inout Double?, rhs: VJson?)

    Parameters

    lhs

    The double to assign to.

    rhs

    The JSON item to extract the double from.

  • Assign a given NSNumber to a JSON item if possible. Fails silently if not possible.

    Changes the JSON item into a NUMBER if necessary and possible. If the NSNumber is nil, the JSON item becomes a NULL.

    Declaration

    Swift

    public func &= (lhs: VJson?, rhs: NSNumber?) -> VJson?

    Parameters

    lhs

    The JSON item to assign to.

    rhs

    The value to be assigned.

  • Assign the NSNumber value of the JSON item to the NSNumber if possible. Fails silently if not possible.

    Declaration

    Swift

    public func &= (lhs: inout NSNumber?, rhs: VJson?)

    Parameters

    lhs

    The NSNumber to assign to.

    rhs

    The JSON item to extract the NSNumber from.

  • Assign a given bool to a JSON item if possible. Fails silently if not possible.

    Changes the JSON item into a BOOL if necessary and possible. If the bool is nil, the JSON item becomes a NULL.

    Declaration

    Swift

    public func &= (lhs: VJson?, rhs: Bool?) -> VJson?

    Parameters

    lhs

    The JSON item to assign to.

    rhs

    The value to be assigned.

  • Assign the bool value of the JSON item to the bool if possible. Fails silently if not possible.

    Declaration

    Swift

    public func &= (lhs: inout Bool?, rhs: VJson?)

    Parameters

    lhs

    The bool to assign to.

    rhs

    The JSON item to extract the bool from.

  • Assign a given string to a JSON item if possible. Fails silently if not possible.

    Changes the JSON item into a STRING if necessary and possible. If the string is nil, the JSON item becomes a NULL.

    Declaration

    Swift

    public func &= (lhs: VJson?, rhs: String?) -> VJson?

    Parameters

    lhs

    The JSON item to assign to.

    rhs

    The value to be assigned.

  • Assign the string value of the JSON item to the string if possible. Fails silently if not possible.

    Declaration

    Swift

    public func &= (lhs: inout String?, rhs: VJson?)

    Parameters

    lhs

    The string to assign to.

    rhs

    The JSON item to extract the string from.

  • Assigns the right hand side VJson object to the left hand side. This operation makes a best effort to fullfill the intention of the developper. Be aware that this might turn out differently than expected!

    The following rules will be applied in the given order:

    if rhs is nil then nothing will be done, lhs is returned unchanged.

    if rhs has a parent then nothing will be done, lhs is returned unchanged.

    if lhs is nil then nothing will be done, nil is returned.

    if lhs is an ARRAY, then the rhs will be added to the array.

    if lhs is an OBJECT, then the rhs will be added to the children if the rhs has a name.

    if lhs has a parent, then replace lhs with rhs in that parent but preserve the name of lhs.

    if lhs has no parent, then make the content of lhs equal to rhs but preserve the name of lhs

    Note

    This is a potentially dangerous operation since it can fail silently or even do something different than expected. Be sure to add (unit) test cases to find any errors that might occur.

    Declaration

    Swift

    public func &= (lhs: VJson?, rhs: VJson?) -> VJson?

    Parameters

    lhs

    The JSON item to assign to.

    rhs

    The JSON item to assign.

    Return Value

    The JSON item that was assigned to.

  • Assigns the right hand side VJson object to the left hand side. This operation makes a best effort to fullfill the intention of the developper. Be aware that this might turn out differently than expected!

    The following rules will be applied in the given order:

    if rhs is nil then nothing will be done, lhs is returned unchanged.

    if lhs is nil then it is replaced by rhs, the new lhs is returned.

    if either rhs or lhs has a parent then the content of lhs will be updated to reflect rhs but the name of lhs (if any) will be preserved, the new lhs is returned.

    if lhs is an ARRAY, then rhs will be added to the array, returns updated lhs.

    if lhs is an OBJECT, then rhs will be added to the children if the rhs has a name, returns updated lhs.

    All other cases replace lhs with rhs, return new lhs.

    Note

    This is a potentially dangerous operation since it can fail silently or even do something different than expected. Be sure to add (unit) test cases to find any errors that might occur.

    Declaration

    Swift

    public func &= (lhs: inout VJson?, rhs: VJson?) -> VJson?

    Parameters

    lhs

    The JSON item to assign to.

    rhs

    The JSON item to assign.

    Return Value

    The JSON item that was assigned to.