Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
folium-app
GitHub Repository: folium-app/Folium
Path: blob/a-new-beginning/SharedDependencies/Sources/cryptopp/algparam.cpp
2 views
1
// algparam.cpp - originally written and placed in the public domain by Wei Dai
2
3
#include "pch.h"
4
5
#ifndef CRYPTOPP_IMPORTS
6
7
#include "algparam.h"
8
#include "integer.h"
9
10
NAMESPACE_BEGIN(CryptoPP)
11
12
bool CombinedNameValuePairs::GetVoidValue(const char *name, const std::type_info &valueType, void *pValue) const
13
{
14
if (strcmp(name, "ValueNames") == 0)
15
return m_pairs1.GetVoidValue(name, valueType, pValue) && m_pairs2.GetVoidValue(name, valueType, pValue);
16
else
17
return m_pairs1.GetVoidValue(name, valueType, pValue) || m_pairs2.GetVoidValue(name, valueType, pValue);
18
}
19
20
void AlgorithmParametersBase::operator=(const AlgorithmParametersBase &rhs)
21
{
22
CRYPTOPP_UNUSED(rhs);
23
CRYPTOPP_ASSERT(false);
24
}
25
26
bool AlgorithmParametersBase::GetVoidValue(const char *name, const std::type_info &valueType, void *pValue) const
27
{
28
if (strcmp(name, "ValueNames") == 0)
29
{
30
NameValuePairs::ThrowIfTypeMismatch(name, typeid(std::string), valueType);
31
if (m_next.get())
32
m_next->GetVoidValue(name, valueType, pValue);
33
(*reinterpret_cast<std::string *>(pValue) += m_name) += ";";
34
return true;
35
}
36
else if (strcmp(name, m_name) == 0)
37
{
38
AssignValue(name, valueType, pValue);
39
m_used = true;
40
return true;
41
}
42
else if (m_next.get())
43
return m_next->GetVoidValue(name, valueType, pValue);
44
else
45
return false;
46
}
47
48
AlgorithmParameters::AlgorithmParameters()
49
: m_defaultThrowIfNotUsed(true)
50
{
51
}
52
53
AlgorithmParameters::AlgorithmParameters(const AlgorithmParameters &x)
54
: m_defaultThrowIfNotUsed(x.m_defaultThrowIfNotUsed)
55
{
56
m_next.reset(const_cast<AlgorithmParameters &>(x).m_next.release());
57
}
58
59
AlgorithmParameters & AlgorithmParameters::operator=(const AlgorithmParameters &x)
60
{
61
m_next.reset(const_cast<AlgorithmParameters &>(x).m_next.release());
62
return *this;
63
}
64
65
bool AlgorithmParameters::GetVoidValue(const char *name, const std::type_info &valueType, void *pValue) const
66
{
67
if (m_next.get())
68
return m_next->GetVoidValue(name, valueType, pValue);
69
else
70
return false;
71
}
72
73
NAMESPACE_END
74
75
#endif
76
77