Changeset 36 for pjproject/main/pjlib/include/pj++/types.hpp
- Timestamp:
- Nov 9, 2005 3:37:19 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/main/pjlib/include/pj++/types.hpp
r29 r36 7 7 #include <pj/types.h> 8 8 9 class PJ_Pool; 10 class PJ_Socket; 9 class Pj_Pool; 10 class Pj_Socket ; 11 class Pj_Lock; 11 12 12 13 13 class PJ_Time_Val : public pj_time_val 14 // 15 // PJLIB initializer. 16 // 17 class Pjlib 14 18 { 15 19 public: 16 PJ_Time_Val() {} 17 PJ_Time_Val(const PJ_Time_Val &rhs) { sec=rhs.sec; msec=rhs.msec; } 18 explicit PJ_Time_Val(const pj_time_val &tv) { sec = tv.sec; msec = tv.msec; } 20 Pjlib() 21 { 22 pj_init(); 23 } 24 }; 19 25 20 long get_sec() const { return sec; } 21 long get_msec() const { return msec; } 22 void set_sec (long s) { sec = s; } 23 void set_msec(long ms) { msec = ms; normalize(); } 24 long to_msec() const { return PJ_TIME_VAL_MSEC((*this)); } 26 // 27 // Class Pj_Object is declared in pool.hpp 28 // 25 29 26 bool operator == (const PJ_Time_Val &rhs) const { return PJ_TIME_VAL_EQ((*this), rhs); } 27 bool operator > (const PJ_Time_Val &rhs) const { return PJ_TIME_VAL_GT((*this), rhs); } 28 bool operator >= (const PJ_Time_Val &rhs) const { return PJ_TIME_VAL_GTE((*this), rhs); } 29 bool operator < (const PJ_Time_Val &rhs) const { return PJ_TIME_VAL_LT((*this), rhs); } 30 bool operator <= (const PJ_Time_Val &rhs) const { return PJ_TIME_VAL_LTE((*this), rhs); } 30 // 31 // Time value wrapper. 32 // 33 class Pj_Time_Val : public pj_time_val 34 { 35 public: 36 Pj_Time_Val() 37 { 38 } 31 39 32 PJ_Time_Val & operator = (const PJ_Time_Val &rhs) { 40 Pj_Time_Val(long init_sec, long init_msec) 41 { 42 sec = init_sec; 43 msec = init_msec; 44 } 45 46 Pj_Time_Val(const Pj_Time_Val &rhs) 47 { 48 sec=rhs.sec; 49 msec=rhs.msec; 50 } 51 52 explicit Pj_Time_Val(const pj_time_val &tv) 53 { 54 sec = tv.sec; 55 msec = tv.msec; 56 } 57 58 long get_sec() const 59 { 60 return sec; 61 } 62 63 long get_msec() const 64 { 65 return msec; 66 } 67 68 void set_sec (long s) 69 { 70 sec = s; 71 } 72 73 void set_msec(long ms) 74 { 75 msec = ms; 76 normalize(); 77 } 78 79 long to_msec() const 80 { 81 return PJ_TIME_VAL_MSEC((*this)); 82 } 83 84 bool operator == (const Pj_Time_Val &rhs) const 85 { 86 return PJ_TIME_VAL_EQ((*this), rhs); 87 } 88 89 bool operator > (const Pj_Time_Val &rhs) const 90 { 91 return PJ_TIME_VAL_GT((*this), rhs); 92 } 93 94 bool operator >= (const Pj_Time_Val &rhs) const 95 { 96 return PJ_TIME_VAL_GTE((*this), rhs); 97 } 98 99 bool operator < (const Pj_Time_Val &rhs) const 100 { 101 return PJ_TIME_VAL_LT((*this), rhs); 102 } 103 104 bool operator <= (const Pj_Time_Val &rhs) const 105 { 106 return PJ_TIME_VAL_LTE((*this), rhs); 107 } 108 109 Pj_Time_Val & operator = (const Pj_Time_Val &rhs) 110 { 33 111 sec = rhs.sec; 34 112 msec = rhs.msec; … … 36 114 } 37 115 38 PJ_Time_Val & operator += (const PJ_Time_Val &rhs) { 116 Pj_Time_Val & operator += (const Pj_Time_Val &rhs) 117 { 39 118 PJ_TIME_VAL_ADD((*this), rhs); 40 119 return *this; 41 120 } 42 121 43 PJ_Time_Val & operator -= (const PJ_Time_Val &rhs) { 122 Pj_Time_Val & operator -= (const Pj_Time_Val &rhs) 123 { 44 124 PJ_TIME_VAL_SUB((*this), rhs); 45 125 return *this; … … 47 127 48 128 /* Must include os.hpp to use these, otherwise unresolved in linking */ 49 pj_status_t gettimeofday();50 pj_parsed_timedecode();51 pj_status_tencode(const pj_parsed_time *pt);52 pj_status_tto_gmt();53 pj_status_tto_local();129 inline pj_status_t gettimeofday(); 130 inline pj_parsed_time decode(); 131 inline pj_status_t encode(const pj_parsed_time *pt); 132 inline pj_status_t to_gmt(); 133 inline pj_status_t to_local(); 54 134 55 135 56 136 private: 57 void normalize() { pj_time_val_normalize(this); } 137 void normalize() 138 { 139 pj_time_val_normalize(this); 140 } 58 141 59 142 };
Note: See TracChangeset
for help on using the changeset viewer.