FHIRDecimal

public struct FHIRDecimal: FHIRPrimitive, LosslessStringConvertible, ExpressibleByStringLiteral, ExpressibleByIntegerLiteral

Struct to hold on to a decimal value.

By design, FHIRDecimal does not conform to ExpressibleByFloatLiteral in order to avoid precision issues.

  • The actual decimal value.

    Declaration

    Swift

    public var decimal: Decimal
  • id

    An optional id of the element.

    Declaration

    Swift

    public var id: String?
  • The parent/owner of the receiver, if any. Used to dereference resources.

    Declaration

    Swift

    public weak var _owner: FHIRAbstractBase?
  • Optional extensions of the element.

    Declaration

    Swift

    public var extension_fhir: [Extension]?
  • Designated initializer.

    Declaration

    Swift

    public init(_ dcm: Decimal)

    Parameters

    dcm

    The decimal to represent.

  • Initializer from the value the JSON parser returns.

    We’re using a string format approach using %.15g since NSJSONFormatting returns NSNumber objects instantiated with Double() or Int(). In the former case this causes precision issues (e.g. try 8.7). Unfortunately, some doubles with 16 and 17 significant digits will be truncated (e.g. a longitude of 4.844614000123024).

    TODO: replace JSONSerialization with a different parser?

    Declaration

    Swift

    public init(json: JSONType, owner: FHIRAbstractBase?, context: inout FHIRInstantiationContext)
  • Initializer from the value the JSON parser returns.

    We’re using a string format approach using %.15g since NSJSONFormatting returns NSNumber objects instantiated with Double() or Int(). In the former case this causes precision issues (e.g. try 8.7). Unfortunately, some doubles with 16 and 17 significant digits will be truncated (e.g. a longitude of 4.844614000123024).

    TODO: replace JSONSerialization with a different parser?

    Declaration

    Swift

    public func asJSON(errors: inout [FHIRValidationError]) -> JSONType

    Parameters

    errors

    Errors encountered during serialization

    Return Value

    The FHIRJSON reperesentation of the receiver

  • Declaration

    Swift

    public init?(_ description: String)
  • Declaration

    Swift

    public var description: String
  • Declaration

    Swift

    public static func ==(l: FHIRDecimal, r: FHIRDecimal) -> Bool

    Parameters

    lhs

    A value to compare.

    rhs

    Another value to compare.

  • Undocumented

    Declaration

    Swift

    public struct FHIRDecimal: FHIRPrimitive, LosslessStringConvertible, ExpressibleByStringLiteral, ExpressibleByIntegerLiteral
  • Undocumented

    Declaration

    Swift

    public struct FHIRDecimal: FHIRPrimitive, LosslessStringConvertible, ExpressibleByStringLiteral, ExpressibleByIntegerLiteral
  • Undocumented

    Declaration

    Swift

    public struct FHIRDecimal: FHIRPrimitive, LosslessStringConvertible, ExpressibleByStringLiteral, ExpressibleByIntegerLiteral
  • Undocumented

    Declaration

    Swift

    public struct FHIRDecimal: FHIRPrimitive, LosslessStringConvertible, ExpressibleByStringLiteral, ExpressibleByIntegerLiteral
  • Undocumented

    Declaration

    Swift

    public struct FHIRDecimal: FHIRPrimitive, LosslessStringConvertible, ExpressibleByStringLiteral, ExpressibleByIntegerLiteral
  • Undocumented

    Declaration

    Swift

    public struct FHIRDecimal: FHIRPrimitive, LosslessStringConvertible, ExpressibleByStringLiteral, ExpressibleByIntegerLiteral
  • Declaration

    Swift

    public static func <(lh: FHIRDecimal, rh: FHIRDecimal) -> Bool

    Parameters

    lhs

    A value to compare.

    rhs

    Another value to compare.

  • Undocumented

    Declaration

    Swift

    public struct FHIRDecimal: FHIRPrimitive, LosslessStringConvertible, ExpressibleByStringLiteral, ExpressibleByIntegerLiteral
  • Undocumented

    Declaration

    Swift

    public struct FHIRDecimal: FHIRPrimitive, LosslessStringConvertible, ExpressibleByStringLiteral, ExpressibleByIntegerLiteral
  • Undocumented

    Declaration

    Swift

    public struct FHIRDecimal: FHIRPrimitive, LosslessStringConvertible, ExpressibleByStringLiteral, ExpressibleByIntegerLiteral
  • Undocumented

    Declaration

    Swift

    public struct FHIRDecimal: FHIRPrimitive, LosslessStringConvertible, ExpressibleByStringLiteral, ExpressibleByIntegerLiteral
  • Undocumented

    Declaration

    Swift

    public struct FHIRDecimal: FHIRPrimitive, LosslessStringConvertible, ExpressibleByStringLiteral, ExpressibleByIntegerLiteral
  • Undocumented

    Declaration

    Swift

    public struct FHIRDecimal: FHIRPrimitive, LosslessStringConvertible, ExpressibleByStringLiteral, ExpressibleByIntegerLiteral