OpenPetra
Free Administration Software for Non-Profits
Ict.Common.TVariant Class Reference

a class for the storage of values in different representations; Conversion functions are provided. More...

Inheritance diagram for Ict.Common.TVariant:

Public Member Functions

 TVariant (System.Object value)
 constructor from any object More...
 
 TVariant ()
 default constructor More...
 
 TVariant (TVariant value)
 copy constructor More...
 
 TVariant (System.DateTime value, String AFormat)
 constructor for dates More...
 
 TVariant (System.DateTime value)
 constructor for dates More...
 
 TVariant (decimal value, String AFormat)
 constructor for decimal More...
 
 TVariant (decimal value)
 constructor for decimal More...
 
 TVariant (double value)
 constructor for double (will be converted to decimal) More...
 
 TVariant (char value)
 constructor for single characters More...
 
 TVariant (System.Int32 value)
 constructor for integer More...
 
 TVariant (System.Int64 value)
 constructor for long integer More...
 
 TVariant (String value, String AFormat)
 constructor for string will look at the content of the string and generate a typed representation if you want to force a string value, use the other overloaded constructor below More...
 
 TVariant (String value)
 constructor for string More...
 
 TVariant (String value, bool ExplicitString)
 constructor for string if you want the content to be kept as a string, and not converted to int (e.g. cost centre: 0200) More...
 
 TVariant (bool value)
 constructor for boolean More...
 
void Add (TVariant value, String AFormatString, Boolean AConcatenateStrings)
 This either adds the new value to an already existing composite (list of several values), or it changes the current non composite variable to be a composite, by adding the current value as the first member to the list, and then adding the new value; ToString will concatenate the values, but ToDecimal, ToBoolean etc will only convert the first value in the composite More...
 
void Add (TVariant value, String AFormatString)
 overload for Add More...
 
void Add (TVariant value)
 overload for Add More...
 
TVariant FirstCompositeValue ()
 returns the first value of the list, or an empty value, if the list is empty More...
 
String EncodeToString ()
 This function creates an encoded string, that holds the value and the type More...
 
void Assign (TVariant value)
 copy the value to the current object instance More...
 
System.Object ToObject ()
 Convert TVariant to Object More...
 
System.Int32 ToInt ()
 convert to Integer More...
 
System.Int32 ToInt32 ()
 convert to Integer More...
 
System.Int64 ToInt64 ()
 convert to Integer More...
 
bool ToBool ()
 convert to Boolean More...
 
double ToDouble ()
 convert to Double More...
 
decimal ToDecimal ()
 convert to Decimal More...
 
ArrayList ToComposite ()
 convert to list of TVariant More...
 
String ToJson ()
 return the json representation of the value More...
 
override String ToString ()
 will call ToString(false), which means it will not print "NOTFOUND" for an empty value, for debugging call toString(true) More...
 
String ToString (bool printNotFound)
 print to string More...
 
OdbcParameter ToOdbcParameter (string AName)
 convert the value to an ODBC parameter More...
 
System.DateTime ToDate ()
 convert to Date More...
 
String DateToString (String format)
 print date to string More...
 
String ToFormattedString (String ACurrencyFormat, String AOutputType)
 Format the current value to be exported to CSV or to be printed with the local culture format settings (for currencies and dates); More...
 
String ToFormattedString (String ACurrencyFormat)
 overload of ToFormattedString More...
 
String ToFormattedString ()
 overload of ToFormattedString More...
 
void ApplyFormatString (String AFormatString)
 apply the string format to the current variable More...
 
bool IsZeroOrNull ()
 evaluate if the current value is zero or null More...
 
bool IsNil ()
 check if the value is empty More...
 
System.Int16 CompareTo (TVariant v)
 
System.Int16 CompareToI (TVariant v)
 compare case insenstive More...
 
virtual void GetObjectData (SerializationInfo info, StreamingContext ctx)
 serialize TVariant as a string. This helps to avoid problems with .net Remoting and DateTime More...
 

Static Public Member Functions

static string StripDecimalAndZeros (string s)
 remove all trailing zeros, and the decimal point, if there are no decimals left More...
 
static TVariant DecodeFromString (String encodedValue)
 This static function is used to create a variant with the correct type, when the variant is restored from an encoded string, that could e.g. be stored in a datatable (only strings) More...
 

Public Attributes

eVariantTypes TypeVariant
 the type of the value stored in this instance More...
 
String FormatString = ""
 for currencies and dayofyear (date) More...
 

Protected Member Functions

 TVariant (SerializationInfo info, StreamingContext ctx)
 serialize TVariant as a string. This helps to avoid problems with .net Remoting and DateTime More...
 

Detailed Description

a class for the storage of values in different representations; Conversion functions are provided.

Constructor & Destructor Documentation

◆ TVariant() [1/16]

Ict.Common.TVariant.TVariant ( System.Object  value)
inline

constructor from any object

Parameters
valueany type of object

◆ TVariant() [2/16]

Ict.Common.TVariant.TVariant ( )
inline

default constructor

◆ TVariant() [3/16]

Ict.Common.TVariant.TVariant ( TVariant  value)
inline

copy constructor

Parameters
value

◆ TVariant() [4/16]

Ict.Common.TVariant.TVariant ( System.DateTime  value,
String  AFormat 
)
inline

constructor for dates

Parameters
valuedate time value
AFormatcan be dayofyear (for birthdays)
Returns
void

◆ TVariant() [5/16]

Ict.Common.TVariant.TVariant ( System.DateTime  value)
inline

constructor for dates

Parameters
valuedate time value

◆ TVariant() [6/16]

Ict.Common.TVariant.TVariant ( decimal  value,
String  AFormat 
)
inline

constructor for decimal

Parameters
valuedecimal value
AFormatrequested format

◆ TVariant() [7/16]

Ict.Common.TVariant.TVariant ( decimal  value)
inline

constructor for decimal

Parameters
valuedecimal value

◆ TVariant() [8/16]

Ict.Common.TVariant.TVariant ( double  value)
inline

constructor for double (will be converted to decimal)

Parameters
valuedouble value

◆ TVariant() [9/16]

Ict.Common.TVariant.TVariant ( char  value)
inline

constructor for single characters

Parameters
valuecharacter value

◆ TVariant() [10/16]

Ict.Common.TVariant.TVariant ( System.Int32  value)
inline

constructor for integer

Parameters
valueinteger value

◆ TVariant() [11/16]

Ict.Common.TVariant.TVariant ( System.Int64  value)
inline

constructor for long integer

Parameters
valuelong integer value

◆ TVariant() [12/16]

Ict.Common.TVariant.TVariant ( String  value,
String  AFormat 
)
inline

constructor for string will look at the content of the string and generate a typed representation if you want to force a string value, use the other overloaded constructor below

Parameters
valuestring value
AFormatrequested format

◆ TVariant() [13/16]

Ict.Common.TVariant.TVariant ( String  value)
inline

constructor for string

Parameters
valuestring value

◆ TVariant() [14/16]

Ict.Common.TVariant.TVariant ( String  value,
bool  ExplicitString 
)
inline

constructor for string if you want the content to be kept as a string, and not converted to int (e.g. cost centre: 0200)

Parameters
value
ExplicitString

◆ TVariant() [15/16]

Ict.Common.TVariant.TVariant ( bool  value)
inline

constructor for boolean

Parameters
valueboolean value

◆ TVariant() [16/16]

Ict.Common.TVariant.TVariant ( SerializationInfo  info,
StreamingContext  ctx 
)
inlineprotected

serialize TVariant as a string. This helps to avoid problems with .net Remoting and DateTime

Member Function Documentation

◆ Add() [1/3]

void Ict.Common.TVariant.Add ( TVariant  value)
inline

overload for Add

Parameters
valuevalue to be added

◆ Add() [2/3]

void Ict.Common.TVariant.Add ( TVariant  value,
String  AFormatString 
)
inline

overload for Add

Parameters
valuevalue to be added
AFormatStringrequested format for the value

◆ Add() [3/3]

void Ict.Common.TVariant.Add ( TVariant  value,
String  AFormatString,
Boolean  AConcatenateStrings 
)
inline

This either adds the new value to an already existing composite (list of several values), or it changes the current non composite variable to be a composite, by adding the current value as the first member to the list, and then adding the new value; ToString will concatenate the values, but ToDecimal, ToBoolean etc will only convert the first value in the composite

Returns
void

◆ ApplyFormatString()

void Ict.Common.TVariant.ApplyFormatString ( String  AFormatString)
inline

apply the string format to the current variable

Parameters
AFormatStringformat to be used

◆ Assign()

void Ict.Common.TVariant.Assign ( TVariant  value)
inline

copy the value to the current object instance

Parameters
valuevalue to be copied

◆ CompareTo()

System.Int16 Ict.Common.TVariant.CompareTo ( TVariant  v)
inline

Returns
s 0 if equal, -1 if this object is less than the parameter, +1 if it is greater

◆ CompareToI()

System.Int16 Ict.Common.TVariant.CompareToI ( TVariant  v)
inline

compare case insenstive

Parameters
v
Returns

◆ DateToString()

String Ict.Common.TVariant.DateToString ( String  format)
inline

print date to string

Parameters
formatthe requested format to be used
Returns
a string representation

◆ DecodeFromString()

static TVariant Ict.Common.TVariant.DecodeFromString ( String  encodedValue)
inlinestatic

This static function is used to create a variant with the correct type, when the variant is restored from an encoded string, that could e.g. be stored in a datatable (only strings)

Returns
void

◆ EncodeToString()

String Ict.Common.TVariant.EncodeToString ( )
inline

This function creates an encoded string, that holds the value and the type

Returns
void

◆ FirstCompositeValue()

TVariant Ict.Common.TVariant.FirstCompositeValue ( )
inline

returns the first value of the list, or an empty value, if the list is empty

Returns
void

◆ GetObjectData()

virtual void Ict.Common.TVariant.GetObjectData ( SerializationInfo  info,
StreamingContext  ctx 
)
inlinevirtual

serialize TVariant as a string. This helps to avoid problems with .net Remoting and DateTime

Parameters
info
ctx

◆ IsNil()

bool Ict.Common.TVariant.IsNil ( )
inline

check if the value is empty

Returns
s true if the value is empty

◆ IsZeroOrNull()

bool Ict.Common.TVariant.IsZeroOrNull ( )
inline

evaluate if the current value is zero or null

Returns
s true if the value is empty or has an empty string or 0 or 0.0

◆ StripDecimalAndZeros()

static string Ict.Common.TVariant.StripDecimalAndZeros ( string  s)
inlinestatic

remove all trailing zeros, and the decimal point, if there are no decimals left

Parameters
s
Returns

◆ ToBool()

bool Ict.Common.TVariant.ToBool ( )
inline

convert to Boolean

Returns
a boolean representation

◆ ToComposite()

ArrayList Ict.Common.TVariant.ToComposite ( )
inline

convert to list of TVariant

Returns
an array of TVariant

◆ ToDate()

System.DateTime Ict.Common.TVariant.ToDate ( )
inline

convert to Date

Returns
a date representation

◆ ToDecimal()

decimal Ict.Common.TVariant.ToDecimal ( )
inline

convert to Decimal

Returns
a decimal representation

◆ ToDouble()

double Ict.Common.TVariant.ToDouble ( )
inline

convert to Double

Returns
a double representation

◆ ToFormattedString() [1/3]

String Ict.Common.TVariant.ToFormattedString ( )
inline

overload of ToFormattedString

Returns
formatted string

◆ ToFormattedString() [2/3]

String Ict.Common.TVariant.ToFormattedString ( String  ACurrencyFormat)
inline

overload of ToFormattedString

Parameters
ACurrencyFormatformat to use
Returns
formatted string

◆ ToFormattedString() [3/3]

String Ict.Common.TVariant.ToFormattedString ( String  ACurrencyFormat,
String  AOutputType 
)
inline

Format the current value to be exported to CSV or to be printed with the local culture format settings (for currencies and dates);

Parameters
ACurrencyFormatCurrencyThousands or CurrencyWithoutDecimals
AOutputTypeLocalized or CSV
Returns
void

◆ ToInt()

System.Int32 Ict.Common.TVariant.ToInt ( )
inline

convert to Integer

Returns
an integer representation

◆ ToInt32()

System.Int32 Ict.Common.TVariant.ToInt32 ( )
inline

convert to Integer

Returns
an integer representation

◆ ToInt64()

System.Int64 Ict.Common.TVariant.ToInt64 ( )
inline

convert to Integer

Returns
an integer representation

◆ ToJson()

String Ict.Common.TVariant.ToJson ( )
inline

return the json representation of the value

◆ ToObject()

System.Object Ict.Common.TVariant.ToObject ( )
inline

Convert TVariant to Object

Returns
a representation of this TVariant instance as a typed Object

◆ ToOdbcParameter()

OdbcParameter Ict.Common.TVariant.ToOdbcParameter ( string  AName)
inline

convert the value to an ODBC parameter

◆ ToString() [1/2]

override String Ict.Common.TVariant.ToString ( )
inline

will call ToString(false), which means it will not print "NOTFOUND" for an empty value, for debugging call toString(true)

Returns
void

◆ ToString() [2/2]

String Ict.Common.TVariant.ToString ( bool  printNotFound)
inline

print to string

Parameters
printNotFoundprint something so that it is clear that the value was invalid
Returns
a string representation

Member Data Documentation

◆ FormatString

String Ict.Common.TVariant.FormatString = ""

for currencies and dayofyear (date)

◆ TypeVariant

eVariantTypes Ict.Common.TVariant.TypeVariant

the type of the value stored in this instance


The documentation for this class was generated from the following file: