Top Prev Next Up Down

Overloading of “&” operator

functions used from Y2018-Text-Core-Str:
function "&"(left:CFix;right:String) return CFix ;
function "&"(left:CFix;right:Character) return CFix ;
function "&"(left:String;right:CFix) return String ;
function "&"(left:String;right:CVar) return String ;
function "&"(left:String;right:CodePoint) return String ;
function "&"(left:CVar;right:String) return CVar ;
function "&"(left:CVar;right:Character) return CVar ;
function "&"(left:CodePoint;right:String) return CFix ;
function "&"(left:CodePoint;right:Character) return CFix ;
function "&"(left:Character;right:CFix) return String ;
function "&"(left:Character;right:CVar) return String ;
function "&"(left:Character;right:CodePoint) return String ;

functions used from Y2018-Text-Core-CVarpack:

function "&"(Left:CFix;Right:CVar) return CFix ;
function "&"(Left:CVar;Right:CFix) return CVar ;
function "&"(Left:CVar;Right:CVar) return CVar ;
function "&"(Left:CVar;Right:CodePoint) return CVar ;
function "&"(Left:CodePoint;Right:CVar) return CFix ;

Some are supported through package Y2018-Text-Core-Str and Y2018-Text-Core-CVarpack and some by basic Ada.

First or left

Second or right

Result

CFix

CFix

CFix

CFix

CVar

CFix

CFix

String

CFix

CFix

CodePoint

CFix

CFix

Character

CFix

String

CFix

String

String

CVar

String

String

String

String

String

CodePoint

String

String

Character

String

CVar

CFix

CVar

CVar

CVar

CVar

CVar

String

CVar

CVar

CodePoint

CVar

CVar

Character

CVar

CodePoint

CFix

CFix

CodePoint

CVar

CFix

CodePoint

String

CFix

CodePoint

CodePoint

CFix

CodePoint

Character

CFix

Character

CFix

String

Character

CVar

String

Character

String

String

Character

CodePoint

String

Character

Character

String

The result is always one of String, CFix or CVar type.
Example:
declare a:CFix:=a_cfix & b_cvar & "5";
i.e. mixing CVar, CFix and String values and assign the result to variable 'a' of type of CFix type.
The type of such a mixed expression is defined by the first operator, in this case 'a_CFix'. It is possible to set the type of an expression by inserting at the beginning a null length constant ("" for String, null_CFix or ""c for CFix and null_CVar for CVar ).