void AppBinding::GetArguments(const ValueList& args, KValueRef result) { static KListRef argList(0); if (argList.isNull()) { // Skip the first argument which is the filename to the executable argList = new StaticBoundList(); for (int i = 1; i < host->GetCommandLineArgCount(); i++) argList->Append(Value::NewString(host->GetCommandLineArg(i))); } result->SetList(argList); }
void AppBinding::GetArguments(const ValueList& args, KValueRef result) { static KListRef argList(0); if (argList.isNull()) { // Skip the first argument which is the filename of the executable. std::vector<std::string>& args = host->GetApplication()->GetArguments(); argList = new StaticBoundList(); for (size_t i = 1; i < args.size(); i++) argList->Append(Value::NewString(args.at(i))); } result->SetList(argList); }
static void GetInterfaceList() { if (!interfaceList.isNull()) return; interfaceList = new StaticBoundList(); std::vector<NetworkInterface> list = NetworkInterface::list(); for (size_t i = 0; i < list.size(); i++) { NetworkInterface& interface = list[i]; interfaceList->Append(Value::NewObject(new Interface(interface))); if (!interface.address().isLoopback() && interface.address().isIPv4Compatible()) firstIPv4Address = interface.address().toString(); } }