diff options
author | Robert Adam <dev@robert-adam.de> | 2021-04-14 20:47:00 +0300 |
---|---|---|
committer | Robert Adam <dev@robert-adam.de> | 2021-04-16 21:15:44 +0300 |
commit | 27dbee8e620877f9a1668b1d58c7269a48c7e229 (patch) | |
tree | 0d445574449cb224a2d4cc8043520ca66c6afe11 /src/ProcessResolver.h | |
parent | c10d636cef79b07784318671df97dba6c1af2b83 (diff) |
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
Diffstat (limited to 'src/ProcessResolver.h')
-rw-r--r-- | src/ProcessResolver.h | 40 |
1 files changed, 40 insertions, 0 deletions
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 <https://www.mumble.info/LICENSE>. + +#ifndef MUMBLE_PROCESS_RESOLVER_H_ +#define MUMBLE_PROCESS_RESOLVER_H_ + +#include <stdint.h> +#include <QtCore/QVector> + +/// 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<const char*> m_processNames; + /// The vector for the process PIDs + QVector<uint64_t> 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<const char*>& getProcessNames() const; + /// Gets a reference to the stored process PIDs (corresponding to the names returned by ProcessResolver::getProcessNames()) + const QVector<uint64_t>& getProcessPIDs() const; + /// @returns The amount of processes that have been resolved by this object + size_t amountOfProcesses() const; +}; + +#endif // MUMBLE_PROCESS_RESOLVER_H_ |