A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://raw.githubusercontent.com/charto/nbind-examples/master/5-objects.cc below:

#include #include "nbind/api.h" class Coord { public: Coord(signed int x = 0, signed int y = 0) : x(x), y(y) {} explicit Coord(const Coord *other) : x(other->x), y(other->y) {} void toJS(nbind::cbOutput output) { output(x, y); } signed int getX() { std::cout << "Get X\n"; return(x); } signed int getY() { std::cout << "Get Y\n"; return(y); } void setX(signed int x) { this->x = x; } void setY(signed int y) { this->y = y; } signed int x, y; }; class ObjectExample { public: static void showByValue(Coord coord) { std::cout << "C++ value " << coord.x << ", " << coord.y << "\n"; } static void showByRef(Coord *coord) { std::cout << "C++ ref " << coord->x << ", " << coord->y << "\n"; } static Coord getValue() { return(Coord(12, 34)); } static Coord *getRef() { static Coord coord(56, 78); return(&coord); } }; #include "nbind/nbind.h" NBIND_CLASS(Coord) { construct<>(); construct (); construct (); getset(getX, setX); getset(getY, setY); } NBIND_CLASS(ObjectExample) { method(showByValue); method(showByRef); method(getValue); method(getRef); }

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4