00001 00009 #ifndef __DURATION_H__ 00010 #define __DURATION_H__ 00011 00012 #if _MSC_VER > 1000 00013 #pragma once 00014 #endif // _MSC_VER > 1000 00015 00016 #include "PKIFdll.h" 00017 00018 // forward declaration 00019 struct CPKIFDurationImpl; 00020 class CPKIFTime; 00021 00030 class CAC_API CPKIFDuration 00031 { 00032 public: 00033 CPKIFDuration(); 00034 CPKIFDuration(const CPKIFDuration& duration_); 00035 ~CPKIFDuration(); 00036 //------------------------------------------------------------------ 00037 // Properties 00038 //------------------------------------------------------------------ 00039 double asSeconds() const; 00040 double asDays() const; 00041 //bool nearsSecond( double durationInSeconds_, double precision_=0.5 ) 00042 //{ 00043 // double result = asSeconds() - durationInSeconds_; 00044 // if( result <= precision_ && result >= -precision_ ) 00045 // { 00046 // return true; 00047 // } 00048 // return false; 00049 //} 00050 //bool nearsDay( double durationInDays_, double precision_=0.5 ) 00051 //{ 00052 // double result = asDays() - durationInDays_; 00053 // if( result <= precision_ && result >= -precision_ ) 00054 // { 00055 // return true; 00056 // } 00057 // return false; 00058 //} 00059 00060 //------------------------------------------------------------------ 00061 // Operations 00062 //------------------------------------------------------------------ 00063 void setSeconds(double seconds_); 00064 void setDays(double days_); 00065 //------------------------------------------------------------------ 00066 // Operators 00067 //------------------------------------------------------------------ 00068 CPKIFDuration& operator=(const CPKIFDuration& duration_); 00069 bool operator==(const CPKIFDuration& duration_) const; 00070 bool operator!=(const CPKIFDuration& duration_) const; 00071 bool operator>(const CPKIFDuration& duration_) const; 00072 bool operator>=(const CPKIFDuration& duration_) const; 00073 bool operator<(const CPKIFDuration& duration_) const; 00074 bool operator<=(const CPKIFDuration& duration_) const; 00075 CPKIFDuration& operator+=(const CPKIFDuration& duration_); 00076 CPKIFDuration& operator-=(const CPKIFDuration& duration_); 00077 CPKIFDuration operator+(const CPKIFDuration& duration_) const; 00078 CPKIFDuration operator-(const CPKIFDuration& duration_) const; 00079 CPKIFTime operator+(const CPKIFTime& time_); 00080 00081 private: 00082 struct CPKIFDurationImpl *m_impl; 00083 }; 00084 DECLARE_SMART_POINTERS(CPKIFDuration); 00085 00086 #endif //__DURATION_H__