⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 date_base.cc

📁 有关MYSQL的开源码
💻 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 + -