\hypertarget{GpgContext_8h_source}{}\doxysection{Gpg\+Context.\+h} \label{GpgContext_8h_source}\index{src/core/GpgContext.h@{src/core/GpgContext.h}} \begin{DoxyCode}{0} \DoxyCodeLine{1 } \DoxyCodeLine{29 \textcolor{preprocessor}{\#ifndef \_\_SGPGMEPP\_CONTEXT\_H\_\_}} \DoxyCodeLine{30 \textcolor{preprocessor}{\#define \_\_SGPGMEPP\_CONTEXT\_H\_\_}} \DoxyCodeLine{31 } \DoxyCodeLine{32 \textcolor{preprocessor}{\#include "{}GpgConstants.h"{}}} \DoxyCodeLine{33 \textcolor{preprocessor}{\#include "{}GpgFunctionObject.h"{}}} \DoxyCodeLine{34 \textcolor{preprocessor}{\#include "{}GpgInfo.h"{}}} \DoxyCodeLine{35 \textcolor{preprocessor}{\#include "{}GpgModel.h"{}}} \DoxyCodeLine{36 } \DoxyCodeLine{37 \textcolor{keyword}{namespace }\mbox{\hyperlink{namespaceGpgFrontend}{GpgFrontend}} \{} \DoxyCodeLine{38 } \DoxyCodeLine{43 \textcolor{keyword}{struct }\mbox{\hyperlink{structGpgFrontend_1_1GpgContextInitArgs}{GpgContextInitArgs}} \{} \DoxyCodeLine{44 \textcolor{comment}{// make no sense for gpg2}} \DoxyCodeLine{45 \textcolor{keywordtype}{bool} independent\_database = \textcolor{keyword}{false}; } \DoxyCodeLine{46 std::string db\_path = \{\};} \DoxyCodeLine{47 \textcolor{keywordtype}{bool} gpg\_alone = \textcolor{keyword}{false};} \DoxyCodeLine{48 std::string gpg\_path = \{\};} \DoxyCodeLine{49 \textcolor{keywordtype}{bool} test\_mode = \textcolor{keyword}{false};} \DoxyCodeLine{50 \textcolor{keywordtype}{bool} ascii = \textcolor{keyword}{true};} \DoxyCodeLine{51 } \DoxyCodeLine{52 \mbox{\hyperlink{structGpgFrontend_1_1GpgContextInitArgs}{GpgContextInitArgs}}() = \textcolor{keywordflow}{default};} \DoxyCodeLine{53 \};} \DoxyCodeLine{54 } \DoxyCodeLine{59 \textcolor{keyword}{class }GPGFRONTEND\_CORE\_EXPORT \mbox{\hyperlink{classGpgFrontend_1_1GpgContext}{GpgContext}}} \DoxyCodeLine{60 : \textcolor{keyword}{public} \mbox{\hyperlink{classGpgFrontend_1_1SingletonFunctionObject}{SingletonFunctionObject}} \{} \DoxyCodeLine{61 \textcolor{keyword}{public}:} \DoxyCodeLine{67 \textcolor{keyword}{explicit} \mbox{\hyperlink{classGpgFrontend_1_1GpgContext}{GpgContext}}(\textcolor{keyword}{const} \mbox{\hyperlink{structGpgFrontend_1_1GpgContextInitArgs}{GpgContextInitArgs}}\& args = \{\});} \DoxyCodeLine{68 } \DoxyCodeLine{74 \textcolor{keyword}{explicit} \mbox{\hyperlink{classGpgFrontend_1_1GpgContext}{GpgContext}}(\textcolor{keywordtype}{int} channel);} \DoxyCodeLine{75 } \DoxyCodeLine{80 \mbox{\hyperlink{classGpgFrontend_1_1GpgContext_ae89dee551354c1541337881898832725}{\string~GpgContext}}() \textcolor{keyword}{override} = \textcolor{keywordflow}{default};} \DoxyCodeLine{81 } \DoxyCodeLine{88 [[nodiscard]] \textcolor{keywordtype}{bool} good() \textcolor{keyword}{const};} \DoxyCodeLine{89 } \DoxyCodeLine{95 [[nodiscard]] \textcolor{keyword}{const} \mbox{\hyperlink{classGpgFrontend_1_1GpgInfo}{GpgInfo}}\& \mbox{\hyperlink{classGpgFrontend_1_1GpgContext_aca13ae9f849ca894cdd0da8572b5c9e3}{GetInfo}}()\textcolor{keyword}{ const }\{ \textcolor{keywordflow}{return} info\_; \}} \DoxyCodeLine{96 } \DoxyCodeLine{102 \textcolor{keyword}{operator} gpgme\_ctx\_t()\textcolor{keyword}{ const }\{ \textcolor{keywordflow}{return} \_ctx\_ref.get(); \}} \DoxyCodeLine{103 } \DoxyCodeLine{104 \textcolor{keyword}{private}:} \DoxyCodeLine{105 \mbox{\hyperlink{classGpgFrontend_1_1GpgInfo}{GpgInfo}} info\_; } \DoxyCodeLine{106 \mbox{\hyperlink{structGpgFrontend_1_1GpgContextInitArgs}{GpgContextInitArgs}} args\_; } \DoxyCodeLine{107 } \DoxyCodeLine{112 \textcolor{keywordtype}{void} init\_ctx();} \DoxyCodeLine{113 } \DoxyCodeLine{118 \textcolor{keyword}{struct }\mbox{\hyperlink{structGpgFrontend_1_1GpgContext_1_1__ctx__ref__deleter}{\_ctx\_ref\_deleter}} \{} \DoxyCodeLine{119 \textcolor{keywordtype}{void} operator()(gpgme\_ctx\_t \_ctx) \{} \DoxyCodeLine{120 \textcolor{keywordflow}{if} (\_ctx != \textcolor{keyword}{nullptr}) gpgme\_release(\_ctx);} \DoxyCodeLine{121 \}} \DoxyCodeLine{122 \};} \DoxyCodeLine{123 } \DoxyCodeLine{124 \textcolor{keyword}{using} CtxRefHandler =} \DoxyCodeLine{125 std::unique\_ptr; } \DoxyCodeLine{126 CtxRefHandler \_ctx\_ref = \textcolor{keyword}{nullptr}; } \DoxyCodeLine{127 \textcolor{keywordtype}{bool} good\_ = \textcolor{keyword}{true}; } \DoxyCodeLine{128 } \DoxyCodeLine{129 \textcolor{keyword}{public}:} \DoxyCodeLine{140 \textcolor{keyword}{static} gpgme\_error\_t test\_passphrase\_cb(\textcolor{keywordtype}{void}* opaque, \textcolor{keyword}{const} \textcolor{keywordtype}{char}* uid\_hint,} \DoxyCodeLine{141 \textcolor{keyword}{const} \textcolor{keywordtype}{char}* passphrase\_info,} \DoxyCodeLine{142 \textcolor{keywordtype}{int} last\_was\_bad, \textcolor{keywordtype}{int} fd);} \DoxyCodeLine{143 } \DoxyCodeLine{152 \textcolor{keyword}{static} gpgme\_error\_t test\_status\_cb(\textcolor{keywordtype}{void}* hook, \textcolor{keyword}{const} \textcolor{keywordtype}{char}* keyword,} \DoxyCodeLine{153 \textcolor{keyword}{const} \textcolor{keywordtype}{char}* args);} \DoxyCodeLine{154 } \DoxyCodeLine{160 \textcolor{keywordtype}{void} SetPassphraseCb(gpgme\_passphrase\_cb\_t func) \textcolor{keyword}{const};} \DoxyCodeLine{161 \};} \DoxyCodeLine{162 \} \textcolor{comment}{// namespace GpgFrontend}} \DoxyCodeLine{163 } \DoxyCodeLine{164 \textcolor{preprocessor}{\#endif }\textcolor{comment}{// \_\_SGPGMEPP\_CONTEXT\_H\_\_}} \end{DoxyCode}