diff options
author | Caolán McNamara <caolanm@redhat.com> | 2011-06-16 23:13:53 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2011-06-17 14:05:13 +0100 |
commit | 4c4c31303f9915915c56e3bdbe1d8b87b530633f (patch) | |
tree | c93e6768f3120631ee18a63573f577a75d545a11 | |
parent | dccd996c012a2a63307d5682b52187f12d82531f (diff) |
throw out some unused methods
-rw-r--r-- | cosv/inc/cosv/comfunc.hxx | 48 | ||||
-rw-r--r-- | cosv/source/service/comfunc.cxx | 91 |
2 files changed, 0 insertions, 139 deletions
diff --git a/cosv/inc/cosv/comfunc.hxx b/cosv/inc/cosv/comfunc.hxx index 8b7bb1c0..625f746b 100644 --- a/cosv/inc/cosv/comfunc.hxx +++ b/cosv/inc/cosv/comfunc.hxx @@ -54,32 +54,6 @@ inline bool no_str(const char * str); // return !str || !strlen(st intt count_chars(const char * str, char c); -// endian functions -template <class NUMTYPE> -void switch_endian( - NUMTYPE & o_rNumber, - const NUMTYPE & i_rNumber ); - -// Zeit-Typecasts -bool str2date(const char * str, int & out_day, int & out_month, int & out_year); -void date2str(String & out_Str, int day, int month, int year); -bool str2time(const char * str, int & out_hour, int & out_min, int & out_sec); -void time2str(String & out_Str, int hour, int min, int sec); - -class noncopyable -{ - protected: - noncopyable() {} - ~noncopyable() {} - private: - // Private to make copying impossible: - noncopyable(const noncopyable&); - noncopyable & operator=(const noncopyable&); -}; - - - - // IMPLEMENTATION template <class E> inline E @@ -96,33 +70,11 @@ valid_str(const char * str) { return str != 0 ? str : ""; } inline bool no_str(const char * str) { return str != 0 ? *str == '\0' : true; } - -template <class NUMTYPE> -void -switch_endian( NUMTYPE & o_rNumber, - const NUMTYPE & i_rNumber ) -{ - char * pFront = reinterpret_cast< char* >(&o_rNumber); - const char * pBack = reinterpret_cast< const char* >(&i_rNumber) + sizeof(NUMTYPE); - - for ( size_t p = 0; p < sizeof(NUMTYPE); --p ) - { - *pFront++ = *(--pBack); - } -} - - } // namespace csv - - - #define NON_COPYABLE(xy) \ private: xy(const xy &); xy & operator=(const xy &) - - - #endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cosv/source/service/comfunc.cxx b/cosv/source/service/comfunc.cxx index 82d0ae83..201f6a93 100644 --- a/cosv/source/service/comfunc.cxx +++ b/cosv/source/service/comfunc.cxx @@ -61,97 +61,6 @@ count_chars(const char * str, char c) return nCount; } - - -// Zeit-Typecasts -bool -str2date(const char * str, int & out_day, int & out_month, int & out_year) -{ - const char * z = str; - out_day = 0; - out_month = 0; - out_year = 0; - - while (isdigit(*z)) - out_day = 10*out_day + *(z++) - '0'; - if (*z == 0) - return false; - z++; - while (isdigit(*z)) - out_month = 10*out_month + *(z++) - '0'; - if (*z == 0) - return false; - z++; - while (isdigit(*z)) - out_year = 10*out_year + *(z++) - '0'; - return true; -} - -void -date2str(String & out_Str, int day, int month, int year) -{ - char buf[11] = "00.00.0000"; - buf[0] = static_cast<char>(day/10 + '0'); - buf[1] = static_cast<char>(day%10 + '0'); - buf[3] = static_cast<char>(month/10 + '0'); - buf[4] = static_cast<char>(month%10 + '0'); - - if (year < 100) - { - buf[6] = static_cast<char>(year/10 + '0'); - buf[7] = static_cast<char>(year%10 + '0'); - buf[8] = 0; - } - else - { - buf[6] = static_cast<char>(year/1000 + '0'); - buf[7] = static_cast<char>(year%1000/100 + '0'); - buf[8] = static_cast<char>(year%100/10 + '0'); - buf[9] = static_cast<char>(year%10 + '0'); - } - out_Str = buf; -} - -bool -str2time(const char * str, int & out_hour, int & out_min, int & out_sec) -{ - const char * z = str; - out_hour = 0; - out_min = 0; - out_sec = 0; - - while (isdigit(*z)) - out_hour = 10*out_hour + *(z++) - '0'; - if (*z == 0) - return false; - z++; - while (isdigit(*z)) - out_min = 10*out_min + *(z++) - '0'; - if (*z == 0) - return false; - z++; - while (isdigit(*z)) - out_sec = 10*out_sec + *(z++) - '0'; - return true; -} - -void -time2str(String & out_Str, int hour, int min, int sec) -{ - char buf[9] = "00:00:00"; - buf[0] = static_cast<char>(hour/10 + '0'); - buf[1] = static_cast<char>(hour%10 + '0'); - buf[3] = static_cast<char>(min/10 + '0'); - buf[4] = static_cast<char>(min%10 + '0'); - buf[6] = static_cast<char>(sec/10 + '0'); - buf[7] = static_cast<char>(sec%10 + '0'); - out_Str = buf; -} - - - } // namespace csv - - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |