Keyple Card Calypso C++ Library - 3.2.2
Component of the Keyple C++ middleware
CalypsoCardClass.cpp
Go to the documentation of this file.
1/******************************************************************************
2 * Copyright (c) 2025 Calypso Networks Association https://calypsonet.org/ *
3 * *
4 * See the NOTICE file(s) distributed with this work for additional *
5 * information regarding copyright ownership. *
6 * *
7 * This program and the accompanying materials are made available under the *
8 * terms of the Eclipse Public License 2.0 which is available at *
9 * http://www.eclipse.org/legal/epl-2.0 *
10 * *
11 * SPDX-License-Identifier: EPL-2.0 *
12 ******************************************************************************/
13
14#include "keyple/card/calypso/CalypsoCardClass.hpp"
15
16namespace keyple {
17namespace card {
18namespace calypso {
19
20const CalypsoCardClass CalypsoCardClass::LEGACY(0x94);
21const CalypsoCardClass CalypsoCardClass::LEGACY_STORED_VALUE(0xFA);
22const CalypsoCardClass CalypsoCardClass::ISO(0x00);
23const CalypsoCardClass CalypsoCardClass::UNKNOWN(0xff);
24
25CalypsoCardClass::CalypsoCardClass(std::uint8_t cla)
26: mCla(cla)
27{
28
29}
30
31CalypsoCardClass::CalypsoCardClass(const CalypsoCardClass& o)
32: CalypsoCardClass(o.mCla) {}
33
34uint8_t CalypsoCardClass::getValue() const
35{
36 return mCla;
37}
38
39CalypsoCardClass&
40CalypsoCardClass::operator=(const CalypsoCardClass& o)
41{
42 mCla = o.mCla;
43
44 return *this;
45}
46
47bool
48CalypsoCardClass::operator==(const CalypsoCardClass& o) const
49{
50 return mCla == o.mCla;
51}
52
53std::ostream&
54operator<<(std::ostream& os, const CalypsoCardClass& ccc)
55{
56 os << "CALYPSO_CARD_CLASS: ";
57
58 if (ccc.getValue() == CalypsoCardClass::ISO.getValue()) {
59 os << "ISO";
60 } else if (ccc.getValue() == CalypsoCardClass::LEGACY.getValue()) {
61 os << "LEGACY";
62 } else if (ccc.getValue() == CalypsoCardClass::LEGACY_STORED_VALUE.getValue()) {
63 os << "LEGACY_STORED_VALUE";
64 } else {
65 os << "UNKNOWN";
66 }
67
68 return os;
69}
70
71} /* namespace calypso */
72} /* namespace card */
73} /* namespace keyple */
std::ostream & operator<<(std::ostream &os, const CalypsoCardClass &ccc)