From 27dbee8e620877f9a1668b1d58c7269a48c7e229 Mon Sep 17 00:00:00 2001 From: Robert Adam Date: Wed, 14 Apr 2021 19:47:00 +0200 Subject: FEAT(client): Plugin framework This commit introduces a new plugin framework into the codebase of the Mumble client. Note that "plugin" here really refers to a (more or less) general purpose plugin and is therefore not to be confused with the previously available positional data plugins (only responsible for fetching positional data from a running game and passing that to Mumble). The plugin interface is written in C, removing the compiler-dependence the old "plugins" had. Instead plugins can now be written in an arbitrary language as long as that language is capable of being compiled into a shared library and also being capable of being C-compatible. As already indicated a plugin is essentially a shared library that provides certain functions that allow Mumble to interface with it. Inside Mumble the so-called PluginManager is responsible for managing the plugins and relaying events to the respective callbacks. Plugins themselves can also interact with Mumble on their own initiative by using the provided API functions. Fixes #2455 Fixes #2148 Fixes #1594 Fixes #2051 Fixes #3742 Fixes #4575 Fixes #4751 --- src/ProcessResolver.h | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 src/ProcessResolver.h (limited to 'src/ProcessResolver.h') diff --git a/src/ProcessResolver.h b/src/ProcessResolver.h new file mode 100644 index 000000000..59ada3a1c --- /dev/null +++ b/src/ProcessResolver.h @@ -0,0 +1,40 @@ +// Copyright 2021 The Mumble Developers. All rights reserved. +// Use of this source code is governed by a BSD-style license +// that can be found in the LICENSE file at the root of the +// Mumble source tree or at . + +#ifndef MUMBLE_PROCESS_RESOLVER_H_ +#define MUMBLE_PROCESS_RESOLVER_H_ + +#include +#include + +/// This ProcessResolver can be used to get a QVector of running process names and associated PIDs on multiple platforms. +/// This object is by no means thread-safe! +class ProcessResolver { + protected: + /// The vector for the pointers to the process names + QVector m_processNames; + /// The vector for the process PIDs + QVector m_processPIDs; + + /// Deletes all names currently stored in processNames and clears processNames and processPIDs + void freeAndClearData(); + /// The OS specific implementation of filling in details about running process names and PIDs + void doResolve(); + public: + /// @param resolveImmediately Whether the constructor should directly invoke ProcesResolver::resolve() + ProcessResolver(bool resolveImmediately = true); + virtual ~ProcessResolver(); + + /// Resolves the namaes and PIDs of the running processes + void resolve(); + /// Gets a reference to the stored process names + const QVector& getProcessNames() const; + /// Gets a reference to the stored process PIDs (corresponding to the names returned by ProcessResolver::getProcessNames()) + const QVector& getProcessPIDs() const; + /// @returns The amount of processes that have been resolved by this object + size_t amountOfProcesses() const; +}; + +#endif // MUMBLE_PROCESS_RESOLVER_H_ -- cgit v1.2.3