Compare commits

..

14 Commits

Author SHA1 Message Date
Ralph Wessel 7393fac437 Version bump 2024-09-09 13:07:05 +01:00
Ralph Wessel 997545b6ac Updated VS projects 2024-09-09 13:03:13 +01:00
Ralph Wessel ea3152d942 Added GetSendFilter
Reactivated sendBinding
2024-09-09 12:59:07 +01:00
Ralph Wessel 0b00af7d1d Updated VS project
Temporarily deactived "sendBinding" - appears to stop usual palette rendering (possibly further implementation required)
2024-09-09 09:39:47 +01:00
Ralph Wessel c68d2f3e25 Added placeholder Send binding 2024-09-09 09:28:00 +01:00
Ralph Wessel 9acc058f07 Simplified add/install syntax 2024-09-08 23:01:22 +01:00
Ralph Wessel c14e3ac095 Use system-path include for AC API headers to avoid API-code warnings 2024-09-06 23:38:57 +01:00
Ralph Wessel 83f38e946e Added account send test 2024-09-06 23:21:50 +01:00
Ralph Wessel 09bf8f9ffa Restructured objects to support optional (nullable) members 2024-09-06 18:55:13 +01:00
Ralph Wessel 7aa4cc9a51 Updated Xcode project 2024-09-06 09:24:14 +01:00
Jedd Morgan f22b19993a Added GetIsDevMode (#3) 2024-09-05 16:50:53 +01:00
Ralph Wessel 70ebe53335 Added unit test for account deserialisation 2024-09-05 14:42:37 +01:00
Ralph Wessel 6d0340b310 Merge tag '0.2.1' into develop
0.2.1
2024-09-05 12:02:17 +01:00
Ralph Wessel b491d901a1 Merge branch 'release/0.2.1' 2024-09-05 12:02:17 +01:00
36 changed files with 642 additions and 83 deletions
+8
View File
@@ -106,7 +106,11 @@
<ClCompile Include="Connector\Interface\Browser\Bridge\Config\Arg\ConnectorConfig.cpp" />
<ClCompile Include="Connector\Interface\Browser\Bridge\Config\ConfigBridge.cpp" />
<ClCompile Include="Connector\Interface\Browser\Bridge\Config\GetConfig.cpp" />
<ClCompile Include="Connector\Interface\Browser\Bridge\Config\GetIsDevMode.cpp" />
<ClCompile Include="Connector\Interface\Browser\Bridge\Config\UpdateConfig.cpp" />
<ClCompile Include="Connector\Interface\Browser\Bridge\Send\Arg\SendFilter.cpp" />
<ClCompile Include="Connector\Interface\Browser\Bridge\Send\GetSendFilters.cpp" />
<ClCompile Include="Connector\Interface\Browser\Bridge\Send\Send.cpp" />
<ClCompile Include="Connector\Interface\Browser\Bridge\Send\SendBridge.cpp" />
<ClCompile Include="Connector\Interface\Browser\Bridge\Test\Arg\SayHiArg.cpp" />
<ClCompile Include="Connector\Interface\Browser\Bridge\Test\GetComplexType.cpp" />
@@ -134,7 +138,11 @@
<ClInclude Include="Connector\Interface\Browser\Bridge\Config\Arg\ConnectorConfig.h" />
<ClInclude Include="Connector\Interface\Browser\Bridge\Config\ConfigBridge.h" />
<ClInclude Include="Connector\Interface\Browser\Bridge\Config\GetConfig.h" />
<ClInclude Include="Connector\Interface\Browser\Bridge\Config\GetIsDevMode.h" />
<ClInclude Include="Connector\Interface\Browser\Bridge\Config\UpdateConfig.h" />
<ClInclude Include="Connector\Interface\Browser\Bridge\Send\Arg\SendFilter.h" />
<ClInclude Include="Connector\Interface\Browser\Bridge\Send\GetSendFilters.h" />
<ClInclude Include="Connector\Interface\Browser\Bridge\Send\Send.h" />
<ClInclude Include="Connector\Interface\Browser\Bridge\Send\SendBridge.h" />
<ClInclude Include="Connector\Interface\Browser\Bridge\Test\Arg\SayHiArg.h" />
<ClInclude Include="Connector\Interface\Browser\Bridge\Test\GetComplexType.h" />
@@ -53,6 +53,9 @@
<Filter Include="Connector\Interface\Browser\Bridge\Send">
<UniqueIdentifier>{2b87cf11-87cd-435f-ab24-42170c2e657e}</UniqueIdentifier>
</Filter>
<Filter Include="Connector\Interface\Browser\Bridge\Send\Arg">
<UniqueIdentifier>{3bc97363-0091-4f84-a5f7-085193bad850}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<None Include="RFIX.win\Connector.rc2">
@@ -149,6 +152,16 @@
<ClCompile Include="Connector\Interface\Browser\Bridge\Send\SendBridge.cpp">
<Filter>Connector\Interface\Browser\Bridge\Send</Filter>
</ClCompile>
<ClCompile Include="Connector\Interface\Browser\Bridge\Config\GetIsDevMode.cpp" />
<ClCompile Include="Connector\Interface\Browser\Bridge\Send\Send.cpp">
<Filter>Connector\Interface\Browser\Bridge\Send</Filter>
</ClCompile>
<ClCompile Include="Connector\Interface\Browser\Bridge\Send\GetSendFilters.cpp">
<Filter>Connector\Interface\Browser\Bridge\Send</Filter>
</ClCompile>
<ClCompile Include="Connector\Interface\Browser\Bridge\Send\Arg\SendFilter.cpp">
<Filter>Connector\Interface\Browser\Bridge\Send\Arg</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="Connector\ConnectorResource.h">
@@ -232,5 +245,15 @@
<ClInclude Include="Connector\Interface\Browser\Bridge\Send\SendBridge.h">
<Filter>Connector\Interface\Browser\Bridge\Send</Filter>
</ClInclude>
<ClInclude Include="Connector\Interface\Browser\Bridge\Config\GetIsDevMode.h" />
<ClInclude Include="Connector\Interface\Browser\Bridge\Send\Send.h">
<Filter>Connector\Interface\Browser\Bridge\Send</Filter>
</ClInclude>
<ClInclude Include="Connector\Interface\Browser\Bridge\Send\GetSendFilters.h">
<Filter>Connector\Interface\Browser\Bridge\Send</Filter>
</ClInclude>
<ClInclude Include="Connector\Interface\Browser\Bridge\Send\Arg\SendFilter.h">
<Filter>Connector\Interface\Browser\Bridge\Send\Arg</Filter>
</ClInclude>
</ItemGroup>
</Project>
@@ -43,6 +43,11 @@
21B67CF12C78D38000FD64FC /* GoAway.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 21B67CF02C78D38000FD64FC /* GoAway.cpp */; };
21B67CF72C78D4DE00FD64FC /* GetComplexType.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 21B67CF52C78D4DD00FD64FC /* GetComplexType.cpp */; };
21D0BD602C89BFEA0077E104 /* SendBridge.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 21D0BD5B2C89BFEA0077E104 /* SendBridge.cpp */; };
21D0BD672C89D7410077E104 /* AccountTests.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 21D0BD642C89D7400077E104 /* AccountTests.cpp */; };
21D0BD6A2C8A0DB40077E104 /* GetIsDevMode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 21D0BD682C8A0DB40077E104 /* GetIsDevMode.cpp */; };
21D0BD8E2C8EE4490077E104 /* Send.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 21D0BD8D2C8EE4490077E104 /* Send.cpp */; };
21D0BD972C8F13F30077E104 /* GetSendFilters.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 21D0BD962C8F13F30077E104 /* GetSendFilters.cpp */; };
21D0BD9B2C8F154B0077E104 /* SendFilter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 21D0BD982C8F154B0077E104 /* SendFilter.cpp */; };
21D1E9AD2BF14AF200957EAA /* BIMData.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 21D1E9152BF14AEC00957EAA /* BIMData.framework */; };
21D1E9AE2BF14AF200957EAA /* TeamworkPortalServerClient.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 21D1E9162BF14AEC00957EAA /* TeamworkPortalServerClient.framework */; };
21D1E9AF2BF14AF200957EAA /* GDL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 21D1E9172BF14AEC00957EAA /* GDL.framework */; };
@@ -307,6 +312,15 @@
21B67CF62C78D4DE00FD64FC /* GetComplexType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GetComplexType.h; sourceTree = "<group>"; };
21D0BD5B2C89BFEA0077E104 /* SendBridge.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SendBridge.cpp; sourceTree = "<group>"; };
21D0BD5C2C89BFEA0077E104 /* SendBridge.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SendBridge.h; sourceTree = "<group>"; };
21D0BD642C89D7400077E104 /* AccountTests.cpp */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 4; path = AccountTests.cpp; sourceTree = "<group>"; };
21D0BD682C8A0DB40077E104 /* GetIsDevMode.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GetIsDevMode.cpp; sourceTree = "<group>"; };
21D0BD692C8A0DB40077E104 /* GetIsDevMode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GetIsDevMode.h; sourceTree = "<group>"; };
21D0BD8A2C8EE4490077E104 /* Send.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Send.h; sourceTree = "<group>"; };
21D0BD8D2C8EE4490077E104 /* Send.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Send.cpp; sourceTree = "<group>"; };
21D0BD952C8F13F30077E104 /* GetSendFilters.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GetSendFilters.h; sourceTree = "<group>"; };
21D0BD962C8F13F30077E104 /* GetSendFilters.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GetSendFilters.cpp; sourceTree = "<group>"; };
21D0BD982C8F154B0077E104 /* SendFilter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SendFilter.cpp; sourceTree = "<group>"; };
21D0BD992C8F154B0077E104 /* SendFilter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SendFilter.h; sourceTree = "<group>"; };
21D1E9152BF14AEC00957EAA /* BIMData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = BIMData.framework; path = "../Archicad 27/Support/Frameworks/BIMData.framework"; sourceTree = "<group>"; };
21D1E9162BF14AEC00957EAA /* TeamworkPortalServerClient.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = TeamworkPortalServerClient.framework; path = "../Archicad 27/Support/Frameworks/TeamworkPortalServerClient.framework"; sourceTree = "<group>"; };
21D1E9172BF14AEC00957EAA /* GDL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = GDL.framework; path = "../Archicad 27/Support/Frameworks/GDL.framework"; sourceTree = "<group>"; };
@@ -874,6 +888,7 @@
219F30412C769282009834E9 /* ConnectorTests */ = {
isa = PBXGroup;
children = (
21D0BD642C89D7400077E104 /* AccountTests.cpp */,
219F30402C769282009834E9 /* ConfigTests.cpp */,
219F30432C7693B6009834E9 /* Connector-AC27-Debug.xctestplan */,
);
@@ -973,12 +988,26 @@
21D0BD5D2C89BFEA0077E104 /* Send */ = {
isa = PBXGroup;
children = (
21D0BD9A2C8F154B0077E104 /* Arg */,
21D0BD962C8F13F30077E104 /* GetSendFilters.cpp */,
21D0BD952C8F13F30077E104 /* GetSendFilters.h */,
21D0BD8D2C8EE4490077E104 /* Send.cpp */,
21D0BD8A2C8EE4490077E104 /* Send.h */,
21D0BD5B2C89BFEA0077E104 /* SendBridge.cpp */,
21D0BD5C2C89BFEA0077E104 /* SendBridge.h */,
);
path = Send;
sourceTree = "<group>";
};
21D0BD9A2C8F154B0077E104 /* Arg */ = {
isa = PBXGroup;
children = (
21D0BD982C8F154B0077E104 /* SendFilter.cpp */,
21D0BD992C8F154B0077E104 /* SendFilter.h */,
);
path = Arg;
sourceTree = "<group>";
};
21D1EA472BF14B6C00957EAA /* Archicad */ = {
isa = PBXGroup;
children = (
@@ -1082,6 +1111,8 @@
21F69FB52C762EF0008B6A06 /* ConfigBridge.h */,
21F69FB62C762EF0008B6A06 /* GetConfig.cpp */,
21F69FB72C762EF0008B6A06 /* GetConfig.h */,
21D0BD682C8A0DB40077E104 /* GetIsDevMode.cpp */,
21D0BD692C8A0DB40077E104 /* GetIsDevMode.h */,
21F69FBD2C7630B3008B6A06 /* UpdateConfig.cpp */,
21F69FBE2C7630B3008B6A06 /* UpdateConfig.h */,
);
@@ -1296,11 +1327,15 @@
21B67CE32C78D1FB00FD64FC /* SayHiArg.cpp in Sources */,
21F69FBB2C762EF0008B6A06 /* ConfigBridge.cpp in Sources */,
21F69F8A2C70D2C4008B6A06 /* AccountBridge.cpp in Sources */,
21D0BD9B2C8F154B0077E104 /* SendFilter.cpp in Sources */,
21D0BD8E2C8EE4490077E104 /* Send.cpp in Sources */,
21B67CF72C78D4DE00FD64FC /* GetComplexType.cpp in Sources */,
21B67CAE2C77329800FD64FC /* GetSourceApplicationVersion.cpp in Sources */,
21B67CC32C77649F00FD64FC /* GetDocumentState.cpp in Sources */,
21D0BD602C89BFEA0077E104 /* SendBridge.cpp in Sources */,
21D0BD972C8F13F30077E104 /* GetSendFilters.cpp in Sources */,
21B67CAC2C77329800FD64FC /* BaseBridge.cpp in Sources */,
21D0BD6A2C8A0DB40077E104 /* GetIsDevMode.cpp in Sources */,
210CC8832C80E6A300610F58 /* TriggerEvent.cpp in Sources */,
21B67CEB2C78D27200FD64FC /* DocumentInfo.cpp in Sources */,
21B67CB92C774BFA00FD64FC /* GetConnectorVersion.cpp in Sources */,
@@ -1325,6 +1360,7 @@
buildActionMask = 2147483647;
files = (
219F30422C769283009834E9 /* ConfigTests.cpp in Sources */,
21D0BD672C89D7410077E104 /* AccountTests.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
+4 -4
View File
@@ -27,8 +27,8 @@ namespace {
class ConnectorInstance : public ConnectorAddon {
public:
ConnectorInstance(const String& name) : ConnectorAddon{name} {
add(std::make_shared<ConnectorMenu>());
add(std::make_shared<ConnectorPalette>());
add<ConnectorMenu>();
add<ConnectorPalette>();
}
// MARK: Functions (const)
@@ -107,8 +107,8 @@ ConnectorAddon* connector::connector() {
The following is the C interface for the plugin to Archicad as specified by the API
*/
#include "ACAPinc.h"
#include "APIdefs_Registration.h"
#include <ACAPinc.h>
#include <APIdefs_Registration.h>
/*--------------------------------------------------------------------
Confirm that the plugin is able to run in the current environment
@@ -1,5 +1,5 @@
#ifndef CONNECTOR_INTERFACE_BRIDGE_CONNECTOR_CONFIG
#define CONNECTOR_INTERFACE_BRIDGE_CONNECTOR_CONFIG
#ifndef CONNECTOR_INTERFACE_BRIDGE_DOCUMENT_INFO
#define CONNECTOR_INTERFACE_BRIDGE_DOCUMENT_INFO
#include "Active/Serialise/Package/Package.h"
#include "Speckle/Utility/String.h"
@@ -58,4 +58,4 @@ namespace connector::interfac::browser::bridge {
}
#endif //CONNECTOR_INTERFACE_BRIDGE_CONNECTOR_CONFIG
#endif //CONNECTOR_INTERFACE_BRIDGE_DOCUMENT_INFO
@@ -1,7 +1,7 @@
#include "Connector/Interface/Browser/Bridge/Config/Arg/ConnectorConfig.h"
#include "Active/Serialise/Item/Wrapper/ValueWrap.h"
#include "Active/Serialise/Package/PackageWrap.h"
#include "Active/Serialise/Package/Wrapper/PackageWrap.h"
#include <array>
@@ -2,6 +2,7 @@
#include "Connector/Interface/Browser/Bridge/Config/GetConfig.h"
#include "Connector/Interface/Browser/Bridge/Config/UpdateConfig.h"
#include "Connector/Interface/Browser/Bridge/Config/GetIsDevMode.h"
using namespace connector::interfac::browser::bridge;
@@ -12,4 +13,5 @@ ConfigBridge::ConfigBridge() : BrowserBridge{"configBinding"} {
//Add bridge methods
addMethod<GetConfig>();
addMethod<UpdateConfig>();
addMethod<GetIsDevMode>();
} //ConfigBridge::ConfigBridge
@@ -1,7 +1,7 @@
#include "Connector/Interface/Browser/Bridge/Config/GetConfig.h"
#include "Active/Serialise/CargoHold.h"
#include "Active/Serialise/Package/PackageWrap.h"
#include "Active/Serialise/Package/Wrapper/PackageWrap.h"
#include "Connector/Interface/Browser/Bridge/Config/Arg/ConnectorConfig.h"
using namespace active::serialise;
@@ -15,7 +15,6 @@ namespace connector::interfac::browser::bridge {
/*!
Constructor
@param bridge The parent bridge object (provides access to bridge methods)
*/
GetConfig();
@@ -0,0 +1,39 @@
#include "Connector/Interface/Browser/Bridge/Config/GetIsDevMode.h"
#include "Active/Serialise/CargoHold.h"
#include "Active/Serialise/Item/Wrapper/ValueWrap.h"
using namespace active::serialise;
using namespace connector::interfac::browser::bridge;
using namespace speckle::utility;
namespace {
///Return type for retrieving the current configuration
using WrappedValue = CargoHold<ValueWrap<bool>, bool>;
}
/*--------------------------------------------------------------------
Default constructor
--------------------------------------------------------------------*/
GetIsDevMode::GetIsDevMode() : BridgeMethod{"GetIsDevMode", [&]() {
return run();
}} {}
/*--------------------------------------------------------------------
Get the DEBUG mode
return: true for DEBUG, false otherwise
--------------------------------------------------------------------*/
std::unique_ptr<Cargo> GetIsDevMode::run() const {
#if DEBUG
bool value = true;
#else
bool value = false;
#endif
return std::make_unique<WrappedValue>(value);
} //GetIsDevMode::run
@@ -0,0 +1,32 @@
#ifndef CONNECTOR_INTERFACE_BRIDGE_GET_IS_DEV_MODE
#define CONNECTOR_INTERFACE_BRIDGE_GET_IS_DEV_MODE
#include "Speckle/Interface/Browser/Bridge/BridgeMethod.h"
namespace connector::interfac::browser::bridge {
/*!
JS Function class to retrieve IsDebugMode
*/
class GetIsDevMode : public speckle::interfac::browser::bridge::BridgeMethod<void, active::serialise::Cargo> {
public:
// MARK: - Constructors
/*!
Constructor
*/
GetIsDevMode();
// MARK: - Functions (const)
/*!
Get the DEBUG mode
@return true for DEBUG, false otherwise
*/
std::unique_ptr<active::serialise::Cargo> run() const;
};
}
#endif //CONNECTOR_INTERFACE_BRIDGE_GET_IS_DEV_MODE
@@ -1,7 +1,7 @@
#include "Connector/Interface/Browser/Bridge/Config/UpdateConfig.h"
#include "Active/Serialise/CargoHold.h"
#include "Active/Serialise/Package/PackageWrap.h"
#include "Active/Serialise/Package/Wrapper/PackageWrap.h"
using namespace active::serialise;
using namespace connector::interfac::browser::bridge;
@@ -0,0 +1,80 @@
#include "Connector/Interface/Browser/Bridge/Send/Arg/SendFilter.h"
#include "Active/Serialise/Item/Wrapper/ValueWrap.h"
#include <array>
using namespace active::serialise;
using namespace connector::interfac::browser::bridge;
using namespace speckle::utility;
namespace {
///Serialisation fields
enum FieldIndex {
nameID,
summaryID,
defaultID,
};
///Serialisation field IDs
static std::array fieldID = {
Identity{"name"},
Identity{"summary"},
Identity{"isDefault"},
};
}
/*--------------------------------------------------------------------
Fill an inventory with the package items
inventory: The inventory to receive the package items
return: True if the package has added items to the inventory
--------------------------------------------------------------------*/
bool SendFilter::fillInventory(Inventory& inventory) const {
using enum Entry::Type;
inventory.merge(Inventory{
{
{ fieldID[nameID], nameID, element },
{ fieldID[summaryID], summaryID, element },
{ fieldID[defaultID], defaultID, element },
},
}.withType(&typeid(SendFilter)));
return true;
} //SendFilter::fillInventory
/*--------------------------------------------------------------------
Get the specified cargo
item: The inventory item to retrieve
return: The requested cargo (nullptr on failure)
--------------------------------------------------------------------*/
Cargo::Unique SendFilter::getCargo(const Inventory::Item& item) const {
if (item.ownerType != &typeid(SendFilter))
return nullptr;
using namespace active::serialise;
switch (item.index) {
case nameID:
return std::make_unique<ValueWrap<String>>(name);
case summaryID:
return std::make_unique<ValueWrap<String>>(summary);
case defaultID:
return std::make_unique<ValueWrap<bool>>(isDefault);
default:
return nullptr; //Requested an unknown index
}
} //SendFilter::getCargo
/*--------------------------------------------------------------------
Set to the default package content
--------------------------------------------------------------------*/
void SendFilter::setDefault() {
name.clear();
summary.clear();
isDefault = false;
} //SendFilter::setDefault
@@ -0,0 +1,67 @@
#ifndef CONNECTOR_INTERFACE_BRIDGE_SEND_FILTER
#define CONNECTOR_INTERFACE_BRIDGE_SEND_FILTER
#include "Active/Serialise/Package/Package.h"
#include "Active/Utility/Cloner.h"
#include "Speckle/Utility/String.h"
namespace connector::interfac::browser::bridge {
/*!
A connector send filter
*/
class SendFilter : public active::serialise::Package, public active::utility::Cloner {
public:
// MARK: - Types
using base = active::serialise::Package;
// MARK: - Constructors
/*!
Default constructor
@param nm The filter name
@param sum A summary
@param isDef True if this is the default filter
*/
SendFilter(const speckle::utility::String& nm = {}, const speckle::utility::String& sum = {}, bool isDef = false) :
name{nm}, summary{sum}, isDefault{isDef} {}
/*!
Record cloning
@return A clone of this record
*/
virtual SendFilter* clonePtr() const override { return new SendFilter(*this); };
// MARK: - Public variables (NB: Assuming to class invariants or overrides for this data, so making public for simplicity)
///The filter name
speckle::utility::String name;
///A summary
speckle::utility::String summary;
///True if this is the default filter
bool isDefault = false;
// MARK: - Serialisation
/*!
Fill an inventory with the package items
@param inventory The inventory to receive the package items
@return True if the package has added items to the inventory
*/
bool fillInventory(active::serialise::Inventory& inventory) const override;
/*!
Get the specified cargo
@param item The inventory item to retrieve
@return The requested cargo (nullptr on failure)
*/
Cargo::Unique getCargo(const active::serialise::Inventory::Item& item) const override;
/*!
Set to the default package content
*/
void setDefault() override;
};
}
#endif //CONNECTOR_INTERFACE_BRIDGE_SEND_FILTER
@@ -0,0 +1,37 @@
#include "Connector/Interface/Browser/Bridge/Send/GetSendFilters.h"
#include "Active/Container/Vector.h"
#include "Active/Serialise/CargoHold.h"
#include "Active/Serialise/Package/Wrapper/ContainerWrap.h"
#include "Active/Serialise/Package/Wrapper/PackageWrap.h"
#include "Connector/Interface/Browser/Bridge/Send/Arg/SendFilter.h"
using namespace active::container;
using namespace active::serialise;
using namespace connector::interfac::browser::bridge;
using namespace speckle::utility;
namespace {
using WrappedValue = active::serialise::CargoHold<ContainerWrap<Vector, SendFilter>, Vector<SendFilter>>;
}
/*--------------------------------------------------------------------
Default constructor
--------------------------------------------------------------------*/
GetSendFilters::GetSendFilters() : BridgeMethod{"GetSendFilters", [&]() {
return run();
}} {}
/*--------------------------------------------------------------------
Get the send filters
return: The send filters
--------------------------------------------------------------------*/
std::unique_ptr<Cargo> GetSendFilters::run() const {
Vector<SendFilter> filters;
///TODO: Get real filters
return std::make_unique<WrappedValue>(filters);
} //GetSendFilters::run
@@ -0,0 +1,36 @@
#ifndef CONNECTOR_INTERFACE_BRIDGE_GET_SEND_FILTERS
#define CONNECTOR_INTERFACE_BRIDGE_GET_SEND_FILTERS
#include "Active/Serialise/CargoHold.h"
#include "Speckle/Interface/Browser/Bridge/BridgeMethod.h"
namespace connector::interfac::browser::bridge {
class ConnectorConfig;
/*!
JS Function class to retrieve the send filters
*/
class GetSendFilters : public speckle::interfac::browser::bridge::BridgeMethod<void, active::serialise::Cargo> {
public:
// MARK: - Constructors
/*!
Constructor
@param bridge The parent bridge object (provides access to bridge methods)
*/
GetSendFilters();
// MARK: - Functions (const)
/*!
Get the send filters
@return The send filters
*/
std::unique_ptr<active::serialise::Cargo> run() const;
};
}
#endif //CONNECTOR_INTERFACE_BRIDGE_GET_SEND_FILTERS
@@ -0,0 +1,25 @@
#include "Connector/Interface/Browser/Bridge/Send/Send.h"
#include "Active/Serialise/CargoHold.h"
#include "Active/Serialise/Package/Wrapper/PackageWrap.h"
using namespace active::serialise;
using namespace connector::interfac::browser::bridge;
using namespace speckle::utility;
/*--------------------------------------------------------------------
Default constructor
--------------------------------------------------------------------*/
Send::Send() : BridgeMethod{"Send", [&](UpdateArgs args) {
run(args);
}} {}
/*--------------------------------------------------------------------
Send a specified model
modelCardID: The ID of the madel to send
--------------------------------------------------------------------*/
void Send::run(const String& modelCardID) const {
///TODO: Send the requested model
} //Send::run
@@ -0,0 +1,40 @@
#ifndef CONNECTOR_INTERFACE_BRIDGE_SEND
#define CONNECTOR_INTERFACE_BRIDGE_SEND
#include "Active/Serialise/CargoHold.h"
#include "Connector/Interface/Browser/Bridge/Config/Arg/ConnectorConfig.h"
#include "Speckle/Interface/Browser/Bridge/BridgeMethod.h"
namespace connector::interfac::browser::bridge {
class ConnectorConfig;
///Argument for a JS call to update the configuration
using UpdateArgs = speckle::interfac::browser::bridge::JSArgType<speckle::utility::String>;
/*!
JS Function class to retrieve the names of the methods supported by the bridge
*/
class Send : public speckle::interfac::browser::bridge::BridgeMethod<UpdateArgs, void> {
public:
// MARK: - Constructors
/*!
Constructor
@param bridge The parent bridge object (provides access to bridge methods)
*/
Send();
// MARK: - Functions (const)
/*!
Send a specified model
@param modelCardID The ID of the madel to send
*/
void run(const speckle::utility::String& modelCardID) const;
};
}
#endif //CONNECTOR_INTERFACE_BRIDGE_SEND
@@ -1,5 +1,8 @@
#include "Connector/Interface/Browser/Bridge/Send/SendBridge.h"
#include "Connector/Interface/Browser/Bridge/Send/GetSendFilters.h"
#include "Connector/Interface/Browser/Bridge/Send/Send.h"
using namespace connector::interfac::browser::bridge;
/*--------------------------------------------------------------------
@@ -7,4 +10,6 @@ using namespace connector::interfac::browser::bridge;
--------------------------------------------------------------------*/
SendBridge::SendBridge() : BrowserBridge{"sendBinding"} {
//Add bridge methods
addMethod<GetSendFilters>();
addMethod<Send>();
} //SendBridge::SendBridge
@@ -2,7 +2,7 @@
#include "Active/Serialise/CargoHold.h"
#include "Active/Serialise/Item/Wrapper/ValueWrap.h"
#include "Active/Serialise/Package/PackageWrap.h"
#include "Active/Serialise/Package/Wrapper/PackageWrap.h"
#include <array>
@@ -163,11 +163,11 @@ BrowserPalette::BrowserPalette() :
Attach(*this);
BeginEventProcessing();
//Install required connector bridges
install(std::make_shared<AccountBridge>());
install(std::make_shared<BaseBridge>());
install(std::make_shared<ConfigBridge>());
//install(std::make_shared<SendBridge>());
install(std::make_shared<TestBridge>());
install<AccountBridge>();
install<BaseBridge>();
install<ConfigBridge>();
install<SendBridge>();
install<TestBridge>();
InitBrowserControl();
}
+1 -1
View File
@@ -7,7 +7,7 @@ namespace connector {
static const unsigned int versionMinor = 2;
static const unsigned int versionPatch = 1;
static const unsigned int versionPatch = 2;
}
@@ -0,0 +1,41 @@
#include "ActiveLibDoctest/TestingPlatforms.h"
#include "Active/Serialise/JSON/JSONTransport.h"
#include "Active/Serialise/Package/Wrapper/PackageWrap.h"
#include "Active/Utility/BufferIn.h"
#include "Active/Utility/BufferOut.h"
#include "Speckle/Record/Credentials/Account.h"
using namespace active::serialise;
using namespace active::serialise::json;
using namespace active::serialise::json;
using namespace speckle::record::cred;
using namespace speckle::utility;
namespace {
const char* accountJSON = "{\"id\":\"d4468f8d6f1e4c48a899518795326ea8\",\"token\":\"42986a57b3304baa8773f937aa0b7bcd42986a57b3\",\"refreshToken\":\"00b01c421de4404889f30947de1506d3440c476432\",\"isDefault\":true,\"isOnline\":false,\"serverInfo\":{\"name\":\"My new Speckle Server\",\"company\":\"Unknown Company\",\"version\":\"2.20.2-branch.testing.138676-e8c8291\",\"adminContact\":\"n/a\",\"description\":\"This a community deployment of a Speckle Server.\",\"frontend2\":true,\"url\":\"https://testing.speckle.dev\",\"migration\":null},\"userInfo\":{\"id\":\"00b01c421d\",\"name\":\"someone@speckle.systems\",\"email\":\"someone@speckle.systems\",\"company\":null,\"avatar\":null,\"streams\":{\"totalCount\":2},\"commits\":{\"totalCount\":5}}}";
}
TEST_SUITE(TESTQ(AccountTests)) TEST_SUITE_OPEN
//Test to receive account serialised as JSON from SQLite dbase
TEST_CASE(TESTQ(testAccountReceive)) {
Account account;
JSONTransport transport;
try {
transport.receive(PackageWrap{account}, Identity{}, String{accountJSON});
} catch(...) {
FAIL_CHECK(TEST_MESSAGE(Account deserialisation failed));
}
String accountOut;
try {
transport.send(PackageWrap{account}, Identity{}, accountOut);
} catch(...) {
FAIL_CHECK(TEST_MESSAGE(Account serialisation failed));
}
}
TEST_SUITE_CLOSE
@@ -1,4 +1,4 @@
#include "Active/Database/Storage/SQLiteEngine.h"
#include "Active/Database/Storage/SQLite/SQLiteEngine.h"
#include "Active/Database/Storage/Storage.h"
#include "Active/Serialise/JSON/JSONTransport.h"
#include "Active/Setting/ValueSetting.h"
@@ -2,7 +2,7 @@
#include "Active/Serialise/CargoHold.h"
#include "Active/Serialise/Null.h"
#include "Active/Serialise/Package/PackageWrap.h"
#include "Active/Serialise/Package/Wrapper/PackageWrap.h"
#include "Speckle/Interface/Browser/Bridge/BrowserBridge.h"
#include "Speckle/Interface/Browser/Bridge/Functions/ErrorReport.h"
#include "Speckle/Utility/Exception.h"
@@ -4,7 +4,7 @@
#include "Active/Serialise/Inventory/Identity.h"
#include "Active/Serialise/Item/Wrapper/ItemWrap.h"
#include "Active/Serialise/Package/NullPackage.h"
#include "Active/Serialise/Package/PackageWrap.h"
#include "Active/Serialise/Package/Wrapper/PackageWrap.h"
#include "Speckle/Interface/Browser/JSBinding.h"
#include "Speckle/Interface/Browser/NamedFunction.h"
#include "Speckle/Utility/String.h"
@@ -49,6 +49,13 @@ namespace speckle::interfac::browser {
@return True if the object was successfully installed
*/
bool install(std::shared_ptr<JSObject<FunctionBinding>> object);
/*!
Install a JS function object
@return True if the object was successfully installed
@tparam T The type of object to install
*/
template<typename T> requires std::is_base_of_v<JSObject<FunctionBinding>, T>
bool install() { return install(std::make_shared<T>()); }
protected:
#ifdef ARCHICAD
@@ -1,7 +1,7 @@
#include "Speckle/Record/Credentials/Account.h"
#include "Active/Serialise/Item/Wrapper/ValueWrap.h"
#include "Active/Serialise/Package/PackageWrap.h"
#include "Active/Serialise/Package/Wrapper/PackageWrap.h"
#include "Speckle/Utility/Guid.h"
using namespace active::serialise;
@@ -1,7 +1,7 @@
#include "Speckle/Record/Credentials/ServerInfo.h"
#include "Active/Serialise/Item/Wrapper/ValueWrap.h"
#include "Active/Serialise/Package/PackageWrap.h"
#include "Active/Serialise/Item/Wrapper/ValueOptionWrap.h"
#include "Active/Serialise/Package/Wrapper/PackageUnoWrap.h"
#include "Speckle/Utility/Guid.h"
#include <array>
@@ -76,21 +76,21 @@ Cargo::Unique ServerInfo::getCargo(const Inventory::Item& item) const {
using namespace active::serialise;
switch (item.index) {
case nameID:
return std::make_unique<ValueWrap<String>>(m_name);
return std::make_unique<StringWrap>(m_name);
case companyID:
return std::make_unique<ValueWrap<String>>(m_company);
return std::make_unique<StringOptWrap>(m_company);
case versionID:
return std::make_unique<ValueWrap<String>>(m_version);
return std::make_unique<StringOptWrap>(m_version);
case contactID:
return std::make_unique<ValueWrap<String>>(m_adminContact);
return std::make_unique<StringOptWrap>(m_adminContact);
case descriptionID:
return std::make_unique<ValueWrap<String>>(m_description);
return std::make_unique<StringOptWrap>(m_description);
case frontEndID:
return std::make_unique<ValueWrap<bool>>(m_frontend2);
case urlID:
return std::make_unique<ValueWrap<String>>(m_url);
return std::make_unique<StringOptWrap>(m_url);
case migrationID:
return std::make_unique<PackageWrap>(m_migration);
return std::make_unique<PackageUnoWrap<ServerMigration>>(m_migration);
default:
return nullptr; //Requested an unknown index
}
@@ -102,10 +102,23 @@ Cargo::Unique ServerInfo::getCargo(const Inventory::Item& item) const {
--------------------------------------------------------------------*/
void ServerInfo::setDefault() {
m_name.clear();
m_company.clear();
m_version.clear();
m_adminContact.clear();
m_description.clear();
m_frontend2 = false;
m_url.clear();
} //ServerInfo::setDefault
/*--------------------------------------------------------------------
Copy from another object
source: The object to copy
--------------------------------------------------------------------*/
void ServerInfo::copy(const ServerInfo& source) {
if (this == &source)
return;
m_name = source.m_name;
m_version = source.m_version;
m_adminContact = source.m_adminContact;
m_description = source.m_description;
m_frontend2 = source.m_frontend2;
m_url = source.m_url;
m_migration = (source.m_migration) ? std::make_unique<ServerMigration>(*source.m_migration) : nullptr;
} //ServerInfo::copy
@@ -30,11 +30,29 @@ namespace speckle::record::cred {
@param isFrontEnd ?
@param migration Server migration record
*/
ServerInfo(const utility::String& name, const utility::String& company, const utility::String& version, const utility::String& contact,
const utility::String& description, const utility::String& url, bool isFrontEnd, const ServerMigration& migration) :
ServerInfo(const utility::String& name, const utility::String::Option company = std::nullopt,
const utility::String::Option version = std::nullopt, const utility::String::Option contact = std::nullopt,
const utility::String::Option description = std::nullopt, const utility::String::Option url = std::nullopt,
bool isFrontEnd = false, std::unique_ptr<ServerMigration> migration = nullptr) :
m_name{name}, m_company{company}, m_version{version}, m_adminContact{contact}, m_description{description},
m_url{url}, m_frontend2{isFrontEnd}, m_migration{migration} {}
ServerInfo(const ServerInfo&) = default;
m_url{url}, m_frontend2{isFrontEnd}, m_migration{std::move(migration)} {}
/*!
Copy constructor
@param source The object to copy
*/
ServerInfo(const ServerInfo& source) { copy(source); }
/*!
Destructor
*/
~ServerInfo() {}
// MARK: - Operators
/*!
Assignment operator
@param source The object to copy
*/
ServerInfo& operator=(const ServerInfo& source) { copy(source); return *this; }
// MARK: - Functions (const)
@@ -43,37 +61,78 @@ namespace speckle::record::cred {
@return The server name
*/
const utility::String& getName() const { return m_name; }
/*!
Get the company name
@return The company name
*/
const utility::String::Option& getCompany() const { return m_company; }
/*!
Get the version
@return The version
*/
const utility::String::Option& getVersion() const { return m_version; }
/*!
Get the admin contact email
@return The admin contact email
*/
const utility::String::Option& getAdminContact() const { return m_adminContact; }
/*!
Get the description
@return The description
*/
const utility::String::Option& getDescription() const { return m_description; }
/*!
Determine if ?
@return ?
*/
bool isFrontEnd() const { return m_frontend2; }
/*!
Get the URL
@return The URL
*/
const utility::String::Option& getURL() const { return m_url; }
/*!
Get the migration history
@return The migration history (nullptr = no history)
*/
const ServerMigration* getMigration() const { return m_migration.get(); }
// MARK: - Serialisation
/*!
Fill an inventory with the package items
@param inventory The inventory to receive the package items
@return True if the package has added items to the inventory
*/
Fill an inventory with the package items
@param inventory The inventory to receive the package items
@return True if the package has added items to the inventory
*/
bool fillInventory(active::serialise::Inventory& inventory) const override;
/*!
Get the specified cargo
@param item The inventory item to retrieve
@return The requested cargo (nullptr on failure)
*/
Get the specified cargo
@param item The inventory item to retrieve
@return The requested cargo (nullptr on failure)
*/
Cargo::Unique getCargo(const active::serialise::Inventory::Item& item) const override;
/*!
Set to the default package content
*/
Set to the default package content
*/
void setDefault() override;
private:
/*!
Copy from another object
@param source The object to copy
*/
void copy(const ServerInfo& source);
///Server name
utility::String m_name;
///Company name
utility::String m_company;
utility::String::Option m_company;
///Server version
utility::String m_version;
utility::String::Option m_version;
///Admin contact email
utility::String m_adminContact;
utility::String::Option m_adminContact;
///Server description
utility::String m_description;
utility::String::Option m_description;
/*!
This field is not returned from the GQL API, it should be populated after construction from the response headers.
See "Speckle.Core.Credentials.AccountManager"
@@ -84,9 +143,9 @@ namespace speckle::record::cred {
This field is not returned from the GQL API, it should be populated after construction.
See "Speckle.Core.Credentials.AccountManager"
*/
utility::String m_url;
utility::String::Option m_url;
///Server migration record
ServerMigration m_migration;
std::unique_ptr<ServerMigration> m_migration;
};
}
@@ -1,6 +1,6 @@
#include "Speckle/Record/Credentials/ServerMigration.h"
#include "Active/Serialise/Item/Wrapper/ValueWrap.h"
#include "Active/Serialise/Item/Wrapper/ValueOptionWrap.h"
#include "Speckle/Utility/Guid.h"
using namespace active::serialise;
@@ -57,19 +57,10 @@ Cargo::Unique ServerMigration::getCargo(const Inventory::Item& item) const {
using namespace active::serialise;
switch (item.index) {
case movedToID:
return std::make_unique<ValueWrap<String>>(movedTo);
return std::make_unique<StringOptWrap>(movedTo);
case movedFromID:
return std::make_unique<ValueWrap<String>>(movedFrom);
return std::make_unique<StringOptWrap>(movedFrom);
default:
return nullptr; //Requested an unknown index
}
} //ServerMigration::getCargo
/*--------------------------------------------------------------------
Set to the default package content
--------------------------------------------------------------------*/
void ServerMigration::setDefault() {
movedTo.clear();
movedFrom.clear();
} //ServerMigration::setDefault
@@ -12,6 +12,16 @@ namespace speckle::record::cred {
class ServerMigration : public active::serialise::Package {
public:
// MARK: - Types
using base = active::serialise::Package;
///Unique pointer
using Unique = std::unique_ptr<ServerMigration>;
///Shared pointer
using Shared = std::shared_ptr<ServerMigration>;
///Optional
using Option = std::optional<ServerMigration>;
// MARK: - Constructors
/*!
@@ -25,9 +35,9 @@ namespace speckle::record::cred {
// MARK: - Public variables
///New URI where this server is now deployed
speckle::utility::String movedTo;
speckle::utility::String::Option movedTo;
///Previous URI where this server used to be deployed
speckle::utility::String movedFrom;
speckle::utility::String::Option movedFrom;
// MARK: - Serialisation
@@ -43,10 +53,6 @@ namespace speckle::record::cred {
@return The requested cargo (nullptr on failure)
*/
Cargo::Unique getCargo(const active::serialise::Inventory::Item& item) const override;
/*!
Set to the default package content
*/
void setDefault() override;
};
}
@@ -1,7 +1,7 @@
#include "Speckle/Record/Credentials/UserInfo.h"
#include "Active/Serialise/Item/Wrapper/ValueWrap.h"
#include "Active/Serialise/Package/PackageWrap.h"
#include "Active/Serialise/Item/Wrapper/ValueOptionWrap.h"
#include "Active/Serialise/Package/Wrapper/PackageWrap.h"
#include "Speckle/Utility/Guid.h"
#include <array>
@@ -73,9 +73,9 @@ Cargo::Unique UserInfo::getCargo(const Inventory::Item& item) const {
case emailID:
return std::make_unique<ValueWrap<String>>(m_email);
case companyID:
return std::make_unique<ValueWrap<String>>(m_company);
return std::make_unique<StringOptWrap>(m_company);
case avatarID:
return std::make_unique<ValueWrap<String>>(m_avatar);
return std::make_unique<StringOptWrap>(m_avatar);
default:
return nullptr; //Requested an unknown index
}
@@ -88,7 +88,5 @@ Cargo::Unique UserInfo::getCargo(const Inventory::Item& item) const {
void UserInfo::setDefault() {
m_id.clear();
m_name.clear();
m_company.clear();
m_email.clear();
m_avatar.clear();
} //UserInfo::setDefault
@@ -71,9 +71,9 @@ namespace speckle::record::cred {
///User email
utility::String m_email;
///Compsny name
utility::String m_company;
utility::String::Option m_company;
///Avatar?
utility::String m_avatar;
utility::String::Option m_avatar;
};
}
@@ -9,7 +9,7 @@
#include "Active/Setting/Values/StringValue.h"
#include "Active/Setting/Values/UInt32Value.h"
#include "Active/Serialise/Package/Package.h"
#include "Active/Serialise/Package/PackageWrap.h"
#include "Active/Serialise/Package/Wrapper/PackageWrap.h"
#include "Active/Serialise/XML/Item/XMLDateTime.h"
#include "Speckle/Environment/Platform.h"
@@ -0,0 +1,15 @@
#include "ActiveLibDoctest/TestingPlatforms.h"
#include "Speckle/Utility/Guid32.h"
using namespace speckle::utility;
TEST_SUITE(TESTQ(GuidTests)) TEST_SUITE_OPEN
///Tests for creating/modifying guids
TEST_CASE(TESTQ(testGuidContent)) {
Guid32 badGuid{String{"abcd"}};
CHECK_MESSAGE(!badGuid, TEST_MESSAGE(Guid32 created from bad data));
}
TEST_SUITE_CLOSE