Line data Source code
1 : /*
2 : defaultassuantransaction.cpp - default Assuan Transaction that just stores data and status lines
3 : Copyright (C) 2009 Klarälvdalens Datakonsult AB
4 : 2016 Bundesamt für Sicherheit in der Informationstechnik
5 : Software engineering by Intevation GmbH
6 :
7 : This file is part of GPGME++.
8 :
9 : GPGME++ is free software; you can redistribute it and/or
10 : modify it under the terms of the GNU Library General Public
11 : License as published by the Free Software Foundation; either
12 : version 2 of the License, or (at your option) any later version.
13 :
14 : GPGME++ is distributed in the hope that it will be useful,
15 : but WITHOUT ANY WARRANTY; without even the implied warranty of
16 : MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 : GNU Library General Public License for more details.
18 :
19 : You should have received a copy of the GNU Library General Public License
20 : along with GPGME++; see the file COPYING.LIB. If not, write to the
21 : Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
22 : Boston, MA 02110-1301, USA.
23 : */
24 :
25 : #ifdef HAVE_CONFIG_H
26 : #include "config.h"
27 : #endif
28 :
29 : #include "defaultassuantransaction.h"
30 : #include "error.h"
31 : #include "data.h"
32 :
33 : #include <sstream>
34 :
35 : using namespace GpgME;
36 :
37 0 : DefaultAssuanTransaction::DefaultAssuanTransaction()
38 : : AssuanTransaction(),
39 : m_status(),
40 0 : m_data()
41 : {
42 :
43 0 : }
44 :
45 0 : DefaultAssuanTransaction::~DefaultAssuanTransaction() {}
46 :
47 0 : Error DefaultAssuanTransaction::data(const char *data, size_t len)
48 : {
49 0 : m_data.append(data, len);
50 0 : return Error();
51 : }
52 :
53 0 : Data DefaultAssuanTransaction::inquire(const char *name, const char *args, Error &err)
54 : {
55 : (void)name; (void)args; (void)err;
56 0 : return Data::null;
57 : }
58 :
59 0 : Error DefaultAssuanTransaction::status(const char *status, const char *args)
60 : {
61 0 : m_status.push_back(std::pair<std::string, std::string>(status, args));
62 0 : return Error();
63 : }
64 :
65 0 : std::vector<std::string> DefaultAssuanTransaction::statusLine(const char *tag) const
66 : {
67 0 : std::vector<std::string> result;
68 0 : for (std::vector< std::pair<std::string, std::string> >::const_iterator it = m_status.begin(), end = m_status.end() ; it != end ; ++it) {
69 0 : if (it->first == tag) {
70 0 : result.push_back(it->second);
71 : }
72 : }
73 0 : return result;
74 : }
75 :
76 0 : std::string DefaultAssuanTransaction::firstStatusLine(const char *tag) const
77 : {
78 0 : for (std::vector< std::pair<std::string, std::string> >::const_iterator it = m_status.begin(), end = m_status.end() ; it != end ; ++it) {
79 0 : if (it->first == tag) {
80 0 : return it->second;
81 : }
82 : }
83 0 : return std::string();
84 : }
|