adaAttribute Image


Introduction

Subtype attributes 'Image and 'Value will take, respectively, a scalar value and a string and they return, respectively, a string and a scalar value. The result of 'Image can be input to 'Value to get the original value. The converse is also true.

The __Scalar_Object__'Image attribute can be used directly on objects (since Ada 2012-TC-1).

Syntax

  • function Scalar'Image (Argument : Scalar'Base) return String;
  • function Discrete'Image (Argument : Discrete'Base) return String;
  • function Integer'Image (Argument : Integer'Base) return String;
  • function Enumeration'Image (Argument : Enumeration'Base) return String;
  • function Real'Image (Argument : Real'Base) return String;
  • function Numeric'Image (Argument : Numeric'Base) return String;
  • function Scalar'Value (Argument : String) return Scalar'Base;
  • function Discrete'Value (Argument : String) return Discrete'Base;
  • function Integer'Value (Argument : String) return Integer'Base;
  • function Enumeration'Value (Argument : String) return Enumeration'Base;
  • function Real'Value (Argument : String) return Real'Base;
  • function Scalar_Object'Image return String;

Remarks

Note that 'Image can incur implementation defined results (RM 3.5), namely when some graphic characters needed for the String result are not defined in Character. Consider the larger repertoires of 'Wide_Image and 'Wide_Wide_Image.

Ada 2012(TC-1)

The permission to use the attribute __Scalar_Object__'Image directly on an object was added in Ada 2012-TC-1 (April 2016).