Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,16 @@

namespace {

static QString PREFIX_EXECUTABLE = "executable:";
static QString PREFIX_PARAMETER_GROUP = "paramGroup:";
static QString PREFIX_PARAMETER_CONTAINER = "paramContainer:";
static QString PREFIX_PARAMETER = "parameter:";
template<std::size_t N>
constexpr QLatin1String make_constexpr_QLatin1String_(const char (&str)[N])
{
return QLatin1String{str, static_cast<int>(N - 1)};
}

constexpr QLatin1String PREFIX_EXECUTABLE = make_constexpr_QLatin1String_("executable:");
constexpr QLatin1String PREFIX_PARAMETER_GROUP = make_constexpr_QLatin1String_("paramGroup:");
constexpr QLatin1String PREFIX_PARAMETER_CONTAINER= make_constexpr_QLatin1String_("paramContainer:");
constexpr QLatin1String PREFIX_PARAMETER = make_constexpr_QLatin1String_("parameter:");

}

Expand Down
11 changes: 9 additions & 2 deletions Libs/PluginFramework/ctkBasicLocation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,15 @@
#include <QReadLocker>
#include <QWriteLocker>

static const QString PROP_OSGI_LOCKING = "blueberry.locking";
static const QString DEFAULT_LOCK_FILENAME = ".metadata/.lock";
namespace {
template<std::size_t N>
constexpr QLatin1String make_constexpr_QLatin1String_(const char (&str)[N])
{
return QLatin1String{str, static_cast<int>(N - 1)};
}
constexpr QLatin1String PROP_OSGI_LOCKING = make_constexpr_QLatin1String_("blueberry.locking");
constexpr QLatin1String DEFAULT_LOCK_FILENAME = make_constexpr_QLatin1String_(".metadata/.lock");
} // namespace


//----------------------------------------------------------------------------
Expand Down
32 changes: 19 additions & 13 deletions Libs/PluginFramework/ctkLocationManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,23 +36,29 @@

namespace {

template<std::size_t N>
constexpr QLatin1String make_constexpr_QLatin1String_(const char (&str)[N])
{
return QLatin1String{str, static_cast<int>(N - 1)};
}

// Constants for configuration location discovery
static const QString CTK = "commontk";
static const QString PRODUCT_SITE_MARKER = ".commontkproduct";
static const QString PRODUCT_SITE_ID = "id";
static const QString PRODUCT_SITE_VERSION = "version";
constexpr QLatin1String CTK = make_constexpr_QLatin1String_("commontk");
constexpr QLatin1String PRODUCT_SITE_MARKER = make_constexpr_QLatin1String_(".commontkproduct");
constexpr QLatin1String PRODUCT_SITE_ID = make_constexpr_QLatin1String_("id");
constexpr QLatin1String PRODUCT_SITE_VERSION = make_constexpr_QLatin1String_("version");

static const QString CONFIG_DIR = "configuration";
constexpr QLatin1String CONFIG_DIR = make_constexpr_QLatin1String_("configuration");

// Data mode constants for user, configuration and data locations.
static const QString NONE = "@none";
static const QString NO_DEFAULT = "@noDefault";
static const QString USER_HOME = "@user.home";
static const QString USER_DIR = "@user.dir";
constexpr QLatin1String NONE = make_constexpr_QLatin1String_("@none");
constexpr QLatin1String NO_DEFAULT = make_constexpr_QLatin1String_("@noDefault");
constexpr QLatin1String USER_HOME = make_constexpr_QLatin1String_("@user.home");
constexpr QLatin1String USER_DIR = make_constexpr_QLatin1String_("@user.dir");
// Placeholder for hashcode of installation directory
static const QString INSTALL_HASH_PLACEHOLDER = "@install.hash";
constexpr QLatin1String INSTALL_HASH_PLACEHOLDER = make_constexpr_QLatin1String_("@install.hash");

static const QString INSTANCE_DATA_AREA_PREFIX = ".metadata/.plugins/";
constexpr QLatin1String INSTANCE_DATA_AREA_PREFIX = make_constexpr_QLatin1String_(".metadata/.plugins/");

static QScopedPointer<ctkBasicLocation> installLocation;
static QScopedPointer<ctkBasicLocation> configurationLocation;
Expand Down Expand Up @@ -138,7 +144,7 @@ ctkBasicLocation* BuildLocation(const QString& property, const QUrl& defaultLoca
int idx = location.indexOf(INSTALL_HASH_PLACEHOLDER);
if (idx == 0)
{
throw ctkRuntimeException("The location cannot start with '" + INSTALL_HASH_PLACEHOLDER + "': " + location);
throw ctkRuntimeException(QString("The location cannot start with '") + INSTALL_HASH_PLACEHOLDER + "': " + location);
}
else if (idx > 0)
{
Expand Down Expand Up @@ -280,7 +286,7 @@ static QString ComputeDefaultUserAreaLocation(const QString& pathAppendage)
QFileInfo installDir(installURL.toLocalFile());
QString installDirHash = GetInstallDirHash();

QString appName = "." + CTK;
QString appName = QString(".") + CTK;
QFileInfo ctkProduct(QDir(installDir.absoluteFilePath()), PRODUCT_SITE_MARKER);
if (ctkProduct.exists())
{
Expand Down
14 changes: 0 additions & 14 deletions Libs/PluginFramework/ctkPluginFrameworkDebug.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,20 +23,6 @@
#include "ctkPluginFrameworkDebug_p.h"

#include "ctkPluginFrameworkDebugOptions_p.h"
#include "ctkPluginFrameworkProperties_p.h"

static QString CTK_OSGI = "org.commontk.pluginfw";

QString ctkPluginFrameworkDebug::OPTION_DEBUG_GENERAL = CTK_OSGI + "/debug";
QString ctkPluginFrameworkDebug::OPTION_DEBUG_FRAMEWORK = CTK_OSGI + "/debug/framework";
QString ctkPluginFrameworkDebug::OPTION_DEBUG_ERRORS = CTK_OSGI + "/debug/errors";
QString ctkPluginFrameworkDebug::OPTION_DEBUG_HOOKS = CTK_OSGI + "/debug/hooks";
QString ctkPluginFrameworkDebug::OPTION_DEBUG_LAZY_ACTIVATION = CTK_OSGI + "/debug/lazy_activation";
QString ctkPluginFrameworkDebug::OPTION_DEBUG_LDAP = CTK_OSGI + "/debug/ldap";
QString ctkPluginFrameworkDebug::OPTION_DEBUG_SERVICE_REFERENCE = CTK_OSGI + "/debug/service_reference";
QString ctkPluginFrameworkDebug::OPTION_DEBUG_STARTLEVEL = CTK_OSGI + "/debug/startlevel";
QString ctkPluginFrameworkDebug::OPTION_DEBUG_URL = CTK_OSGI + "/debug/url";
QString ctkPluginFrameworkDebug::OPTION_DEBUG_RESOLVE = CTK_OSGI + "/debug/resolve";

//----------------------------------------------------------------------------
ctkPluginFrameworkDebug::ctkPluginFrameworkDebug()
Expand Down
38 changes: 28 additions & 10 deletions Libs/PluginFramework/ctkPluginFrameworkDebug_p.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,24 @@
#ifndef CTKPLUGINFRAMEWORKDEBUG_P_H
#define CTKPLUGINFRAMEWORKDEBUG_P_H

// Qt includes
#include <QLatin1String>

#include "ctkPluginFramework_global.h"

namespace {
/// Construct a QLatin1String from a string literal, deducing length at
/// compile time via the array-reference parameter. Avoids repeating
/// sizeof/static_cast at every definition site.
template<std::size_t N>
constexpr QLatin1String make_constexpr_QLatin1String_(const char (&str)[N])
{
return QLatin1String{str, static_cast<int>(N - 1)};
}
} // namespace

#define CTK_OSGI "org.commontk.pluginfw"

/**
* Variables that control debugging of the pluginfw code.
*/
Expand All @@ -34,65 +50,67 @@ class ctkPluginFrameworkDebug
public:
ctkPluginFrameworkDebug();

static QString OPTION_DEBUG_GENERAL;
static constexpr QLatin1String OPTION_DEBUG_GENERAL = make_constexpr_QLatin1String_(CTK_OSGI "/debug");
bool enabled;

/**
* Report error handling events.
*/
static QString OPTION_DEBUG_ERRORS;
static constexpr QLatin1String OPTION_DEBUG_ERRORS = make_constexpr_QLatin1String_(CTK_OSGI "/debug/errors");
bool errors;

/**
* Report pluginfw create, init, start, stop
*/
static QString OPTION_DEBUG_FRAMEWORK;
static constexpr QLatin1String OPTION_DEBUG_FRAMEWORK = make_constexpr_QLatin1String_(CTK_OSGI "/debug/framework");
bool framework;

/**
* Report hooks handling
*/
static QString OPTION_DEBUG_HOOKS;
static constexpr QLatin1String OPTION_DEBUG_HOOKS = make_constexpr_QLatin1String_(CTK_OSGI "/debug/hooks");
bool hooks;

/**
* Report triggering of lazy activation
*/
static QString OPTION_DEBUG_LAZY_ACTIVATION;
static constexpr QLatin1String OPTION_DEBUG_LAZY_ACTIVATION = make_constexpr_QLatin1String_(CTK_OSGI "/debug/lazy_activation");
bool lazy_activation;

/**
* Report LDAP handling
*/
static QString OPTION_DEBUG_LDAP;
static constexpr QLatin1String OPTION_DEBUG_LDAP = make_constexpr_QLatin1String_(CTK_OSGI "/debug/ldap");
bool ldap;

/**
* Print information about service reference lookups
* and rejections due to missing permissions
* for calling plug-ins.
*/
static QString OPTION_DEBUG_SERVICE_REFERENCE;
static constexpr QLatin1String OPTION_DEBUG_SERVICE_REFERENCE = make_constexpr_QLatin1String_(CTK_OSGI "/debug/service_reference");
bool service_reference;

/**
* Report startlevel.
*/
static QString OPTION_DEBUG_STARTLEVEL;
static constexpr QLatin1String OPTION_DEBUG_STARTLEVEL = make_constexpr_QLatin1String_(CTK_OSGI "/debug/startlevel");
bool startlevel;

/**
* Report url
*/
static QString OPTION_DEBUG_URL;
static constexpr QLatin1String OPTION_DEBUG_URL = make_constexpr_QLatin1String_(CTK_OSGI "/debug/url");
bool url;

/**
* Report plug-in resolve progress
*/
static QString OPTION_DEBUG_RESOLVE;
static constexpr QLatin1String OPTION_DEBUG_RESOLVE = make_constexpr_QLatin1String_(CTK_OSGI "/debug/resolve");
bool resolve;

};

#undef CTK_OSGI

#endif // CTKPLUGINFRAMEWORKDEBUG_P_H
9 changes: 8 additions & 1 deletion Libs/PluginFramework/ctkPluginFrameworkLauncher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,14 @@ const QString ctkPluginFrameworkLauncher::PROP_APPLICATION_LAUNCHDEFAULT = "ctk.

const QString ctkPluginFrameworkLauncher::PROP_OSGI_RELAUNCH = "ctk.pluginfw.relaunch";

static const QString PROP_FORCED_RESTART = "ctk.forcedRestart";
namespace {
template<std::size_t N>
constexpr QLatin1String make_constexpr_QLatin1String_(const char (&str)[N])
{
return QLatin1String{str, static_cast<int>(N - 1)};
}
constexpr QLatin1String PROP_FORCED_RESTART = make_constexpr_QLatin1String_("ctk.forcedRestart");
} // namespace

class ctkPluginFrameworkLauncherPrivate
{
Expand Down
Loading