// // NodejsImpl.cpp #include "common/RhoStd.h" #include "common/AutoPointer.h" #include "common/RhodesApp.h" #include "common/RhoConf.h" #include "generated/cpp/NodejsBase.h" #include "logging/RhoLog.h" #include "jxcoretau.h" #ifdef OS_ANDROID extern "C" void rho_android_file_reload_stat_table(); extern "C" void rho_android_force_all_files(); #endif namespace rho { using namespace apiGenerator; using namespace common; class CNodejsSingletonImpl: public CNodejsSingletonBase { public: CNodejsSingletonImpl(): CNodejsSingletonBase(){} //methods // executeJavascript Execute JavaScript in Node.js context(and in main Node.js thread). virtual void executeJavascript( const rho::String& javascriptText, rho::apiGenerator::CMethodResult& oResult) { // RAWLOGC_INFO("executeJavascript("+javascriptText+")","Nodejs"); jxcoretau_execute_javascript(javascriptText.c_str()); } // getProperty This method will return the value of the propertyName that is passed in. The propertyName must be a valid property of the API class. virtual void getProperty( const rho::String& propertyName, rho::apiGenerator::CMethodResult& oResult) { // RAWLOGC_INFO("getProperty","Nodejs"); } // getProperties This method will return a set of object/value pairs for the list of the propertyName that is passed in. The propertyNames must be a valid property of the API class. virtual void getProperties( const rho::Vector& arrayofNames, rho::apiGenerator::CMethodResult& oResult) { // RAWLOGC_INFO("getProperties","Nodejs"); } // getAllProperties This method will return all of object/value pairs for the propertyNames of the API class. virtual void getAllProperties(rho::apiGenerator::CMethodResult& oResult) { // RAWLOGC_INFO("getAllProperties","Nodejs"); } // setProperty This method will set the value of a property for the API class. The propertyName must be a valid property for the class and must also not be read only. virtual void setProperty( const rho::String& propertyName, const rho::String& propertyValue, rho::apiGenerator::CMethodResult& oResult) { // RAWLOGC_INFO("setProperty","Nodejs"); } // setProperties This method will set the values of a list of properties for the API class. The propertyName must be a valid property for the class and must also not be read only. virtual void setProperties( const rho::Hashtable& propertyMap, rho::apiGenerator::CMethodResult& oResult) { // RAWLOGC_INFO("setProperties","Nodejs"); } }; class CNodejsImpl : public CNodejsBase { public: virtual ~CNodejsImpl() {} //methods }; //////////////////////////////////////////////////////////////////////// class CNodejsFactory: public CNodejsFactoryBase { public: CNodejsFactory(){} INodejsSingleton* createModuleSingleton() { return new CNodejsSingletonImpl(); } virtual INodejs* createModuleByID(const rho::String& strID){ return new CNodejsImpl(); }; }; } extern "C" void Init_Nodejs_extension() { rho::CNodejsFactory::setInstance( new rho::CNodejsFactory() ); rho::Init_Nodejs_API(); #ifdef OS_ANDROID rho_android_force_all_files(); rho_android_file_reload_stat_table(); #endif jxcoretau_init(); }