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
// (C) Copyright Joel de Guzman 2003. // 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) #ifndef MAP_INDEXING_SUITE_JDG20038_HPP # define MAP_INDEXING_SUITE_JDG20038_HPP # include
# include
# include
# include
namespace boost { namespace python { // Forward declaration template
class map_indexing_suite; namespace detail { template
class final_map_derived_policies : public map_indexing_suite
> {}; } // The map_indexing_suite class is a predefined indexing_suite derived // class for wrapping std::map (and std::map like) classes. It provides // all the policies required by the indexing_suite (see indexing_suite). // Example usage: // // class X {...}; // // ... // // class_
>("XMap") // .def(map_indexing_suite
>()) // ; // // By default indexed elements are returned by proxy. This can be // disabled by supplying *true* in the NoProxy template parameter. // template < class Container, bool NoProxy = false, class DerivedPolicies = detail::final_map_derived_policies
> class map_indexing_suite : public indexing_suite< Container , DerivedPolicies , NoProxy , true , typename Container::value_type::second_type , typename Container::key_type , typename Container::key_type > { public: typedef typename Container::value_type value_type; typedef typename Container::value_type::second_type data_type; typedef typename Container::key_type key_type; typedef typename Container::key_type index_type; typedef typename Container::size_type size_type; typedef typename Container::difference_type difference_type; template
static void extension_def(Class& cl) { // Wrap the map's element (value_type) std::string elem_name = "map_indexing_suite_"; object class_name(cl.attr("__name__")); extract
class_name_extractor(class_name); elem_name += class_name_extractor(); elem_name += "_entry"; typedef typename mpl::if_< mpl::and_
, mpl::bool_ > , return_internal_reference<> , default_call_policies >::type get_data_return_policy; class_
(elem_name.c_str()) .def("__repr__", &DerivedPolicies::print_elem) .def("data", &DerivedPolicies::get_data, get_data_return_policy()) .def("key", &DerivedPolicies::get_key) ; } static object print_elem(typename Container::value_type const& e) { return "(%s, %s)" % python::make_tuple(e.first, e.second); } static typename mpl::if_< mpl::and_
, mpl::bool_ > , data_type& , data_type >::type get_data(typename Container::value_type& e) { return e.second; } static typename Container::key_type get_key(typename Container::value_type& e) { return e.first; } static data_type& get_item(Container& container, index_type i_) { typename Container::iterator i = container.find(i_); if (i == container.end()) { PyErr_SetString(PyExc_KeyError, "Invalid key"); throw_error_already_set(); } return i->second; } static void set_item(Container& container, index_type i, data_type const& v) { container[i] = v; } static void delete_item(Container& container, index_type i) { container.erase(i); } static size_t size(Container& container) { return container.size(); } static bool contains(Container& container, key_type const& key) { return container.find(key) != container.end(); } static bool compare_index(Container& container, index_type a, index_type b) { return container.key_comp()(a, b); } static index_type convert_index(Container& /*container*/, PyObject* i_) { extract
i(i_); if (i.check()) { return i(); } else { extract
i(i_); if (i.check()) return i(); } PyErr_SetString(PyExc_TypeError, "Invalid index type"); throw_error_already_set(); return index_type(); } }; }} // namespace boost::python #endif // MAP_INDEXING_SUITE_JDG20038_HPP
map_indexing_suite.hpp
Page URL
File URL
Prev
3/4
Next
Download
( 5 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.