-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a stub hash proxy builder type. Add preliminary support to the co…
…ntroller.
- Loading branch information
1 parent
c331de9
commit dd4f013
Showing
2 changed files
with
104 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
namespace Rosella { namespace Proxy { namespace Builder | ||
{ | ||
class StringKeyedHash : Rosella.Proxy.Builder | ||
{ | ||
function setup_proxy_class(var target_class, var proxy_class) | ||
{ | ||
using Rosella.Proxy.Builder.Hash.intercept_get_pmc_keyed_str; | ||
using Rosella.Proxy.Builder.Hash.intercept_get_string_keyed_str; | ||
using Rosella.Proxy.Builder.Hash.intercept_get_integer_keyed_str; | ||
using Rosella.Proxy.Builder.Hash.intercept_set_pmc_keyed_str; | ||
using Rosella.Proxy.Builder.Hash.intercept_set_string_keyed_str; | ||
using Rosella.Proxy.Builder.Hash.intercept_set_integer_keyed_str; | ||
|
||
// TODO: delete_*_keyed_str | ||
// TODO: exists_*_keyed_str | ||
// TODO: Any of a million other keyed_str vtables. Nobody ever | ||
// said this would be cheap | ||
|
||
proxy_class.add_vtable_override("get_pmc_keyed_str", intercept_get_pmc_keyed_str); | ||
proxy_class.add_vtable_override("get_string_keyed_str", intercept_get_string_keyed_str); | ||
proxy_class.add_vtable_override("get_integer_keyed_str", intercept_get_integer_keyed_str); | ||
proxy_class.add_vtable_override("set_pmc_keyed_str", intercept_set_pmc_keyed_str); | ||
proxy_class.add_vtable_override("set_string_keyed_str", intercept_set_string_keyed_str); | ||
proxy_class.add_vtable_override("set_integer_keyed_str", intercept_set_integer_keyed_str); | ||
} | ||
|
||
function get_pmc_keyed_str(string key) | ||
{ | ||
using Rosella.Proxy.get_proxy_private_attr; | ||
var controller = get_proxy_private_attr(self, "proxy_controller"); | ||
if (controller != null) | ||
return controller.get_keyed(self, "pmc", "string", name); | ||
return null; | ||
} | ||
|
||
function get_string_keyed_str(string key) | ||
{ | ||
using Rosella.Proxy.get_proxy_private_attr; | ||
var controller = get_proxy_private_attr(self, "proxy_controller"); | ||
if (controller != null) | ||
return controller.get_keyed(self, "string", "string", name); | ||
return null; | ||
} | ||
|
||
function get_integer_keyed_str(string key) | ||
{ | ||
using Rosella.Proxy.get_proxy_private_attr; | ||
var controller = get_proxy_private_attr(self, "proxy_controller"); | ||
if (controller != null) | ||
return controller.get_keyed(self, "integer", "string", name); | ||
return null; | ||
} | ||
|
||
function set_pmc_keyed_str(string key, var value) | ||
{ | ||
using Rosella.Proxy.get_proxy_private_attr; | ||
var controller = get_proxy_private_attr(self, "proxy_controller"); | ||
if (controller != null) | ||
controller.set_keyed(self, "pmc", "string", name, value); | ||
} | ||
|
||
function set_string_keyed_str(string key, var value) | ||
{ | ||
using Rosella.Proxy.get_proxy_private_attr; | ||
var controller = get_proxy_private_attr(self, "proxy_controller"); | ||
if (controller != null) | ||
controller.set_keyed(self, "string", "string", name, value); | ||
} | ||
|
||
function set_integer_keyed_str(string key, var value) | ||
{ | ||
using Rosella.Proxy.get_proxy_private_attr; | ||
var controller = get_proxy_private_attr(self, "proxy_controller"); | ||
if (controller != null) | ||
controller.set_keyed(self, "integer", "string", name, value); | ||
} | ||
} | ||
|
||
class PMCKeyedHash : Rosella.Proxy.Builder | ||
{ | ||
//function setup_proxy_class(var target_class, var proxy_class) | ||
//{ | ||
// using Rosella.Proxy.Builder.Hash.intercept_get_pmc_keyed; | ||
// using Rosella.Proxy.Builder.Hash.intercept_get_string_keyed; | ||
// using Rosella.Proxy.Builder.Hash.intercept_get_integer_keyed; | ||
// using Rosella.Proxy.Builder.Hash.intercept_set_pmc_keyed; | ||
// using Rosella.Proxy.Builder.Hash.intercept_set_string_keyed; | ||
// using Rosella.Proxy.Builder.Hash.intercept_set_integer_keyed; | ||
} | ||
} |