Keypop Card C++ API 2.0.0
Reference Card API for C++
CardSelectionResponseApi.hpp
Go to the documentation of this file.
1/******************************************************************************
2 * Copyright (c) 2025 Calypso Networks Association https://calypsonet.org/ *
3 * *
4 * This program and the accompanying materials are made available under the *
5 * terms of the MIT License which is available at *
6 * https://opensource.org/licenses/MIT. *
7 * *
8 * SPDX-License-Identifier: MIT *
9 ******************************************************************************/
10
11#pragma once
12
13#include <memory>
14#include <ostream>
15#include <string>
16#include <vector>
17
20
21namespace keypop {
22namespace card {
23
35public:
59 virtual const std::string& getPowerOnData() const = 0;
60
69 virtual const std::shared_ptr<ApduResponseApi>
71
78 virtual bool hasMatched() const = 0;
79
88 virtual const std::shared_ptr<CardResponseApi> getCardResponse() const = 0;
89
93 friend std::ostream&
94 operator<<(std::ostream& os, const CardSelectionResponseApi& csr) {
95 os << "CARD_SELECTION_RESPONSE_API: {"
96 << "HAS_MATCHED: " << csr.hasMatched() << ", "
97 << "POWER_ON_DATA: " << csr.getPowerOnData() << ", "
98 << "CARD_RESPONSE: " << csr.getCardResponse() << "}";
99
100 return os;
101 }
102
106 friend std::ostream&
108 std::ostream& os, const std::shared_ptr<CardSelectionResponseApi> csr) {
109 if (csr) {
110 os << *csr.get();
111 } else {
112 os << "CARD_SELECTION_RESPONSE_API: null";
113 }
114
115 return os;
116 }
117
121 friend std::ostream&
123 std::ostream& os,
124 const std::vector<std::shared_ptr<CardSelectionResponseApi>>& csrs) {
125 os << "CARD_SELECTION_RESPONSE_APIS: {";
126
127 for (auto it = std::begin(csrs); it != std::end(csrs); ++it) {
128 os << *it;
129 if (it != csrs.end() - 1) {
130 os << ", ";
131 }
132 }
133
134 os << "}";
135
136 return os;
137 }
138};
139
140} /* namespace card */
141} /* namespace keypop */
virtual const std::shared_ptr< CardResponseApi > getCardResponse() const =0
virtual const std::shared_ptr< ApduResponseApi > getSelectApplicationResponse() const =0
virtual bool hasMatched() const =0
virtual const std::string & getPowerOnData() const =0
friend std::ostream & operator<<(std::ostream &os, const CardSelectionResponseApi &csr)