?? date_base.cc
字號:
#include "mysqlcppapi/datetime/date_base.h"#if defined(__GNUC__) && __GNUC__ < 3// hack for GCC 2.9x# include <ostream.h>#else# include <ostream>#endif#include <iomanip>#include <cstdlib>namespace mysqlcppapi{std::ostream& date_base::out_stream (std::ostream& s) const{ char fill = s.fill('0'); std::ios::fmtflags flags = s.setf(std::ios::right); s << std::setw(4) << year << '-' << std::setw(2) << month << '-' << std::setw(2) << day; s.flags(flags); s.fill(fill); return s;}std::string::size_type date_base::convert (const std::string& str){ std::string::size_type i = 0; std::stringstream buf; buf << str.substr(i, 4) << ' '; i += 4; if (str.at(i) == '-') ++i; buf << str.substr(i, 2) << ' '; i += 2; if (str.at(i) == '-') ++i; const std::string& strDay = str.substr(i, 2); buf << strDay; i += strDay.size(); buf >> year >> month >> day; return i;}short int date_base::compare(const date_base* other) const{ if (short y = year - other->year) return y; if (short m = month - other->month) return m; return day - other->day;}} //namespace
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -