RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
TCustomVariantType.CompareOp Method

Implements any comparison operations of which the custom Variant type is capable.

Pascal
function CompareOp(const Left: TVarData; const Right: TVarData; const Operator: TVarOp): Boolean; virtual;
C++
virtual __fastcall Boolean CompareOp(const TVarData Left, const TVarData Right, const TVarOp Operator);

Override CompareOp to implement any comparison operators the custom Variant type supports. Descendants can implement comparison operators by overriding either the Compare or the CompareOp method.  

Left is the value that appears to the left of the operator. 

Right is the value that appears to the right of the operator. 

Operator identifies the operator that appears between Left and Right. It can be any of the following values:

Value 
Operation 
opCmpEQ  
equality comparison  
opCmpNE  
inequality comparison  
opCmpLT  
less than  
opCmpLE  
less than or equal  
opCmpGT  
greater than  
opCmpGE  
greater than or equal  

CompareOp returns true if the comparison is true as specified. It returns false if the specified comparison does not hold true. 

As implemented in TCustomVariantType, CompareOp raises a system error indicating an invalid operation. 

 

UnaryOp 

BinaryOp 

LeftPromotion 

RightPromotion 

Compare 

Implementing Comparison Operations

Copyright(C) 2008 CodeGear(TM). All Rights Reserved.
What do you think about this topic? Send feedback!