DriveHQ Start Menu
Cloud Drive Mapping
Folder Sync
True Drop Box
FTP/SFTP Hosting
Group Account
Team Anywhere
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
|
Cloud-to-Cloud Backup
|
DVR/Camera Backup
FTP, Email & Web Service
FTP/SFTP Hosting
|
Email Hosting
|
Web Hosting
|
Webcam Hosting
Other Products & Services
Team Anywhere
|
Connect to Remote PC
|
Cloud Surveillance
|
Virtual CCTV NVR
Quick Links
Security and Privacy
Customer Support
Service Manual
Use Cases
Group Account
Online Help
Support Forum
Contact Us
About DriveHQ
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
Personal Features
Personal Cloud Drive
Backup All Devices
Mobile APPs
Personal Web Hosting
Sub-Account (for Kids)
Home/PC/Kids Monitoring
Other Features
Team Anywhere (Remote Desktop Service)
CameraFTP Cloud Surveillance
Software
DriveHQ Drive Mapping Tool
DriveHQ FileManager
DriveHQ Online Backup
DriveHQ Team Anywhere for Windows (Beta)
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
// Copyright Vladimir Prus 2004. // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt // or copy at http://www.boost.org/LICENSE_1_0.txt) // This file defines template functions that are declared in // ../value_semantic.hpp. #include
namespace boost { namespace program_options { extern BOOST_PROGRAM_OPTIONS_DECL std::string arg; template
std::string typed_value
::name() const { if (!m_implicit_value.empty() && !m_implicit_value_as_text.empty()) { std::string msg = "[=arg(=" + m_implicit_value_as_text + ")]"; if (!m_default_value.empty() && !m_default_value_as_text.empty()) msg += " (=" + m_default_value_as_text + ")"; return msg; } else if (!m_default_value.empty() && !m_default_value_as_text.empty()) { return arg + " (=" + m_default_value_as_text + ")"; } else { return arg; } } template
void typed_value
::notify(const boost::any& value_store) const { const T* value = boost::any_cast
(&value_store); if (m_store_to) { *m_store_to = *value; } if (m_notifier) { m_notifier(*value); } } namespace validators { /* If v.size() > 1, throw validation_error. If v.size() == 1, return v.front() Otherwise, returns a reference to a statically allocated empty string if 'allow_empty' and throws validation_error otherwise. */ template
const std::basic_string
& get_single_string( const std::vector
>& v, bool allow_empty = false) { static std::basic_string
empty; if (v.size() > 1) throw validation_error("multiple values not allowed"); if (v.size() == 1) return v.front(); else if (allow_empty) return empty; else throw validation_error("at least one value required"); } /* Throws multiple_occurrences if 'value' is not empty. */ BOOST_PROGRAM_OPTIONS_DECL void check_first_occurrence(const boost::any& value); } using namespace validators; /** Validates 's' and updates 'v'. @pre 'v' is either empty or in the state assigned by the previous invocation of 'validate'. The target type is specified via a parameter which has the type of pointer to the desired type. This is workaround for compilers without partial template ordering, just like the last 'long/int' parameter. */ template
void validate(boost::any& v, const std::vector< std::basic_string
>& xs, T*, long) { validators::check_first_occurrence(v); std::basic_string
s(validators::get_single_string(xs)); try { v = any(lexical_cast
(s)); } catch(const bad_lexical_cast&) { boost::throw_exception(invalid_option_value(s)); } } BOOST_PROGRAM_OPTIONS_DECL void validate(boost::any& v, const std::vector
& xs, bool*, int); #if !defined(BOOST_NO_STD_WSTRING) BOOST_PROGRAM_OPTIONS_DECL void validate(boost::any& v, const std::vector
& xs, bool*, int); #endif // For some reason, this declaration, which is require by the standard, // cause gcc 3.2 to not generate code to specialization defined in // value_semantic.cpp #if ! ( ( BOOST_WORKAROUND(__GNUC__, <= 3) &&\ BOOST_WORKAROUND(__GNUC_MINOR__, < 3) ) || \ ( BOOST_WORKAROUND(BOOST_MSVC, == 1310) ) \ ) BOOST_PROGRAM_OPTIONS_DECL void validate(boost::any& v, const std::vector
& xs, std::string*, int); #if !defined(BOOST_NO_STD_WSTRING) BOOST_PROGRAM_OPTIONS_DECL void validate(boost::any& v, const std::vector
& xs, std::string*, int); #endif #endif /** Validates sequences. Allows multiple values per option occurrence and multiple occurrences. */ template
void validate(boost::any& v, const std::vector
>& s, std::vector
*, int) { if (v.empty()) { v = boost::any(std::vector
()); } std::vector
* tv = boost::any_cast< std::vector
>(&v); assert(NULL != tv); for (unsigned i = 0; i < s.size(); ++i) { try { /* We call validate so that if user provided a validator for class T, we use it even when parsing vector
. */ boost::any a; std::vector
> v; v.push_back(s[i]); validate(a, v, (T*)0, 0); tv->push_back(boost::any_cast
(a)); } catch(const bad_lexical_cast& /*e*/) { boost::throw_exception(invalid_option_value(s[i])); } } } template
void typed_value
:: xparse(boost::any& value_store, const std::vector
>& new_tokens) const { // If no tokens were given, and the option accepts an implicit // value, then assign the implicit value as the stored value; // otherwise, validate the user-provided token(s). if (new_tokens.empty() && !m_implicit_value.empty()) value_store = m_implicit_value; else validate(value_store, new_tokens, (T*)0, 0); } template
typed_value
* value() { // Explicit qualification is vc6 workaround. return boost::program_options::value
(0); } template
typed_value
* value(T* v) { typed_value
* r = new typed_value
(v); return r; } template
typed_value
* wvalue() { return wvalue
(0); } template
typed_value
* wvalue(T* v) { typed_value
* r = new typed_value
(v); return r; } }}
value_semantic.hpp
Page URL
File URL
Prev
6/6 Next
Download
( 6 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.