DriveHQ Start Menu
Cloud Drive Mapping
Folder Sync
Cloud Backup
True Drop Box
FTP/SFTP Hosting
Group Account
DriveHQ Start Menu
Online File Server
My Storage
|
Manage Shares
|
Publishes
|
Drop Boxes
|
Group Account
WebDAV Drive Mapping
Cloud Drive Home
|
WebDAV Guide
|
Drive Mapping Tool
|
Drive Mapping URL
Complete Data Backup
Backup Guide
|
Online Backup Tool
|
Cloud-to-Cloud Backup
FTP, Email & Web Service
FTP Home
|
FTP Hosting FAQ
|
Email Hosting
|
EmailManager
|
Web Hosting
Help & Resources
About
|
Enterprise Service
|
Partnership
|
Comparisons
|
Support
Quick Links
Security and Privacy
Download Software
Service Manual
Use Cases
Group Account
Online Help
Blog
Contact
Cloud Surveillance
Sign Up
Login
Features
Business Features
Online File Server
FTP Hosting
Cloud Drive Mapping
Cloud File Backup
Email Backup & Hosting
Cloud File Sharing
Folder Synchronization
Group Management
True Drop Box
Full-text Search
AD Integration/SSO
Mobile Access
IP Camera & DVR Solution
More...
Personal Features
Personal Cloud Drive
Backup All Devices
Mobile APPs
Personal Web Hosting
Sub-Account (for Kids)
Home/PC/Kids Monitoring
More...
Software
DriveHQ Drive Mapping Tool
DriveHQ FileManager
DriveHQ Online Backup
DriveHQ Mobile Apps
Pricing
Business Plans & Pricing
Personal Plans & Pricing
Price Comparison with Others
Feature Comparison with Others
Install Mobile App
Sign up
Creating account...
Invalid character in username! Only 0-9, a-z, A-Z, _, -, . allowed.
Username is required!
Invalid email address!
E-mail is required!
Password is required!
Password is invalid!
Password and confirmation do not match.
Confirm password is required!
I accept
Membership Agreement
Please read the Membership Agreement and check "I accept"!
Free Quick Sign-up
Sign-up Page
Log in
Signing in...
Username or e-mail address is required!
Password is required!
Keep me logged in
Quick Login
Forgot Password
Up
Upload
Download
Share
Publish
New Folder
New File
Copy
Cut
Delete
Paste
Rate
Upgrade
Rotate
Effect
Edit
Slide
History
#ifndef DATE_TIME_STRINGS_FROM_FACET__HPP___ #define DATE_TIME_STRINGS_FROM_FACET__HPP___ /* Copyright (c) 2004 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 * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ */ #include
#include
#include
#include
namespace boost { namespace date_time { //! This function gathers up all the month strings from a std::locale /*! Using the time_put facet, this function creates a collection of * all the month strings from a locale. This is handy when building * custom date parsers or formatters that need to be localized. * *@param charT The type of char to use when gathering typically char * or wchar_t. *@param locale The locale to use when gathering the strings *@param short_strings True(default) to gather short strings, * false for long strings. *@return A vector of strings containing the strings in order. eg: * Jan, Feb, Mar, etc. */ template
std::vector
> gather_month_strings(const std::locale& locale, bool short_strings=true) { typedef std::basic_string
string_type; typedef std::vector
collection_type; typedef std::basic_ostringstream
ostream_type; typedef std::ostreambuf_iterator
ostream_iter_type; typedef std::basic_ostringstream
stringstream_type; typedef std::time_put
time_put_facet_type; charT short_fmt[3] = { '%', 'b' }; charT long_fmt[3] = { '%', 'B' }; collection_type months; string_type outfmt(short_fmt); if (!short_strings) { outfmt = long_fmt; } { //grab the needed strings by using the locale to //output each month for (int m=0; m < 12; m++) { tm tm_value; tm_value.tm_mon = m; stringstream_type ss; ostream_iter_type oitr(ss); std::use_facet
(locale).put(oitr, ss, ss.fill(), &tm_value, &*outfmt.begin(), &*outfmt.begin()+outfmt.size()); months.push_back(ss.str()); } } return months; } //! This function gathers up all the weekday strings from a std::locale /*! Using the time_put facet, this function creates a collection of * all the weekday strings from a locale starting with the string for * 'Sunday'. This is handy when building custom date parsers or * formatters that need to be localized. * *@param charT The type of char to use when gathering typically char * or wchar_t. *@param locale The locale to use when gathering the strings *@param short_strings True(default) to gather short strings, * false for long strings. *@return A vector of strings containing the weekdays in order. eg: * Sun, Mon, Tue, Wed, Thu, Fri, Sat */ template
std::vector
> gather_weekday_strings(const std::locale& locale, bool short_strings=true) { typedef std::basic_string
string_type; typedef std::vector
collection_type; typedef std::basic_ostringstream
ostream_type; typedef std::ostreambuf_iterator
ostream_iter_type; typedef std::basic_ostringstream
stringstream_type; typedef std::time_put
time_put_facet_type; charT short_fmt[3] = { '%', 'a' }; charT long_fmt[3] = { '%', 'A' }; collection_type weekdays; string_type outfmt(short_fmt); if (!short_strings) { outfmt = long_fmt; } { //grab the needed strings by using the locale to //output each month / weekday for (int i=0; i < 7; i++) { tm tm_value; tm_value.tm_wday = i; stringstream_type ss; ostream_iter_type oitr(ss); std::use_facet
(locale).put(oitr, ss, ss.fill(), &tm_value, &*outfmt.begin(), &*outfmt.begin()+outfmt.size()); weekdays.push_back(ss.str()); } } return weekdays; } } } //namespace #endif
strings_from_facet.hpp
Page URL
File URL
Prev
43/60
Next
Download
( 4 KB )
Note: The DriveHQ service banners will NOT be displayed if the file owner is a paid member.
Comments
Total ratings:
0
Average rating:
Not Rated
Would you like to comment?
Join DriveHQ
for a free account, or
Logon
if you are already a member.