Status: Unconfirmed
Owner: [EMAIL PROTECTED]
Labels: Type-Bug Pri-2 OS-All Area-Misc

New issue 4926 by marshall.law: CppBoundClass getter/setter binding patch
http://code.google.com/p/chromium/issues/detail?id=4926

CppBoundClass is limited to binding javascript property objects to instance
members of the class. This patch allows binding a getter and setter to a
property name, i.e.:

class JsObject : public CppBoundClass
{
public:
   int x;

   JsObject() {
     BindProperty("x", &JsObject::getX, &JsObject::setX);
   }

   void getX(const CppArgumentList &args, CppVariant *result) {
     result->Set(x);
   }

   void setX(const CppArgumentList &args, CppVariant *result) {
     int x = args[0].toInt32();
     if (x > 0) { this->x = x; }
   }
};

// JsObject instance bound as "object"
object.x = 100;
object.x = -1;
alert(object.x);
// should be 100


Attachments:
        cpp_bound_class_patch2.txt  11.2 KB

-- 
You received this message because you are listed in the owner
or CC fields of this issue, or because you starred this issue.
You may adjust your issue notification preferences at:
http://code.google.com/hosting/settings

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Chromium-bugs" group.
To post to this group, send email to chromium-bugs@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/chromium-bugs?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to