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
// Copyright (c) 2003 Daniel Wallin and Arvid Norberg // Permission is hereby granted, free of charge, to any person obtaining a // copy of this software and associated documentation files (the "Software"), // to deal in the Software without restriction, including without limitation // the rights to use, copy, modify, merge, publish, distribute, sublicense, // and/or sell copies of the Software, and to permit persons to whom the // Software is furnished to do so, subject to the following conditions: // The above copyright notice and this permission notice shall be included // in all copies or substantial portions of the Software. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF // ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED // TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A // PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT // SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR // ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE // OR OTHER DEALINGS IN THE SOFTWARE. #ifndef LUABIND_PROPERTY_HPP_INCLUDED #define LUABIND_PROPERTY_HPP_INCLUDED #include
#include
#include
#include
#include
#include
namespace luabind { namespace detail { namespace mpl = boost::mpl; class object_rep; /* template
int get(R(T::*f)() const, T* obj, lua_State* L, Policies* policies) { return returns
::call(f, obj, L, policies); } template
int get(R(*f)(const T*), T* obj, lua_State* L, Policies* policies) { return returns
::call(f, obj, L, policies); } template
int get(R(*f)(const T&), T* obj, lua_State* L, Policies* policies) { return returns
::call(f, obj, L, policies); } */ template
int get(R(C::*f)() const, T* obj, lua_State* L, Policies* policies) { return returns
::call(f, obj, L, policies); } template
int get(R(*f)(T), U* obj, lua_State* L, Policies* policies) { return returns
::call(f, obj, L, policies); } template
struct get_caller : Policies { get_caller() {} get_caller(const Policies& p): Policies(p) {} int operator()(lua_State* L, int pointer_offset, F f) { // parameters on the lua stack: // 1. object_rep // 2. key (property name) return get(f, (T*)0, L, static_cast
(this)); } }; template
int set(R(C::*f)(A1), T* obj, lua_State* L, Policies* policies) { return returns
::call(f, obj, L, policies); } /* template
int set(void(*f)(T*, A1), T* obj, lua_State* L, Policies* policies) { return returns
::call(f, obj, L, policies); } template
int set(void(*f)(T&, A1), T* obj, lua_State* L, Policies* policies) { return returns
::call(f, obj, L, policies); } */ template
int set(R(*f)(T, A1), U* obj, lua_State* L, Policies* policies) { return returns
::call(f, obj, L, policies); } template
struct set_caller : Policies { int operator()(lua_State* L, int pointer_offset, F f) { // parameters on the lua stack: // 1. object_rep // 2. key (property name) // 3. value // and since call() expects it's first // parameter on index 2 we need to // remove the key-parameter (parameter 2). lua_remove(L, 2); return luabind::detail::set(f, (T*)0, L, static_cast
(this)); } }; typedef int (*match_fun_ptr)(lua_State*, int); template
struct set_matcher { static int apply(lua_State* L, int index) { typedef typename find_conversion_policy<1, Policies>::type converter_policy; typedef typename mpl::apply_wrap2
::type converter; return converter::match(L, LUABIND_DECORATE_TYPE(T), index); } }; template
match_fun_ptr gen_set_matcher(void (*)(T, Param), Policy*) { return set_matcher
::apply; } template
match_fun_ptr gen_set_matcher(void (T::*)(Param), Policy*) { return set_matcher
::apply; } template
struct auto_set : Policies { auto_set() {} auto_set(const Policies& p): Policies(p) {} int operator()(lua_State* L, int pointer_offset, D T::*member) { int nargs = lua_gettop(L); // parameters on the lua stack: // 1. object_rep // 2. key (property name) // 3. value object_rep* obj = static_cast
(lua_touserdata(L, 1)); class_rep* crep = obj->crep(); void* raw_ptr; if (crep->has_holder()) raw_ptr = crep->extractor()(obj->ptr()); else raw_ptr = obj->ptr(); T* ptr = reinterpret_cast
(static_cast
(raw_ptr) + pointer_offset); typedef typename find_conversion_policy<1,Policies>::type converter_policy; typename mpl::apply_wrap2
::type converter; ptr->*member = converter.apply(L, LUABIND_DECORATE_TYPE(D), 3); int nret = lua_gettop(L) - nargs; const int indices[] = { 1, nargs + nret, 3 }; policy_list_postcall
::apply(L, indices); return nret; } }; // if the input type is a value_converter, it will produce // a reference converter template
struct make_reference_converter { typedef typename mpl::apply_wrap2< ConverterPolicy , typename boost::add_reference
::type , cpp_to_lua >::type type; }; template
struct auto_get : Policies { auto_get() {} auto_get(const Policies& p): Policies(p) {} int operator()(lua_State* L, int pointer_offset, D T::*member) { int nargs = lua_gettop(L); // parameters on the lua stack: // 1. object_rep // 2. key (property name) object_rep* obj = static_cast
(lua_touserdata(L, 1)); class_rep* crep = obj->crep(); void* raw_ptr; if (crep->has_holder()) raw_ptr = crep->extractor()(obj->ptr()); else raw_ptr = obj->ptr(); T* ptr = reinterpret_cast
(static_cast
(raw_ptr) + pointer_offset); typedef typename find_conversion_policy<0,Policies>::type converter_policy; typedef typename mpl::apply_wrap2
::type converter1_t; // if the converter is a valua converer, return a reference instead typedef typename boost::mpl::eval_if< BOOST_DEDUCED_TYPENAME converter1_t::is_value_converter , make_reference_converter
, mpl::identity
>::type converter2_t; // If this yields a reference converter, the dependency policy // is automatically added typedef typename boost::mpl::if_< BOOST_DEDUCED_TYPENAME converter1_t::is_value_converter , policy_cons
, Policies> , Policies >::type policy_list; converter2_t converter; converter.apply(L, ptr->*member); int nret = lua_gettop(L) - nargs; const int indices[] = { 1, nargs + nret }; policy_list_postcall
::apply(L, indices); return nret; } }; }} #endif // LUABIND_PROPERTY_HPP_INCLUDED
property.hpp
Page URL
File URL
Prev
38/43
Next
Download
( 7 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.