Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

i have made a small wrapper with hours #15

Open
GoogleCodeExporter opened this issue Mar 24, 2015 · 0 comments
Open

i have made a small wrapper with hours #15

GoogleCodeExporter opened this issue Mar 24, 2015 · 0 comments

Comments

@GoogleCodeExporter
Copy link

when add callback function,just like this:

class cboy
{
public:
    int add_age(int n) 
    {
        m_age += n;
        return m_age; 
    }

    void set_name(string name) 
    {
    }

    string do_some_thing(int n, double d, string str)
    {
        return "ok";
    }
private:
    int m_age;
};

static double mySqr(double d)
{ 
    return d*d;
}


static string myStringConcat(string strL, string strR) 
{
    return strL+strR;
}

static double myDoSomeThing(int n, double d, string str1, string str2)
{
    return n+d;
}

void test(CString str1)
{
    CTinyJS_Wrapper s;

    cboy boy;
    s.addExFun( MakeFunObj<int, Seq<int>>("add_boy_age", &boy, &cboy::add_age) );
    s.addExFun( MakeFunObj<void, Seq<string>>("set_boy_name", &boy, &cboy::set_name) );
    s.addExFun( MakeFunObj<string, Seq<int,double,string>>("boy_do_some_thing", &boy, &cboy::do_some_thing) );

    s.addExFun( MakeFunObj<double, Seq<double>>("sqr", &mySqr) );
    s.addExFun( MakeFunObj<string, Seq<string, string>>("strcon", &myStringConcat) );
    s.addExFun( MakeFunObj<double, Seq<int, double, string, string>>("do_some_thing", &myDoSomeThing) );

...
}


my email:kanbang@163.com
sorry for poor english

Original issue reported on code.google.com by kanb...@163.com on 22 Mar 2013 at 11:37

Attachments:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant