AcUtils
A high performance abstraction layer for AccuRev
Public Member Functions | Static Public Member Functions | List of all members
AcUtils.AcDuration Class Reference

Wrapper around TimeSpan so we can return our own formatted elapsed time string and still sort correctly in a grid based on the actual time span. More...

Collaboration diagram for AcUtils.AcDuration:
Collaboration graph
[legend]

Public Member Functions

 AcDuration (TimeSpan ts)
 Constructor. More...
 
string ToString (string format, IFormatProvider provider)
 The ToString implementation. More...
 
Equality comparison
bool Equals (AcDuration other)
 IEquatable implementation to determine the equality of instances of type AcDuration. More...
 
override bool Equals (object other)
 Overridden to determine equality. More...
 
override int GetHashCode ()
 Override appropriate for type AcDuration. More...
 

Static Public Member Functions

static implicit operator TimeSpan (AcDuration rhs)
 User-defined conversion from AcDuration to TimeSpan. More...
 
static implicit operator AcDuration (TimeSpan rhs)
 User-defined conversion from TimeSpan to AcDuration. More...
 

Order comparison

int CompareTo (AcDuration other)
 Generic IComparable implementation (default) for comparing AcDuration objects to sort by timespan. More...
 
int IComparable. CompareTo (object other)
 Pre-generic interface implementation for code using reflection. More...
 

Detailed Description

Wrapper around TimeSpan so we can return our own formatted elapsed time string and still sort correctly in a grid based on the actual time span.

Definition at line 25 of file AcDuration.cs.

Constructor & Destructor Documentation

AcUtils.AcDuration.AcDuration ( TimeSpan  ts)
inline

Constructor.

Definition at line 32 of file AcDuration.cs.

Referenced by AcUtils.AcDuration.CompareTo(), and AcUtils.AcDuration.operator AcDuration().

Member Function Documentation

int AcUtils.AcDuration.CompareTo ( AcDuration  other)
inline

Generic IComparable implementation (default) for comparing AcDuration objects to sort by timespan.

Parameters
otherAn AcDuration object to compare with this instance.
Returns
Value indicating the relative order of the AcDuration objects being compared.

Definition at line 99 of file AcDuration.cs.

Referenced by AcUtils.AcSession.CompareTo(), and AcUtils.AcDuration.CompareTo().

int IComparable. AcUtils.AcDuration.CompareTo ( object  other)
inlineprivate

Pre-generic interface implementation for code using reflection.

Parameters
otherAn AcDuration object to compare with this instance.
Returns
Return value of generic CompareTo(AcDuration) version.
Exceptions
ArgumentExceptionthrown if argument is not an AcDuration object.

Definition at line 116 of file AcDuration.cs.

bool AcUtils.AcDuration.Equals ( AcDuration  other)
inline

IEquatable implementation to determine the equality of instances of type AcDuration.

Parameters
otherThe AcDuration object being compared to this instance.
Returns
true if AcDuration other is the same, false otherwise.

Definition at line 61 of file AcDuration.cs.

Referenced by AcUtils.AcDuration.Equals().

override bool AcUtils.AcDuration.Equals ( object  other)
inline

Overridden to determine equality.

Returns
Return value of generic Equals(AcDuration) version.

Definition at line 72 of file AcDuration.cs.

override int AcUtils.AcDuration.GetHashCode ( )
inline

Override appropriate for type AcDuration.

Returns
Hash of our TimeSpan class data member.

Definition at line 84 of file AcDuration.cs.

static implicit AcUtils.AcDuration.operator AcDuration ( TimeSpan  rhs)
inlinestatic

User-defined conversion from TimeSpan to AcDuration.

Definition at line 48 of file AcDuration.cs.

static implicit AcUtils.AcDuration.operator TimeSpan ( AcDuration  rhs)
inlinestatic

User-defined conversion from AcDuration to TimeSpan.

Definition at line 40 of file AcDuration.cs.

string AcUtils.AcDuration.ToString ( string  format,
IFormatProvider  provider 
)
inline

The ToString implementation.

Parameters
formatThe format specifier to use, e.g. Console.WriteLine(session.ToString("h"));
providerAllow clients to format output for their own types using ICustomFormatter.
Returns
The formatted string.
Exceptions
FormatExceptionthrown if an invalid format string is specified.
Format specifiers:
  • G Show elapsed time in days, hours, minutes and seconds. Default when not using a format specifier.
  • H Hours.
  • M Minutes.
  • S Seconds.
  • D day or days.

Definition at line 140 of file AcDuration.cs.

Referenced by AcUtils.AcStopWatch.Stop().