Compare commits

..

19 Commits

Author SHA1 Message Date
Jedd Morgan 41c6ddf5b9 Added GetIsDevMode 2024-09-05 16:06:31 +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
Ralph Wessel eede544f69 Version bump 2024-09-05 12:01:57 +01:00
Ralph Wessel 7ffe7e3a82 Updated VS project - Debug configurations need DEBUG macro 2024-09-05 11:57:49 +01:00
Ralph Wessel e18d967c07 Updated VS project
Temporarily disabled SendBinding to allow GetAccounts testing
2024-09-05 11:41:46 +01:00
Ralph Wessel 7a3f46f54d Added empty SendBridge 2024-09-05 11:34:09 +01:00
Ralph Wessel 05b8e0343c Merge branch 'develop' of https://github.com/specklesystems/speckle-cpp-connectors into develop 2024-09-04 23:42:47 +01:00
Ralph Wessel 3f285a0fc7 Included ServerInfo and UserInfo in Accounts 2024-09-04 23:42:36 +01:00
Ralph Wessel 5a2d12e33c Updated VS projects 2024-09-04 23:21:28 +01:00
Ralph Wessel 03e8798128 Filled in additonal account classes, e.g. ServerInfo, UserInfo etc
Additions to speckle::Record
2024-09-04 23:14:57 +01:00
Ralph Wessel c64596fb57 Included Accounts filename in path to dbase 2024-09-04 17:52:29 +01:00
Ralph Wessel 4209afa9fa Updated VS projects 2024-09-04 16:31:01 +01:00
Ralph Wessel 7a01feab57 Connector class now includes 'getAccountDatabase'
AccountDatabase loaded on demand from Speckle App data directory
2024-09-04 13:18:37 +01:00
Ralph Wessel 471e2d5312 AccountsDBase additions/corrections (can now retrieve all accounts) 2024-09-04 09:33:53 +01:00
Ralph Wessel bb451fbc90 Defined AccountsDatabase
Filled in methods for Account
Database classes/methods refined
2024-09-04 01:19:12 +01:00
Ralph Wessel 8b00e88f63 Merge branch 'release/0.2.0' 2024-08-30 14:46:45 +01:00
Ralph Wessel bee15b4e77 Merge tag '0.2.0' into develop
0.2.0
2024-08-30 14:46:45 +01:00
36 changed files with 1165 additions and 220 deletions
+6 -2
View File
@@ -106,7 +106,9 @@
<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\SendBridge.cpp" />
<ClCompile Include="Connector\Interface\Browser\Bridge\Test\Arg\SayHiArg.cpp" />
<ClCompile Include="Connector\Interface\Browser\Bridge\Test\GetComplexType.cpp" />
<ClCompile Include="Connector\Interface\Browser\Bridge\Test\GoAway.cpp" />
@@ -133,7 +135,9 @@
<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\SendBridge.h" />
<ClInclude Include="Connector\Interface\Browser\Bridge\Test\Arg\SayHiArg.h" />
<ClInclude Include="Connector\Interface\Browser\Bridge\Test\GetComplexType.h" />
<ClInclude Include="Connector\Interface\Browser\Bridge\Test\GoAway.h" />
@@ -576,7 +580,7 @@ CALL "$(ProjectDir)..\SpeckleLib\Make.win\install.bat"</Command>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>
</SDLCheck>
<PreprocessorDefinitions>TESTING_MODE;ARCHICAD;WIN32;_WINDOWS;WINDOWS;AddOn_EXPORTS;ACExtension;_STLP_DONT_FORCE_MSVC_LIB_NAME;_USRDLL;_WIN_EXTERNAL_;_WINDLL;_CRT_SECURE_NO_WARNINGS;_SILENCE_ALL_CXX20_DEPRECATION_WARNINGS;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>TESTING_MODE;DEBUG;ARCHICAD;WIN32;_WINDOWS;WINDOWS;AddOn_EXPORTS;ACExtension;_STLP_DONT_FORCE_MSVC_LIB_NAME;_USRDLL;_WIN_EXTERNAL_;_WINDLL;_CRT_SECURE_NO_WARNINGS;_SILENCE_ALL_CXX20_DEPRECATION_WARNINGS;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>false</ConformanceMode>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<PrecompiledHeaderFile>
@@ -763,7 +767,7 @@ CALL "$(ProjectDir)..\SpeckleLib\Make.win\install.bat"</Command>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>
</SDLCheck>
<PreprocessorDefinitions>ARCHICAD;WIN32;_WINDOWS;WINDOWS;AddOn_EXPORTS;ACExtension;_USRDLL;_WIN_EXTERNAL_;_WINDLL;_CRT_SECURE_NO_WARNINGS;_SILENCE_ALL_CXX20_DEPRECATION_WARNINGS;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>NDEBUG;ARCHICAD;WIN32;_WINDOWS;WINDOWS;AddOn_EXPORTS;ACExtension;_USRDLL;_WIN_EXTERNAL_;_WINDLL;_CRT_SECURE_NO_WARNINGS;_SILENCE_ALL_CXX20_DEPRECATION_WARNINGS;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<PrecompiledHeaderFile>
@@ -50,6 +50,9 @@
<Filter Include="Connector\Interface\Browser\Bridge\Test\Arg">
<UniqueIdentifier>{1656a0df-aa39-4f41-860f-7b278b31784a}</UniqueIdentifier>
</Filter>
<Filter Include="Connector\Interface\Browser\Bridge\Send">
<UniqueIdentifier>{2b87cf11-87cd-435f-ab24-42170c2e657e}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<None Include="RFIX.win\Connector.rc2">
@@ -143,6 +146,9 @@
<ClCompile Include="Connector\Interface\Browser\Bridge\Test\TriggerEvent.cpp">
<Filter>Connector\Interface\Browser\Bridge\Test</Filter>
</ClCompile>
<ClCompile Include="Connector\Interface\Browser\Bridge\Send\SendBridge.cpp">
<Filter>Connector\Interface\Browser\Bridge\Send</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="Connector\ConnectorResource.h">
@@ -223,5 +229,8 @@
<ClInclude Include="Connector\Interface\Browser\Bridge\Test\TriggerEvent.h">
<Filter>Connector\Interface\Browser\Bridge\Test</Filter>
</ClInclude>
<ClInclude Include="Connector\Interface\Browser\Bridge\Send\SendBridge.h">
<Filter>Connector\Interface\Browser\Bridge\Send</Filter>
</ClInclude>
</ItemGroup>
</Project>
@@ -42,6 +42,8 @@
21B67CEB2C78D27200FD64FC /* DocumentInfo.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 21B67CE82C78D27200FD64FC /* DocumentInfo.cpp */; };
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 */; };
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 */; };
@@ -304,6 +306,9 @@
21B67CF02C78D38000FD64FC /* GoAway.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GoAway.cpp; sourceTree = "<group>"; };
21B67CF52C78D4DD00FD64FC /* GetComplexType.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GetComplexType.cpp; sourceTree = "<group>"; };
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>"; };
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>"; };
@@ -871,6 +876,7 @@
219F30412C769282009834E9 /* ConnectorTests */ = {
isa = PBXGroup;
children = (
21D0BD642C89D7400077E104 /* AccountTests.cpp */,
219F30402C769282009834E9 /* ConfigTests.cpp */,
219F30432C7693B6009834E9 /* Connector-AC27-Debug.xctestplan */,
);
@@ -967,6 +973,15 @@
path = Arg;
sourceTree = "<group>";
};
21D0BD5D2C89BFEA0077E104 /* Send */ = {
isa = PBXGroup;
children = (
21D0BD5B2C89BFEA0077E104 /* SendBridge.cpp */,
21D0BD5C2C89BFEA0077E104 /* SendBridge.h */,
);
path = Send;
sourceTree = "<group>";
};
21D1EA472BF14B6C00957EAA /* Archicad */ = {
isa = PBXGroup;
children = (
@@ -1048,6 +1063,7 @@
21F69F852C70D2C4008B6A06 /* Account */,
21B67CAB2C77329800FD64FC /* Base */,
21F69FB82C762EF0008B6A06 /* Config */,
21D0BD5D2C89BFEA0077E104 /* Send */,
21B67CD82C78C83800FD64FC /* Test */,
);
path = Bridge;
@@ -1286,6 +1302,7 @@
21B67CF72C78D4DE00FD64FC /* GetComplexType.cpp in Sources */,
21B67CAE2C77329800FD64FC /* GetSourceApplicationVersion.cpp in Sources */,
21B67CC32C77649F00FD64FC /* GetDocumentState.cpp in Sources */,
21D0BD602C89BFEA0077E104 /* SendBridge.cpp in Sources */,
21B67CAC2C77329800FD64FC /* BaseBridge.cpp in Sources */,
210CC8832C80E6A300610F58 /* TriggerEvent.cpp in Sources */,
21B67CEB2C78D27200FD64FC /* DocumentInfo.cpp in Sources */,
@@ -1311,6 +1328,7 @@
buildActionMask = 2147483647;
files = (
219F30422C769283009834E9 /* ConfigTests.cpp in Sources */,
21D0BD672C89D7410077E104 /* AccountTests.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
+55 -1
View File
@@ -1,19 +1,28 @@
#include "Active/File/Directory.h"
#include "ConnectorResource.h"
#include "Connector/Connector.h"
#include "Connector/Database/Model/Card/ModelCardDatabase.h"
#include "Interface/ConnectorMenu.h"
#include "Interface/ConnectorPalette.h"
#include "Speckle/Database/AccountDatabase.h"
#include "Speckle/Environment/Addon.h"
#include "Speckle/Utility/String.h"
using namespace active::file;
using namespace active::environment;
using namespace connector;
using namespace connector::database;
using namespace speckle::database;
using namespace speckle::environment;
using namespace speckle::utility;
namespace {
//The Speckle application data/support directory name
const char* speckleDataDirName = "Speckle";
//The account database name
const char* accountDBaseName = "Accounts.db";
///The Connector addon class
class ConnectorInstance : public ConnectorAddon {
public:
@@ -28,15 +37,34 @@ namespace {
Get the model card database
@return The model card database
*/
const ModelCardDatabase* getModelCards() const override { return &m_modelCards; }
const ModelCardDatabase* getModelCardDatabase() const override { return &m_modelCards; }
/*!
Get the account database
@return The account database
*/
const AccountDatabase* getAccountDatabase() const override;
private:
mutable std::unique_ptr<AccountDatabase> m_account;
ModelCardDatabase m_modelCards;
};
///The active addon instance
std::unique_ptr<ConnectorAddon> m_addonInstance;
/*--------------------------------------------------------------------
Get the speckle application data directory (creating if missing)
return: The application data directory (nullopt = missing and unable to create)
--------------------------------------------------------------------*/
Directory::Option getAppDataDirectory() {
auto appData = Directory::appData();
if (!appData)
return std::nullopt;
return Directory{*appData, speckleDataDirName, true};
} //getAppDataDirectory
}
/*--------------------------------------------------------------------
@@ -48,6 +76,32 @@ ConnectorAddon::ConnectorAddon(const speckle::utility::String& name) : Addon{nam
} //ConnectorAddon::ConnectorAddon
/*--------------------------------------------------------------------
Get the account database
return: The account database
--------------------------------------------------------------------*/
const AccountDatabase* ConnectorInstance::getAccountDatabase() const {
if (!m_account) {
auto speckleDirectory = getAppDataDirectory();
if (!speckleDirectory)
return nullptr;
m_account = std::make_unique<AccountDatabase>(speckleDirectory->getPath() / accountDBaseName);
}
return m_account.get();
} //ConnectorInstance::getAccounts
/*--------------------------------------------------------------------
Get an object representing the connector instance
@return The active connector instance (nullptr if no connector is running)
--------------------------------------------------------------------*/
ConnectorAddon* connector::connector() {
return m_addonInstance.get();
} //connector::connector
#ifdef ARCHICAD
/*!
The following is the C interface for the plugin to Archicad as specified by the API
+9 -3
View File
@@ -1,10 +1,11 @@
#include "Speckle/Environment/Addon.h"
#include "Speckle/Utility/String.h"
namespace speckle::database {
class AccountDatabase;
}
namespace connector::database {
class ModelCardDatabase;
}
namespace connector {
@@ -19,7 +20,12 @@ namespace connector {
Get the model card database
@return The model card database
*/
const virtual database::ModelCardDatabase* getModelCards() const = 0;
const virtual database::ModelCardDatabase* getModelCardDatabase() const = 0;
/*!
Get the account database
@return The account database
*/
const virtual speckle::database::AccountDatabase* getAccountDatabase() const = 0;
protected:
/*!
@@ -2,6 +2,8 @@
#include "Active/Serialise/CargoHold.h"
#include "Active/Serialise/Package/Wrapper/ContainerWrap.h"
#include "Connector/Connector.h"
#include "Speckle/Database/AccountDatabase.h"
#include "Speckle/Record/Credentials/Account.h"
using namespace active::container;
@@ -31,6 +33,7 @@ GetAccounts::GetAccounts() : BridgeMethod{"GetAccounts", [&]() {
--------------------------------------------------------------------*/
std::unique_ptr<Cargo> GetAccounts::run() const {
Vector<Account> accounts;
///TODO: Get the accounts here - returning an empty array for testing only
if (auto accountDBase = connector()->getAccountDatabase(); accountDBase != nullptr)
accounts = accountDBase->getAccounts();
return std::make_unique<WrappedValue>(accounts);
} //GetAccounts::run
@@ -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
@@ -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
@@ -0,0 +1,10 @@
#include "Connector/Interface/Browser/Bridge/Send/SendBridge.h"
using namespace connector::interfac::browser::bridge;
/*--------------------------------------------------------------------
Default constructor
--------------------------------------------------------------------*/
SendBridge::SendBridge() : BrowserBridge{"sendBinding"} {
//Add bridge methods
} //SendBridge::SendBridge
@@ -0,0 +1,29 @@
#ifndef CONNECTOR_INTERFACE_BRIDGE_SEND_BRIDGE
#define CONNECTOR_INTERFACE_BRIDGE_SEND_BRIDGE
#include "Speckle/Interface/Browser/Bridge/BrowserBridge.h"
namespace connector::interfac::browser::bridge {
/*!
A browser bridge to support sending model data to a Speckle server
*/
class SendBridge : public speckle::interfac::browser::bridge::BrowserBridge {
public:
// MARK: - Types
using base = speckle::interfac::browser::bridge::BrowserBridge;
// MARK: - Constructors
using base::base;
/*!
Default constructor
*/
SendBridge();
};
}
#endif //CONNECTOR_INTERFACE_BRIDGE_SEND_BRIDGE
@@ -6,6 +6,7 @@
#include "Connector/Interface/Browser/Bridge/Account/AccountBridge.h"
#include "Connector/Interface/Browser/Bridge/Base/BaseBridge.h"
#include "Connector/Interface/Browser/Bridge/Config/ConfigBridge.h"
#include "Connector/Interface/Browser/Bridge/Send/SendBridge.h"
#include "Connector/Interface/Browser/Bridge/Test/TestBridge.h"
#include "Speckle/Environment/Addon.h"
#include "Speckle/Event/Type/MenuEvent.h"
@@ -18,9 +19,9 @@
using namespace active::environment;
using namespace active::event;
using namespace connector;
using namespace speckle::interfac::browser;
using namespace connector::interfac::browser::bridge;
using namespace speckle::event;
//using namespace speckle::interfac::browser;
//NB: Following is placeholder from GS example code - will be refactored to better suit our purposes
@@ -36,7 +37,7 @@ namespace {
// --- Class declaration: BrowserPalette ------------------------------------------
class BrowserPalette final : public DG::Palette, public DG::PanelObserver, public speckle::interfac::browser::JSPortal<> {
class BrowserPalette final : public DG::Palette, public DG::PanelObserver, public JSPortal<> {
public:
enum SelectionModification { RemoveFromSelection, AddToSelection };
@@ -128,7 +129,7 @@ bool ConnectorPalette::start() {
--------------------------------------------------------------------*/
bool ConnectorPalette::receive(const active::event::Event& event) {
if (BrowserPalette::HasInstance() && BrowserPalette::GetInstance().IsVisible()) {
BrowserPalette::GetInstance ().Hide ();
BrowserPalette::GetInstance().Hide ();
} else {
if (!BrowserPalette::HasInstance())
BrowserPalette::CreateInstance();
@@ -165,6 +166,7 @@ BrowserPalette::BrowserPalette() :
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>());
InitBrowserControl();
}
+1 -1
View File
@@ -7,7 +7,7 @@ namespace connector {
static const unsigned int versionMinor = 2;
static const unsigned int versionPatch = 0;
static const unsigned int versionPatch = 1;
}
@@ -0,0 +1,33 @@
#include "ActiveLibDoctest/TestingPlatforms.h"
#include "Active/Serialise/JSON/JSONTransport.h"
#include "Active/Serialise/Package/PackageWrap.h"
#include "Active/Utility/BufferIn.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\":\"194B6E32061EB588B31D8CBC167DAAD8\",\"token\":\"547e30bcd0f0e377fe422019f388295e37c583a99f\",\"refreshToken\":\"7d23031b44856e768b5951161c9bc8378f663eefce\",\"isDefault\":false,\"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\":\"e66694013f\",\"name\":\"oguzhan@speckle.systems\",\"email\":\"oguzhan@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;
try {
JSONTransport().receive(PackageWrap{account}, Identity{}, String{accountJSON});
} catch(...) {
FAIL_CHECK(TEST_MESSAGE(Account deserialisation failed));
}
}
TEST_SUITE_CLOSE
@@ -0,0 +1,91 @@
#include "Active/Database/Storage/SQLiteEngine.h"
#include "Active/Database/Storage/Storage.h"
#include "Active/Serialise/JSON/JSONTransport.h"
#include "Active/Setting/ValueSetting.h"
#include "Active/Setting/Values/StringValue.h"
#include "Speckle/Database/AccountDatabase.h"
using namespace active::container;
using namespace active::database;
using namespace active::serialise::json;
using namespace active::setting;
using namespace speckle::record::cred;
using namespace speckle::database;
using namespace speckle::utility;
namespace {
//Account field indices
enum Fields {
hashID = 0,
contentID,
};
///Internal name of the accounts dbase
const char* accountsDBaseName = "accounts";
///Accounts table name
const char* accountsTableName = "objects";
///Hash field name
const char* hashFieldName = "hash";
///Content field name
const char* contentFieldName = "content";
}
namespace speckle::database {
///Accounts database engine declaration
using AccountsEngine = SQLiteEngine<Account, Account, JSONTransport, active::utility::String, active::utility::String>;
///Accounts database storage declaration
class AccountDatabase::Store : public active::database::Storage<speckle::record::cred::Account, active::serialise::json::JSONTransport,
active::utility::String, active::utility::String, active::utility::String, active::utility::String> {
using base = active::database::Storage<speckle::record::cred::Account, active::serialise::json::JSONTransport,
active::utility::String, active::utility::String, active::utility::String, active::utility::String>;
using base::base;
};
}
/*--------------------------------------------------------------------
Constructor
path: Path to the database file
--------------------------------------------------------------------*/
AccountDatabase::AccountDatabase(const active::file::Path& path) {
//Create accounts database storage (with schema)
m_store = std::make_unique<Store>(
//Engine
std::make_unique<AccountsEngine>(path,
//Schema
DBaseSchema{active::utility::String{accountsDBaseName},
//Tables
{
//Account table
{
accountsTableName, Fields::hashID, Fields::contentID, {
ValueSetting{StringValue{}, hashFieldName},
ValueSetting{StringValue{}, contentFieldName},
}
}
}
}
)
);
} //AccountDatabase::AccountDatabase
/*--------------------------------------------------------------------
Destructor
--------------------------------------------------------------------*/
AccountDatabase::~AccountDatabase() {}
/*--------------------------------------------------------------------
Get all accounts
return: All the accounts
--------------------------------------------------------------------*/
Vector<Account> AccountDatabase::getAccounts() const {
return m_store->getObjects();
} //AccountDatabase::getAccounts
@@ -0,0 +1,46 @@
#ifndef SPECKLE_DATABASE_ACCOUNT_DBASE
#define SPECKLE_DATABASE_ACCOUNT_DBASE
#include "Active/File/Path.h"
#include "Speckle/Record/Credentials/Account.h"
namespace speckle::database {
/*!
A base class for an addon
*/
class AccountDatabase {
public:
// MARK: - Constructors
/*!
Constructor
@param path Path to the database file
*/
AccountDatabase(const active::file::Path& path);
AccountDatabase(const AccountDatabase&) = delete;
/*!
Destructor
*/
~AccountDatabase();
// MARK: - Functions (const)
/*!
Get all accounts
@return All the accounts
*/
active::container::Vector<record::cred::Account> getAccounts() const;
// MARK: - Functions (mutating)
private:
class Store;
///Accounts database storage
std::unique_ptr<Store> m_store;
};
}
#endif //SPECKLE_DATABASE_ACCOUNT_DBASE
+11 -34
View File
@@ -8,40 +8,17 @@ using namespace speckle::utility;
/*--------------------------------------------------------------------
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
inventory: The inventory to receive the package items
return: True if the package has added items to the inventory
--------------------------------------------------------------------*/
bool Record::fillInventory(Inventory& inventory) const {
//TODO: Complete
bool Record::fillInventory(active::serialise::Inventory& inventory) const {
using enum Entry::Type;
inventory.merge(Inventory{
{
{ Identity{"id"}, active::database::record::FieldIndex::idIndex, element },
},
}.withType(&typeid(base)));
return true;
} //Record::fillInventory
/*--------------------------------------------------------------------
Get the specified cargo
@param item The inventory item to retrieve
@return The requested cargo (nullptr on failure)
--------------------------------------------------------------------*/
Cargo::Unique Record::getCargo(const Inventory::Item& item) const {
//TODO: Complete
return nullptr;
} //Record::getCargo
/*--------------------------------------------------------------------
Set to the default package content
--------------------------------------------------------------------*/
void Record::setDefault() {
//TODO: Complete
} //Record::setDefault
/*--------------------------------------------------------------------
Validate the cargo data
return: True if the data has been validated
--------------------------------------------------------------------*/
bool Record::validate() {
//TODO: Complete
return true;
} //Record::validate
+8 -61
View File
@@ -1,19 +1,21 @@
#ifndef SPECKLE_DATABASE_RECORD
#define SPECKLE_DATABASE_RECORD
#include "Active/Serialise/Package/Package.h"
#include "Speckle/Database/Content/Link.h"
#include "Active/Database/Content/Record.h"
#include "Speckle/Database/Identity/Link.h"
namespace speckle::database {
/*!
Base class for a database record
*/
class Record : public active::serialise::Package, public active::utility::Cloner {
class Record : public active::database::Record<speckle::utility::String, speckle::utility::String, speckle::utility::String> {
public:
// MARK: - Types
using base = active::database::Record<speckle::utility::String, speckle::utility::String, speckle::utility::String>;
///Unique pointer
using Unique = std::unique_ptr<Record>;
///Shared pointer
using Shared = std::shared_ptr<Record>;
@@ -26,47 +28,17 @@ namespace speckle::database {
Constructor
@param ID The record ID
*/
Record(speckle::utility::Guid ID) : m_ID{ID} {}
Record(speckle::utility::String ID) : base{ID} {}
/*!
Destructor
*/
virtual ~Record() {}
// MARK: - Functions (const)
/*!
Get the record ID
@return The record ID
*/
speckle::utility::Guid getID() const { return m_ID; }
/*!
Get the record unique ID
@return The record unique ID
*/
speckle::utility::Guid getUniqueID() const { return m_uniqueID; }
/*!
Get the record index
@return The record index
*/
virtual Index getIndex() const { return Index{m_ID, m_ownerID}; }
/*!
Get the record link
@return The record link
*/
virtual Link getLink() const { return Link{getIndex()}; }
// MARK: - Functions (mutating)
/*!
Set the record ID
@param ID The record ID
*/
void setID(speckle::utility::Guid ID) { m_ID = ID; }
/*!
Set the record unique ID
@param ID The record unique ID
*/
void setUniqueID(speckle::utility::Guid ID) { m_uniqueID = ID; }
// MARK: - Serialisation
@@ -76,31 +48,6 @@ namespace speckle::database {
@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;
/*!
Validate the cargo data
@return True if the data has been validated
*/
bool validate() override;
private:
///The record ID (may not be unique across models)
speckle::utility::Guid m_ID = speckle::utility::Guid{true};
///The record unique ID
speckle::utility::Guid m_uniqueID = speckle::utility::Guid{true};
///The record owner ID (null guid if unspecified)
speckle::utility::Guid m_ownerID;
///The last edit time
active::utility::Time editTime = active::utility::Time{};
};
}
@@ -1,7 +1,8 @@
#ifndef SPECKLE_DATABASE_INDEX
#define SPECKLE_DATABASE_INDEX
#include "Speckle/Utility/Guid.h"
#include "Active/Database/Identity/Link.h"
#include "Speckle/Utility/String.h"
namespace speckle::database {
@@ -12,23 +13,16 @@ namespace speckle::database {
this is typically a guid, for Revit a string and for Vectorworks a handle. Note that this index is not necessarily persistent between
sessions.
*/
class Index : public speckle::utility::Guid {
class Index : public active::database::Index<speckle::utility::String, speckle::utility::String, speckle::utility::String> {
public:
// MARK: - Types
using base = speckle::utility::Guid;
using base = active::database::Index<speckle::utility::String, speckle::utility::String, speckle::utility::String>;
// MARK: - Constructors
using base::base;
Index(speckle::utility::Guid ID, speckle::utility::Guid dbaseID) : base{ID}, databaseID{dbaseID} {}
// MARK: - Public variables
///ID of the source database (not defined in every case, undefined = null guid)
speckle::utility::Guid databaseID;
};
}
@@ -1,6 +1,8 @@
#include "Speckle/Database/Content/Link.h"
#include "Speckle/Database/Identity/Link.h"
#include "Speckle/Utility/Guid.h"
using namespace speckle::database;
using namespace speckle::utility;
#ifdef ARCHICAD
/*--------------------------------------------------------------------
@@ -8,9 +10,9 @@ using namespace speckle::database;
selected: Information about a selected Archicad element
--------------------------------------------------------------------*/
Link::Link(const API_Neig& selected) : recordID{selected.guid} {
//Link::Link(const API_Neig& selected) : base{Guid{selected.guid}} {
//More info should be extracted from API_Neig in future (as required)
} //Link::Link
//} //Link::Link
#endif
@@ -2,7 +2,7 @@
#define SPECKLE_DATABASE_LINK
#include "Active/Setting/SettingList.h"
#include "Speckle/Database/Content/Index.h"
#include "Speckle/Database/Identity/Index.h"
namespace speckle::database {
@@ -17,30 +17,18 @@ namespace speckle::database {
A link may optionally carry any number of settings. In the context of a user selection (for example) there might be settings describing where
the user made the selection (e.g. the hole in a floor slab), allowing a tool working on that selection to be more precise.
*/
class Link : public active::setting::SettingList {
class Link : public active::database::Link<speckle::utility::String, speckle::utility::String, speckle::utility::String> {
public:
// MARK: - Types
using base = active::setting::SettingList;
///Unique pointer
using Unique = std::unique_ptr<Link>;
///Shared pointer
using Shared = std::shared_ptr<Link>;
///Optional
using Option = std::optional<Link>;
using base = active::database::Link<speckle::utility::String, speckle::utility::String, speckle::utility::String>;
// MARK: - Constructors
using base::base;
/*!
Constructor
@param index An element index
@param origIndex The index of the original element (when the preceding index is to a proxy element)
*/
Link(const Index& index, const Index& origIndex = Index{}) : recordID{index}, originalID{origIndex} {}
Link() = default;
#ifdef ARCHICAD
/*!
Constructor
@@ -48,13 +36,6 @@ namespace speckle::database {
*/
Link(const API_Neig& selected);
#endif
// MARK: - Public variables
///ID of the linked record (defaults to null guid = undefined)
Index recordID;
///ID of the original record (in the case where the record is proxy for another - null guid = undefined)
Index originalID;
};
}
@@ -1,7 +1,7 @@
#include "Speckle/Event/Subscriber/SelectionSubscriber.h"
#include "Speckle/Environment/Addon.h"
#include "Speckle/Database/Content/Link.h"
#include "Speckle/Database/Identity/Link.h"
#include "Speckle/Event/Type/SelectionEvent.h"
using namespace active::environment;
@@ -5,7 +5,7 @@
#include "Active/Utility/Guid.h"
#include "Active/Utility/String.h"
#include "Speckle/Database/Content/Link.h"
#include "Speckle/Database/Identity/Link.h"
namespace speckle::event {
@@ -1,38 +1,97 @@
#include "Speckle/Record/Credentials/Account.h"
#include "Active/Serialise/Item/Wrapper/ValueWrap.h"
#include "Active/Serialise/Package/PackageWrap.h"
#include "Speckle/Utility/Guid.h"
using namespace active::serialise;
using namespace speckle::record::cred;
using namespace speckle::utility;
#include <array>
namespace {
///Serialisation fields
enum FieldIndex {
tokenID,
refreshTokenID,
isDefaultID,
isOnlineID,
serverInfoID,
userInfoID,
};
///Serialisation field IDs
static std::array fieldID = {
Identity{"token"},
Identity{"refreshToken"},
Identity{"isDefault"},
Identity{"isOnline"},
Identity{"serverInfo"},
Identity{"userInfo"},
};
}
/*--------------------------------------------------------------------
Default constructor
--------------------------------------------------------------------*/
Account::Account(Guid ID) : Record{ID} {
Account::Account(const String& ID) : base{ID} {
//TODO: Complete
} //Account::Account
/*--------------------------------------------------------------------
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
inventory: The inventory to receive the package items
return: True if the package has added items to the inventory
--------------------------------------------------------------------*/
bool Account::fillInventory(Inventory& inventory) const {
//TODO: Complete
return true;
using enum Entry::Type;
inventory.merge(Inventory{
{
{ fieldID[tokenID], tokenID, element },
{ fieldID[refreshTokenID], refreshTokenID, element },
{ fieldID[isDefaultID], isDefaultID, element },
{ fieldID[isOnlineID], isOnlineID, element },
{ fieldID[serverInfoID], serverInfoID, element },
{ fieldID[userInfoID], userInfoID, element },
},
}.withType(&typeid(Account)));
return base::fillInventory(inventory);
} //Account::fillInventory
/*--------------------------------------------------------------------
Get the specified cargo
@param item The inventory item to retrieve
@return The requested cargo (nullptr on failure)
item: The inventory item to retrieve
return: The requested cargo (nullptr on failure)
--------------------------------------------------------------------*/
Cargo::Unique Account::getCargo(const Inventory::Item& item) const {
//TODO: Complete
return nullptr;
if (item.ownerType != &typeid(Account))
return base::getCargo(item);
using namespace active::serialise;
switch (item.index) {
case tokenID:
return std::make_unique<ValueWrap<String>>(m_token);
case refreshTokenID:
return std::make_unique<ValueWrap<String>>(m_refreshToken);
case isDefaultID:
return std::make_unique<ValueWrap<bool>>(m_isDefault);
case isOnlineID:
return std::make_unique<ValueWrap<bool>>(m_isOnline);
case serverInfoID:
return std::make_unique<PackageWrap>(m_serverInfo);
case userInfoID:
return std::make_unique<PackageWrap>(m_userInfo);
default:
return nullptr; //Requested an unknown index
}
} //Account::getCargo
@@ -40,16 +99,8 @@ Cargo::Unique Account::getCargo(const Inventory::Item& item) const {
Set to the default package content
--------------------------------------------------------------------*/
void Account::setDefault() {
//TODO: Complete
m_token.clear();
m_refreshToken.clear();
m_isDefault = false;
m_isOnline = true;
} //Account::setDefault
/*--------------------------------------------------------------------
Validate the cargo data
return: True if the data has been validated
--------------------------------------------------------------------*/
bool Account::validate() {
//TODO: Complete
return true;
} //Account::validate
@@ -3,6 +3,8 @@
#include "Active/Setting/SettingList.h"
#include "Speckle/Database/Content/Record.h"
#include "Speckle/Record/Credentials/ServerInfo.h"
#include "Speckle/Record/Credentials/UserInfo.h"
#include "Speckle/Utility/String.h"
namespace speckle::record::cred {
@@ -31,13 +33,19 @@ namespace speckle::record::cred {
Default constructor
@param ID The account record ID
*/
Account(speckle::utility::Guid ID = speckle::utility::Guid{});
Account(const speckle::utility::String& ID = speckle::utility::String{});
/*!
Copy constructor
@param source The object to copy
*/
Account(const Account&) = default;
/*!
Object cloning
@return A clone of this object
*/
Account* clonePtr() const override { return new Account{*this}; }
// MARK: - Functions (const)
// MARK: - Functions (mutating)
@@ -60,11 +68,6 @@ namespace speckle::record::cred {
Set to the default package content
*/
void setDefault() override;
/*!
Validate the cargo data
@return True if the data has been validated
*/
bool validate() override;
private:
///Authorisation token
@@ -76,9 +79,9 @@ namespace speckle::record::cred {
///True if the account is online
bool m_isOnline = true;
///Account server info
//std::unique_ptr<ServerInfo> m_serverInfo;
///Account server info
//std::unique_ptr<UserInfo> m_userInfo;
ServerInfo m_serverInfo;
///Account user info
UserInfo m_userInfo;
};
}
@@ -0,0 +1,111 @@
#include "Speckle/Record/Credentials/ServerInfo.h"
#include "Active/Serialise/Item/Wrapper/ValueWrap.h"
#include "Active/Serialise/Package/PackageWrap.h"
#include "Speckle/Utility/Guid.h"
#include <array>
using namespace active::serialise;
using namespace speckle::record::cred;
using namespace speckle::utility;
namespace {
///Serialisation fields
enum FieldIndex {
nameID,
companyID,
versionID,
contactID,
descriptionID,
frontEndID,
urlID,
migrationID,
};
///Serialisation field IDs
static std::array fieldID = {
Identity{"name"},
Identity{"company"},
Identity{"version"},
Identity{"adminContact"},
Identity{"description"},
Identity{"frontend2"},
Identity{"url"},
Identity{"migration"},
};
}
/*--------------------------------------------------------------------
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 ServerInfo::fillInventory(Inventory& inventory) const {
using enum Entry::Type;
inventory.merge(Inventory{
{
{ fieldID[nameID], nameID, element },
{ fieldID[companyID], companyID, element },
{ fieldID[versionID], versionID, element },
{ fieldID[contactID], contactID, element },
{ fieldID[descriptionID], descriptionID, element },
{ fieldID[frontEndID], frontEndID, element },
{ fieldID[urlID], urlID, element },
{ fieldID[migrationID], migrationID, element },
},
}.withType(&typeid(ServerInfo)));
return true;
} //ServerInfo::fillInventory
/*--------------------------------------------------------------------
Get the specified cargo
item: The inventory item to retrieve
return: The requested cargo (nullptr on failure)
--------------------------------------------------------------------*/
Cargo::Unique ServerInfo::getCargo(const Inventory::Item& item) const {
if (item.ownerType != &typeid(ServerInfo))
return nullptr;
using namespace active::serialise;
switch (item.index) {
case nameID:
return std::make_unique<ValueWrap<String>>(m_name);
case companyID:
return std::make_unique<ValueWrap<String>>(m_company);
case versionID:
return std::make_unique<ValueWrap<String>>(m_version);
case contactID:
return std::make_unique<ValueWrap<String>>(m_adminContact);
case descriptionID:
return std::make_unique<ValueWrap<String>>(m_description);
case frontEndID:
return std::make_unique<ValueWrap<bool>>(m_frontend2);
case urlID:
return std::make_unique<ValueWrap<String>>(m_url);
case migrationID:
return std::make_unique<PackageWrap>(m_migration);
default:
return nullptr; //Requested an unknown index
}
} //ServerInfo::getCargo
/*--------------------------------------------------------------------
Set to the default package content
--------------------------------------------------------------------*/
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
@@ -0,0 +1,94 @@
#ifndef SPECKLE_RECORD_CRED_SERVER_INFO
#define SPECKLE_RECORD_CRED_SERVER_INFO
#include "Active/Serialise/Package/Package.h"
#include "Speckle/Record/Credentials/ServerMigration.h"
#include "Speckle/Utility/String.h"
namespace speckle::record::cred {
/*!
Account server info
*/
class ServerInfo : public active::serialise::Package {
public:
// MARK: - Constructors
/*!
Default constructor
*/
ServerInfo() {}
/*!
Constructor
@param name The server name
@param company The company name
@param version The server version
@param contact Admin contact email
@param description The server description
@param url The server URL
@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) :
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;
// MARK: - Functions (const)
/*!
Get the server name
@return The server name
*/
const utility::String& getName() const { return m_name; }
// 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;
private:
///Server name
utility::String m_name;
///Company name
utility::String m_company;
///Server version
utility::String m_version;
///Admin contact email
utility::String m_adminContact;
///Server description
utility::String 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"
*/
bool m_frontend2 = false;
/*!
Server URL
This field is not returned from the GQL API, it should be populated after construction.
See "Speckle.Core.Credentials.AccountManager"
*/
utility::String m_url;
///Server migration record
ServerMigration m_migration;
};
}
#endif //SPECKLE_RECORD_CRED_SERVER_INFO
@@ -0,0 +1,75 @@
#include "Speckle/Record/Credentials/ServerMigration.h"
#include "Active/Serialise/Item/Wrapper/ValueWrap.h"
#include "Speckle/Utility/Guid.h"
using namespace active::serialise;
using namespace speckle::record::cred;
using namespace speckle::utility;
#include <array>
namespace {
///Serialisation fields
enum FieldIndex {
movedToID,
movedFromID,
};
///Serialisation field IDs
static std::array fieldID = {
Identity{"movedTo"},
Identity{"movedFrom"},
};
}
/*--------------------------------------------------------------------
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 ServerMigration::fillInventory(Inventory& inventory) const {
using enum Entry::Type;
inventory.merge(Inventory{
{
{ fieldID[movedToID], movedToID, element },
{ fieldID[movedFromID], movedFromID, element },
},
}.withType(&typeid(ServerMigration)));
return true;
} //ServerMigration::fillInventory
/*--------------------------------------------------------------------
Get the specified cargo
item: The inventory item to retrieve
return: The requested cargo (nullptr on failure)
--------------------------------------------------------------------*/
Cargo::Unique ServerMigration::getCargo(const Inventory::Item& item) const {
if (item.ownerType != &typeid(ServerMigration))
return nullptr;
using namespace active::serialise;
switch (item.index) {
case movedToID:
return std::make_unique<ValueWrap<String>>(movedTo);
case movedFromID:
return std::make_unique<ValueWrap<String>>(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
@@ -0,0 +1,54 @@
#ifndef SPECKLE_RECORD_CRED_SERVER_MIGRATION
#define SPECKLE_RECORD_CRED_SERVER_MIGRATION
#include "Active/Serialise/Package/Package.h"
#include "Speckle/Utility/String.h"
namespace speckle::record::cred {
/*!
User account record class
*/
class ServerMigration : public active::serialise::Package {
public:
// MARK: - Constructors
/*!
Default constructor
@param mvTo New URI where this server is now deployed
@param mvFm Previous URI where this server used to be deployed
*/
ServerMigration(const speckle::utility::String& mvTo = speckle::utility::String{},
const speckle::utility::String& mvFm = speckle::utility::String{}) : movedTo{mvTo}, movedFrom{mvFm} {}
// MARK: - Public variables
///New URI where this server is now deployed
speckle::utility::String movedTo;
///Previous URI where this server used to be deployed
speckle::utility::String movedFrom;
// 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 //SPECKLE_RECORD_CRED_SERVER_MIGRATION
@@ -0,0 +1,94 @@
#include "Speckle/Record/Credentials/UserInfo.h"
#include "Active/Serialise/Item/Wrapper/ValueWrap.h"
#include "Active/Serialise/Package/PackageWrap.h"
#include "Speckle/Utility/Guid.h"
#include <array>
using namespace active::serialise;
using namespace speckle::record::cred;
using namespace speckle::utility;
namespace {
///Serialisation fields
enum FieldIndex {
idID,
nameID,
emailID,
companyID,
avatarID,
};
///Serialisation field IDs
static std::array fieldID = {
Identity{"id"},
Identity{"name"},
Identity{"email"},
Identity{"company"},
Identity{"avatar"},
};
}
/*--------------------------------------------------------------------
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 UserInfo::fillInventory(Inventory& inventory) const {
using enum Entry::Type;
inventory.merge(Inventory{
{
{ fieldID[idID], idID, element },
{ fieldID[nameID], nameID, element },
{ fieldID[emailID], emailID, element },
{ fieldID[companyID], companyID, element },
{ fieldID[avatarID], avatarID, element },
},
}.withType(&typeid(UserInfo)));
return true;
} //UserInfo::fillInventory
/*--------------------------------------------------------------------
Get the specified cargo
item: The inventory item to retrieve
return: The requested cargo (nullptr on failure)
--------------------------------------------------------------------*/
Cargo::Unique UserInfo::getCargo(const Inventory::Item& item) const {
if (item.ownerType != &typeid(UserInfo))
return nullptr;
using namespace active::serialise;
switch (item.index) {
case idID:
return std::make_unique<ValueWrap<String>>(m_id);
case nameID:
return std::make_unique<ValueWrap<String>>(m_name);
case emailID:
return std::make_unique<ValueWrap<String>>(m_email);
case companyID:
return std::make_unique<ValueWrap<String>>(m_company);
case avatarID:
return std::make_unique<ValueWrap<String>>(m_avatar);
default:
return nullptr; //Requested an unknown index
}
} //UserInfo::getCargo
/*--------------------------------------------------------------------
Set to the default package content
--------------------------------------------------------------------*/
void UserInfo::setDefault() {
m_id.clear();
m_name.clear();
m_company.clear();
m_email.clear();
m_avatar.clear();
} //UserInfo::setDefault
@@ -0,0 +1,81 @@
#ifndef SPECKLE_RECORD_CRED_USER_INFO
#define SPECKLE_RECORD_CRED_USER_INFO
#include "Active/Serialise/Package/Package.h"
#include "Speckle/Utility/String.h"
namespace speckle::record::cred {
/*!
User info
*/
class UserInfo : public active::serialise::Package {
public:
// MARK: - Constructors
/*!
Default constructor
*/
UserInfo() {}
/*!
Constructor
@param ID The user ID
@param name The user name
@param email The user email
@param company The company name
@param avatar ?
*/
UserInfo(const utility::String& ID, const utility::String& name, const utility::String& email, const utility::String& company,
const utility::String& avatar) :
m_id{ID}, m_name{name}, m_email{email}, m_company{company}, m_avatar{avatar} {}
UserInfo(const UserInfo&) = default;
// MARK: - Functions (const)
/*!
Get the user ID
@return The user ID
*/
const utility::String& getID() const { return m_id; }
/*!
Get the user name
@return The user name
*/
const utility::String& getName() const { return m_name; }
// 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;
private:
///User ID
utility::String m_id;
///User name
utility::String m_name;
///User email
utility::String m_email;
///Compsny name
utility::String m_company;
///Avatar?
utility::String m_avatar;
};
}
#endif //SPECKLE_RECORD_CRED_USER_INFO
+76 -30
View File
@@ -24,7 +24,19 @@
21B67D002C7CE15100FD64FC /* Exception.h in Headers */ = {isa = PBXBuildFile; fileRef = 21B67CFE2C7CE15100FD64FC /* Exception.h */; };
21B67D0D2C7E0E8D00FD64FC /* ErrorReport.h in Headers */ = {isa = PBXBuildFile; fileRef = 21B67D092C7E0E8D00FD64FC /* ErrorReport.h */; };
21B67D0E2C7E0E8D00FD64FC /* ErrorReport.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 21B67D0C2C7E0E8D00FD64FC /* ErrorReport.cpp */; };
21F69EBE2C63C954008B6A06 /* Link.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 21F69EBD2C63C954008B6A06 /* Link.cpp */; };
21D0BD202C86F0280077E104 /* AccountDatabase.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 21D0BD1D2C86F0280077E104 /* AccountDatabase.cpp */; };
21D0BD212C86F0280077E104 /* AccountDatabase.h in Headers */ = {isa = PBXBuildFile; fileRef = 21D0BD1E2C86F0280077E104 /* AccountDatabase.h */; };
21D0BD2B2C86FC350077E104 /* Record.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 21D0BD252C86FC350077E104 /* Record.cpp */; };
21D0BD2C2C86FC350077E104 /* Record.h in Headers */ = {isa = PBXBuildFile; fileRef = 21D0BD262C86FC350077E104 /* Record.h */; };
21D0BD312C86FE090077E104 /* Index.h in Headers */ = {isa = PBXBuildFile; fileRef = 21D0BD2D2C86FE090077E104 /* Index.h */; };
21D0BD322C86FE090077E104 /* Link.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 21D0BD2E2C86FE090077E104 /* Link.cpp */; };
21D0BD332C86FE090077E104 /* Link.h in Headers */ = {isa = PBXBuildFile; fileRef = 21D0BD2F2C86FE090077E104 /* Link.h */; };
21D0BD4D2C8901A00077E104 /* ServerInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = 21D0BD4B2C8901A00077E104 /* ServerInfo.h */; };
21D0BD4E2C8901A00077E104 /* ServerInfo.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 21D0BD4C2C8901A00077E104 /* ServerInfo.cpp */; };
21D0BD552C890B1C0077E104 /* ServerMigration.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 21D0BD512C890B1C0077E104 /* ServerMigration.cpp */; };
21D0BD562C890B1C0077E104 /* ServerMigration.h in Headers */ = {isa = PBXBuildFile; fileRef = 21D0BD542C890B1C0077E104 /* ServerMigration.h */; };
21D0BD592C8910400077E104 /* UserInfo.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 21D0BD572C8910400077E104 /* UserInfo.cpp */; };
21D0BD5A2C8910400077E104 /* UserInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = 21D0BD582C8910400077E104 /* UserInfo.h */; };
21F69F3B2C6B880C008B6A06 /* JSBaseTransport.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 21F69F382C6B880B008B6A06 /* JSBaseTransport.cpp */; };
21F69F512C6CCC25008B6A06 /* BrowserBridge.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 21F69F4A2C6CCC25008B6A06 /* BrowserBridge.cpp */; };
21F69F612C6D0286008B6A06 /* GetBindingsMethodNames.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 21F69F602C6D0286008B6A06 /* GetBindingsMethodNames.cpp */; };
@@ -32,7 +44,6 @@
21F69F7E2C6FD9FC008B6A06 /* GetCallResult.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 21F69F7A2C6FD9FC008B6A06 /* GetCallResult.cpp */; };
21F69F812C6FF3B0008B6A06 /* BridgeArgumentWrap.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 21F69F802C6FF3B0008B6A06 /* BridgeArgumentWrap.cpp */; };
21F69F962C71087A008B6A06 /* Account.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 21F69F922C71087A008B6A06 /* Account.cpp */; };
21F69FA42C729400008B6A06 /* Record.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 21F69FA32C729400008B6A06 /* Record.cpp */; };
21F69FA62C733EDA008B6A06 /* BridgeArgument.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 21F69FA52C733EDA008B6A06 /* BridgeArgument.cpp */; };
21F93AEC2B2F406E009A2C5B /* Addon.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 21F93AEA2B2F406D009A2C5B /* Addon.cpp */; };
/* End PBXBuildFile section */
@@ -100,7 +111,6 @@
219351982C6278D900E5A69C /* SelectionSubscriber.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SelectionSubscriber.h; sourceTree = "<group>"; };
219351992C6278D900E5A69C /* SelectionSubscriber.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SelectionSubscriber.cpp; sourceTree = "<group>"; };
2193519C2C627E3100E5A69C /* SelectionEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SelectionEvent.h; sourceTree = "<group>"; };
219351A72C62CA5300E5A69C /* Index.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Index.h; sourceTree = "<group>"; };
219351AC2C62CC1A00E5A69C /* Guid.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Guid.cpp; sourceTree = "<group>"; };
219351AD2C62CC1A00E5A69C /* Guid.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Guid.h; sourceTree = "<group>"; };
219351AE2C62CC1A00E5A69C /* String.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = String.cpp; sourceTree = "<group>"; };
@@ -109,8 +119,19 @@
21B67CFE2C7CE15100FD64FC /* Exception.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Exception.h; sourceTree = "<group>"; };
21B67D092C7E0E8D00FD64FC /* ErrorReport.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ErrorReport.h; sourceTree = "<group>"; };
21B67D0C2C7E0E8D00FD64FC /* ErrorReport.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ErrorReport.cpp; sourceTree = "<group>"; };
21F69EBC2C63944D008B6A06 /* Link.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Link.h; sourceTree = "<group>"; };
21F69EBD2C63C954008B6A06 /* Link.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Link.cpp; sourceTree = "<group>"; };
21D0BD1D2C86F0280077E104 /* AccountDatabase.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AccountDatabase.cpp; sourceTree = "<group>"; };
21D0BD1E2C86F0280077E104 /* AccountDatabase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AccountDatabase.h; sourceTree = "<group>"; };
21D0BD252C86FC350077E104 /* Record.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Record.cpp; sourceTree = "<group>"; };
21D0BD262C86FC350077E104 /* Record.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Record.h; sourceTree = "<group>"; };
21D0BD2D2C86FE090077E104 /* Index.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Index.h; sourceTree = "<group>"; };
21D0BD2E2C86FE090077E104 /* Link.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Link.cpp; sourceTree = "<group>"; };
21D0BD2F2C86FE090077E104 /* Link.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Link.h; sourceTree = "<group>"; };
21D0BD4B2C8901A00077E104 /* ServerInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ServerInfo.h; sourceTree = "<group>"; };
21D0BD4C2C8901A00077E104 /* ServerInfo.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ServerInfo.cpp; sourceTree = "<group>"; };
21D0BD512C890B1C0077E104 /* ServerMigration.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ServerMigration.cpp; sourceTree = "<group>"; };
21D0BD542C890B1C0077E104 /* ServerMigration.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ServerMigration.h; sourceTree = "<group>"; };
21D0BD572C8910400077E104 /* UserInfo.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UserInfo.cpp; sourceTree = "<group>"; };
21D0BD582C8910400077E104 /* UserInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UserInfo.h; sourceTree = "<group>"; };
21F69F012C66C229008B6A06 /* Doxyfile */ = {isa = PBXFileReference; lastKnownFileType = text; name = Doxyfile; path = Documentation/Doxyfile; sourceTree = "<group>"; };
21F69F192C6A0FE2008B6A06 /* JSBinding.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSBinding.h; sourceTree = "<group>"; };
21F69F352C6AA9B3008B6A06 /* JSFunction.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = JSFunction.h; sourceTree = "<group>"; };
@@ -134,10 +155,8 @@
21F69F7D2C6FD9FC008B6A06 /* GetCallResult.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GetCallResult.h; sourceTree = "<group>"; };
21F69F802C6FF3B0008B6A06 /* BridgeArgumentWrap.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = BridgeArgumentWrap.cpp; sourceTree = "<group>"; };
21F69F822C701A8E008B6A06 /* BridgeMethodBase.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = BridgeMethodBase.h; sourceTree = "<group>"; };
21F69F8F2C710012008B6A06 /* Record.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Record.h; sourceTree = "<group>"; };
21F69F922C71087A008B6A06 /* Account.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Account.cpp; sourceTree = "<group>"; };
21F69F932C71087A008B6A06 /* Account.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Account.h; sourceTree = "<group>"; };
21F69FA32C729400008B6A06 /* Record.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Record.cpp; sourceTree = "<group>"; };
21F69FA52C733EDA008B6A06 /* BridgeArgument.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = BridgeArgument.cpp; sourceTree = "<group>"; };
21F93AE92B2F406D009A2C5B /* Addon.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Addon.h; sourceTree = "<group>"; };
21F93AEA2B2F406D009A2C5B /* Addon.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Addon.cpp; sourceTree = "<group>"; };
@@ -166,7 +185,7 @@
isa = PBXGroup;
children = (
214EA4C52BA374FD008E5358 /* CMakeLists.txt */,
219351A92C62CA5300E5A69C /* Database */,
21D0BD1F2C86F0280077E104 /* Database */,
21F93AE82B2F406D009A2C5B /* Environment */,
21F93ACC2B2B67FC009A2C5B /* Event */,
21F69F1B2C6A0FE2008B6A06 /* Interface */,
@@ -246,26 +265,6 @@
path = Type;
sourceTree = "<group>";
};
219351A82C62CA5300E5A69C /* Content */ = {
isa = PBXGroup;
children = (
219351A72C62CA5300E5A69C /* Index.h */,
21F69EBD2C63C954008B6A06 /* Link.cpp */,
21F69EBC2C63944D008B6A06 /* Link.h */,
21F69FA32C729400008B6A06 /* Record.cpp */,
21F69F8F2C710012008B6A06 /* Record.h */,
);
path = Content;
sourceTree = "<group>";
};
219351A92C62CA5300E5A69C /* Database */ = {
isa = PBXGroup;
children = (
219351A82C62CA5300E5A69C /* Content */,
);
path = Database;
sourceTree = "<group>";
};
219351B02C62CC1A00E5A69C /* Utility */ = {
isa = PBXGroup;
children = (
@@ -289,6 +288,36 @@
path = SpeckleLibDoctest;
sourceTree = "<group>";
};
21D0BD1F2C86F0280077E104 /* Database */ = {
isa = PBXGroup;
children = (
21D0BD1D2C86F0280077E104 /* AccountDatabase.cpp */,
21D0BD1E2C86F0280077E104 /* AccountDatabase.h */,
21D0BD302C86FE090077E104 /* Identity */,
21D0BD272C86FC350077E104 /* Content */,
);
path = Database;
sourceTree = "<group>";
};
21D0BD272C86FC350077E104 /* Content */ = {
isa = PBXGroup;
children = (
21D0BD252C86FC350077E104 /* Record.cpp */,
21D0BD262C86FC350077E104 /* Record.h */,
);
path = Content;
sourceTree = "<group>";
};
21D0BD302C86FE090077E104 /* Identity */ = {
isa = PBXGroup;
children = (
21D0BD2D2C86FE090077E104 /* Index.h */,
21D0BD2E2C86FE090077E104 /* Link.cpp */,
21D0BD2F2C86FE090077E104 /* Link.h */,
);
path = Identity;
sourceTree = "<group>";
};
21F69F1A2C6A0FE2008B6A06 /* Browser */ = {
isa = PBXGroup;
children = (
@@ -359,6 +388,12 @@
children = (
21F69F922C71087A008B6A06 /* Account.cpp */,
21F69F932C71087A008B6A06 /* Account.h */,
21D0BD4C2C8901A00077E104 /* ServerInfo.cpp */,
21D0BD4B2C8901A00077E104 /* ServerInfo.h */,
21D0BD512C890B1C0077E104 /* ServerMigration.cpp */,
21D0BD542C890B1C0077E104 /* ServerMigration.h */,
21D0BD572C8910400077E104 /* UserInfo.cpp */,
21D0BD582C8910400077E104 /* UserInfo.h */,
);
path = Credentials;
sourceTree = "<group>";
@@ -402,13 +437,20 @@
isa = PBXHeadersBuildPhase;
buildActionMask = 2147483647;
files = (
21D0BD212C86F0280077E104 /* AccountDatabase.h in Headers */,
210CC86F2C7E879700610F58 /* ArgumentBase.h in Headers */,
210CC8A02C81E34400610F58 /* Platform.h in Headers */,
21B67D0D2C7E0E8D00FD64FC /* ErrorReport.h in Headers */,
21D0BD332C86FE090077E104 /* Link.h in Headers */,
21D0BD5A2C8910400077E104 /* UserInfo.h in Headers */,
21D0BD562C890B1C0077E104 /* ServerMigration.h in Headers */,
210CC88F2C81A98500610F58 /* Guid64.h in Headers */,
21B67D002C7CE15100FD64FC /* Exception.h in Headers */,
21D0BD2C2C86FC350077E104 /* Record.h in Headers */,
210CC8802C80CD2A00610F58 /* BridgeChild.h in Headers */,
21D0BD4D2C8901A00077E104 /* ServerInfo.h in Headers */,
2193518C2C62655700E5A69C /* MenuEvent.h in Headers */,
21D0BD312C86FE090077E104 /* Index.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -533,23 +575,27 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
21D0BD552C890B1C0077E104 /* ServerMigration.cpp in Sources */,
21F69FA62C733EDA008B6A06 /* BridgeArgument.cpp in Sources */,
21F69F682C6DFB01008B6A06 /* RunMethod.cpp in Sources */,
21F69F812C6FF3B0008B6A06 /* BridgeArgumentWrap.cpp in Sources */,
2193517B2C624FC100E5A69C /* MenuSubscriber.cpp in Sources */,
21F69F612C6D0286008B6A06 /* GetBindingsMethodNames.cpp in Sources */,
21F93AEC2B2F406E009A2C5B /* Addon.cpp in Sources */,
21D0BD4E2C8901A00077E104 /* ServerInfo.cpp in Sources */,
21B67D0E2C7E0E8D00FD64FC /* ErrorReport.cpp in Sources */,
21F69F7E2C6FD9FC008B6A06 /* GetCallResult.cpp in Sources */,
2193519B2C6278D900E5A69C /* SelectionSubscriber.cpp in Sources */,
21D0BD2B2C86FC350077E104 /* Record.cpp in Sources */,
21D0BD592C8910400077E104 /* UserInfo.cpp in Sources */,
210CC8902C81A98500610F58 /* Guid64.cpp in Sources */,
21F69EBE2C63C954008B6A06 /* Link.cpp in Sources */,
21D0BD322C86FE090077E104 /* Link.cpp in Sources */,
219351B32C62CC1A00E5A69C /* String.cpp in Sources */,
219351B12C62CC1A00E5A69C /* Guid.cpp in Sources */,
21F69FA42C729400008B6A06 /* Record.cpp in Sources */,
21F69F512C6CCC25008B6A06 /* BrowserBridge.cpp in Sources */,
21F69F3B2C6B880C008B6A06 /* JSBaseTransport.cpp in Sources */,
210CC89F2C81E34400610F58 /* Platform.cpp in Sources */,
21D0BD202C86F0280077E104 /* AccountDatabase.cpp in Sources */,
21F69F962C71087A008B6A06 /* Account.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
+14 -4
View File
@@ -19,10 +19,12 @@
</ProjectConfiguration>
</ItemGroup>
<ItemGroup>
<ClInclude Include="Speckle\Database\Content\Index.h" />
<ClInclude Include="Speckle\Database\Content\Link.h" />
<ClInclude Include="Speckle\Database\AccountDatabase.h" />
<ClInclude Include="Speckle\Database\Content\Record.h" />
<ClInclude Include="Speckle\Database\Identity\Index.h" />
<ClInclude Include="Speckle\Database\Identity\Link.h" />
<ClInclude Include="Speckle\Environment\Addon.h" />
<ClInclude Include="Speckle\Environment\Platform.h" />
<ClInclude Include="Speckle\Event\Subscriber\MenuSubscriber.h" />
<ClInclude Include="Speckle\Event\Subscriber\SelectionSubscriber.h" />
<ClInclude Include="Speckle\Event\Type\MenuEvent.h" />
@@ -46,6 +48,9 @@
<ClInclude Include="Speckle\Interface\Browser\NamedFunction.h" />
<ClInclude Include="Speckle\Interface\Browser\PlatformBinding.h" />
<ClInclude Include="Speckle\Record\Credentials\Account.h" />
<ClInclude Include="Speckle\Record\Credentials\ServerInfo.h" />
<ClInclude Include="Speckle\Record\Credentials\ServerMigration.h" />
<ClInclude Include="Speckle\Record\Credentials\UserInfo.h" />
<ClInclude Include="Speckle\Serialise\JSBase\JSBaseTransport.h" />
<ClInclude Include="Speckle\Utility\Exception.h" />
<ClInclude Include="Speckle\Utility\Guid.h" />
@@ -53,9 +58,11 @@
<ClInclude Include="Speckle\Utility\String.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="Speckle\Database\Content\Link.cpp" />
<ClCompile Include="Speckle\Database\AccountDatabase.cpp" />
<ClCompile Include="Speckle\Database\Content\Record.cpp" />
<ClCompile Include="Speckle\Database\Identity\Link.cpp" />
<ClCompile Include="Speckle\Environment\Addon.cpp" />
<ClCompile Include="Speckle\Environment\Platform.cpp" />
<ClCompile Include="Speckle\Event\Subscriber\MenuSubscriber.cpp" />
<ClCompile Include="Speckle\Event\Subscriber\SelectionSubscriber.cpp" />
<ClCompile Include="Speckle\Interface\Browser\Bridge\BridgeArgument.cpp" />
@@ -66,6 +73,9 @@
<ClCompile Include="Speckle\Interface\Browser\Bridge\Functions\GetCallResult.cpp" />
<ClCompile Include="Speckle\Interface\Browser\Bridge\Functions\RunMethod.cpp" />
<ClCompile Include="Speckle\Record\Credentials\Account.cpp" />
<ClCompile Include="Speckle\Record\Credentials\ServerInfo.cpp" />
<ClCompile Include="Speckle\Record\Credentials\ServerMigration.cpp" />
<ClCompile Include="Speckle\Record\Credentials\UserInfo.cpp" />
<ClCompile Include="Speckle\Serialise\JSBase\JSBaseTransport.cpp" />
<ClCompile Include="Speckle\Utility\Guid.cpp" />
<ClCompile Include="Speckle\Utility\Guid64.cpp" />
@@ -199,7 +209,7 @@
<WarningLevel>Level3</WarningLevel>
<SDLCheck>
</SDLCheck>
<PreprocessorDefinitions>WINDOWS;ARCHICAD;ACExtension;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>DEBUG;WINDOWS;ARCHICAD;ACExtension;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>false</ConformanceMode>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<PrecompiledHeaderFile>
+42 -9
View File
@@ -53,14 +53,11 @@
<Filter Include="Speckle\Serialise\JSBase">
<UniqueIdentifier>{8b3f75a2-8538-4f58-bc69-07679e9af863}</UniqueIdentifier>
</Filter>
<Filter Include="Speckle\Database\Identity">
<UniqueIdentifier>{ef1710f6-d890-4286-8fb2-f5c432a2c5ac}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClInclude Include="Speckle\Database\Content\Index.h">
<Filter>Speckle\Database\Content</Filter>
</ClInclude>
<ClInclude Include="Speckle\Database\Content\Link.h">
<Filter>Speckle\Database\Content</Filter>
</ClInclude>
<ClInclude Include="Speckle\Environment\Addon.h">
<Filter>Speckle\Environment</Filter>
</ClInclude>
@@ -151,11 +148,29 @@
<ClInclude Include="Speckle\Utility\Guid64.h">
<Filter>Speckle\Utility</Filter>
</ClInclude>
<ClInclude Include="Speckle\Database\Identity\Index.h">
<Filter>Speckle\Database\Identity</Filter>
</ClInclude>
<ClInclude Include="Speckle\Database\Identity\Link.h">
<Filter>Speckle\Database\Identity</Filter>
</ClInclude>
<ClInclude Include="Speckle\Database\AccountDatabase.h">
<Filter>Speckle\Database</Filter>
</ClInclude>
<ClInclude Include="Speckle\Record\Credentials\ServerInfo.h">
<Filter>Speckle\Record\Credentials</Filter>
</ClInclude>
<ClInclude Include="Speckle\Record\Credentials\ServerMigration.h">
<Filter>Speckle\Record\Credentials</Filter>
</ClInclude>
<ClInclude Include="Speckle\Record\Credentials\UserInfo.h">
<Filter>Speckle\Record\Credentials</Filter>
</ClInclude>
<ClInclude Include="Speckle\Environment\Platform.h">
<Filter>Speckle\Environment</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="Speckle\Database\Content\Link.cpp">
<Filter>Speckle\Database\Content</Filter>
</ClCompile>
<ClCompile Include="Speckle\Environment\Addon.cpp">
<Filter>Speckle\Environment</Filter>
</ClCompile>
@@ -204,6 +219,24 @@
<ClCompile Include="Speckle\Utility\Guid64.cpp">
<Filter>Speckle\Utility</Filter>
</ClCompile>
<ClCompile Include="Speckle\Database\Identity\Link.cpp">
<Filter>Speckle\Database\Identity</Filter>
</ClCompile>
<ClCompile Include="Speckle\Database\AccountDatabase.cpp">
<Filter>Speckle\Database</Filter>
</ClCompile>
<ClCompile Include="Speckle\Record\Credentials\ServerInfo.cpp">
<Filter>Speckle\Record\Credentials</Filter>
</ClCompile>
<ClCompile Include="Speckle\Record\Credentials\ServerMigration.cpp">
<Filter>Speckle\Record\Credentials</Filter>
</ClCompile>
<ClCompile Include="Speckle\Record\Credentials\UserInfo.cpp">
<Filter>Speckle\Record\Credentials</Filter>
</ClCompile>
<ClCompile Include="Speckle\Environment\Platform.cpp">
<Filter>Speckle\Environment</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<Text Include="Speckle\CMakeLists.txt">
@@ -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