Update browser bridge functions names retrieval

This commit is contained in:
Ralph Wessel
2024-09-19 22:02:39 +01:00
parent 3c1a4f9694
commit 9f35e86372
5 changed files with 17 additions and 17 deletions
+1
View File
@@ -29,6 +29,7 @@ namespace {
ConnectorInstance(const String& name) : ConnectorAddon{name} {
add<ConnectorMenu>();
add<ConnectorPalette>();
//The connector 'owns' the model card database, so the publisher list should only hold a weak reference
addWeak(m_modelCards.getSubscription());
}
@@ -53,13 +53,13 @@ BrowserBridge::~BrowserBridge() {
/*--------------------------------------------------------------------
Get the names of the methods supported by this bridge
return: The supported method names
--------------------------------------------------------------------*/
ValueSetting BrowserBridge::getMethodNames() const {
ValueSetting result;
std::vector<String> BrowserBridge::getMethodNames() const {
std::vector<String> result;
for (const auto& method : *m_methods)
result.emplace_back(StringValue{method->getName()});
result.emplace_back(method->getName());
return result;
} //BrowserBridge::getMethodNames
@@ -27,7 +27,7 @@ namespace speckle::interfac::browser::bridge {
Constructor
@param name The JS object name
*/
BrowserBridge(const speckle::utility::String& name);
BrowserBridge(const utility::String& name);
/*!
Destructor
*/
@@ -39,7 +39,7 @@ namespace speckle::interfac::browser::bridge {
Get the names of the methods supported by this bridge
@return The supported method names
*/
active::setting::ValueSetting getMethodNames() const;
std::vector<utility::String> getMethodNames() const;
/*!
Get a browser method by name
@return A pointer to the requested method (owner does not take ownership, nullptr = failure)
@@ -6,21 +6,21 @@ using namespace active::serialise;
using namespace speckle::serialise::jsbase;
using namespace speckle::interfac::browser;
using namespace speckle::interfac::browser::bridge;
using namespace speckle::utility;
/*--------------------------------------------------------------------
Constructor
bridge: The parent bridge object (provides access to bridge methods)
--------------------------------------------------------------------*/
GetBindingsMethodNames::GetBindingsMethodNames() : JSFunction{"GetBindingsMethodNames", [&]() {
return getMethodNames();
}} {
} //GetBindingsMethodNames::GetBindingsMethodNames
}} {} //GetBindingsMethodNames::GetBindingsMethodNames
/*--------------------------------------------------------------------
Get the names of the methods supported by the parent browser
return: The supported method names
--------------------------------------------------------------------*/
std::unique_ptr<WrappedValue> GetBindingsMethodNames::getMethodNames() const {
@@ -2,17 +2,16 @@
#define SPECKLE_INTERFACE_BRIDGE_GET_METHOD_NAMES
#include "Active/Serialise/CargoHold.h"
#include "Active/Serialise/Package/Wrapper/ContainerWrap.h"
#include "Active/Serialise/Package/Wrapper/ValueSettingWrap.h"
#include "Speckle/Interface/Browser/PlatformBinding.h"
#include "Speckle/Interface/Browser/JSFunction.h"
#include "Speckle/Interface/Browser/Bridge/BridgeChild.h"
namespace speckle::interfac::browser::bridge {
class BrowserBridge;
using WrappedValue = active::serialise::CargoHold<active::serialise::ValueSettingWrap, active::setting::ValueSetting>;
using WrappedValue = active::serialise::CargoHold<active::serialise::ContainerWrap<std::vector<utility::String>>, std::vector<utility::String>>;
/*!
JS Function class to retrieve the names of the methods supported by the bridge
*/
@@ -20,12 +19,12 @@ namespace speckle::interfac::browser::bridge {
public:
// MARK: - Constructors
/*!
Default constructor
*/
GetBindingsMethodNames();
private:
/*!
Get the names of the methods supported by the parent browser