diff options
| author | isanae <14251494+isanae@users.noreply.github.com> | 2019-09-19 11:14:14 -0400 |
|---|---|---|
| committer | isanae <14251494+isanae@users.noreply.github.com> | 2019-09-19 11:14:14 -0400 |
| commit | c1ab18b614aa6212f942d8d91afa0b191802f599 (patch) | |
| tree | d0bbc86372a1c06ee32ac04e18c871aeb87d071b /src/env.h | |
| parent | c50722100c485d2945082d573158a7083efe2f23 (diff) | |
moved the content of checkService() to env::getService(), refactored it
Diffstat (limited to 'src/env.h')
| -rw-r--r-- | src/env.h | 58 |
1 files changed, 58 insertions, 0 deletions
@@ -93,6 +93,24 @@ struct MallocFreer template <class T> using MallocPtr = std::unique_ptr<T, MallocFreer>; + +// used by LocalPtr, calls LocalFree() as the deleter +// +template <class T> +struct LocalFreer +{ + using pointer = T; + + void operator()(T p) + { + ::LocalFree(p); + } +}; + +template <class T> +using LocalPtr = std::unique_ptr<T, LocalFreer<T>>; + + // creates a console in the constructor and destroys it in the destructor, // also redirects standard streams // @@ -172,6 +190,46 @@ QString addPath(const QString& s); QString setPath(const QString& s); +class Service +{ +public: + enum class StartType + { + None = 0, + Disabled, + Enabled + }; + + enum class Status + { + None = 0, + Stopped, + Running + }; + + + explicit Service(QString name); + Service(QString name, StartType st, Status s); + + bool isValid() const; + + const QString& name() const; + StartType startType() const; + Status status() const; + + QString toString() const; + +private: + QString m_name; + StartType m_startType; + Status m_status; +}; + + +Service getService(const QString& name); +QString toString(Service::StartType st); +QString toString(Service::Status st); + enum class CoreDumpTypes { Mini = 1, |
