x
Yes
No
Do you want to visit DriveHQ English website?
首页
产品服务
价格
免费试用
下载客户端
关于我们
云文件服务
|
云备份服务
|
FTP服务
|
企业邮箱服务
|
网站托管
|
客户端软件
云文件服务
云备份服务
FTP服务
企业级邮箱服务
网站托管
客户端软件
time_formatting_streams.hpp - Hosted on DriveHQ Cloud IT Platform
返回上层目录
上传
下载
共享
发布
新建文件夹
新建文件
复制
剪切
删除
粘贴
评论
升级服务
路径: \\game3dprogramming\materials\GameFactory\GameFactoryDemo\references\boost_1_35_0\boost\date_time\time_formatting_streams.hpp
旋转
特效
属性
历史版本
#ifndef DATE_TIME_TIME_FORMATTING_STREAMS_HPP___ #define DATE_TIME_TIME_FORMATTING_STREAMS_HPP___ /* Copyright (c) 2002,2003 CrystalClear Software, Inc. * Use, modification and distribution is subject to the * Boost Software License, Version 1.0. (See accompanying * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland, Bart Garst * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ */ #include "boost/date_time/date_formatting_locales.hpp" #include "boost/date_time/time_resolution_traits.hpp" #ifndef BOOST_DATE_TIME_NO_LOCALE namespace boost { namespace date_time { //! Put a time type into a stream using appropriate facets template
class ostream_time_duration_formatter { public: typedef std::basic_ostream
ostream_type; typedef typename time_duration_type::fractional_seconds_type fractional_seconds_type; //! Put time into an ostream static void duration_put(const time_duration_type& td, ostream_type& os) { if(td.is_special()) { os << td.get_rep(); } else { charT fill_char = '0'; if(td.is_negative()) { os << '-'; } os << std::setw(2) << std::setfill(fill_char) << absolute_value(td.hours()) << ":"; os << std::setw(2) << std::setfill(fill_char) << absolute_value(td.minutes()) << ":"; os << std::setw(2) << std::setfill(fill_char) << absolute_value(td.seconds()); fractional_seconds_type frac_sec = absolute_value(td.fractional_seconds()); if (frac_sec != 0) { os << "." << std::setw(time_duration_type::num_fractional_digits()) << std::setfill(fill_char) << frac_sec; } } // else } // duration_put }; //class ostream_time_duration_formatter //! Put a time type into a stream using appropriate facets template
class ostream_time_formatter { public: typedef std::basic_ostream
ostream_type; typedef typename time_type::date_type date_type; typedef typename time_type::time_duration_type time_duration_type; typedef ostream_time_duration_formatter
duration_formatter; //! Put time into an ostream static void time_put(const time_type& t, ostream_type& os) { date_type d = t.date(); os << d; if(!d.is_infinity() && !d.is_not_a_date()) { os << " "; //TODO: fix the separator here. duration_formatter::duration_put(t.time_of_day(), os); } } // time_to_ostream }; //class ostream_time_formatter //! Put a time period into a stream using appropriate facets template
class ostream_time_period_formatter { public: typedef std::basic_ostream
ostream_type; typedef typename time_period_type::point_type time_type; typedef ostream_time_formatter
time_formatter; //! Put time into an ostream static void period_put(const time_period_type& tp, ostream_type& os) { os << '['; //TODO: facet or manipulator for periods? time_formatter::time_put(tp.begin(), os); os << '/'; //TODO: facet or manipulator for periods? time_formatter::time_put(tp.last(), os); os << ']'; } // period_put }; //class ostream_time_period_formatter } } //namespace date_time #endif //BOOST_DATE_TIME_NO_LOCALE #endif
time_formatting_streams.hpp
网页地址
文件地址
上一页
50/60
下一页
下载
( 3 KB )
Comments
Total ratings:
0
Average rating:
无评论
of 10
Would you like to comment?
Join now
, or
Logon
if you are already a member.