00001
00002
00003 #include "pch.h"
00004
00005 #ifndef CRYPTOPP_IMPORTS
00006
00007 #include "algparam.h"
00008 #include "integer.h"
00009
00010 NAMESPACE_BEGIN(CryptoPP)
00011
00012 PAssignIntToInteger g_pAssignIntToInteger = NULL;
00013
00014 bool CombinedNameValuePairs::GetVoidValue(const char *name, const std::type_info &valueType, void *pValue) const
00015 {
00016 if (strcmp(name, "ValueNames") == 0)
00017 return m_pairs1.GetVoidValue(name, valueType, pValue) && m_pairs2.GetVoidValue(name, valueType, pValue);
00018 else
00019 return m_pairs1.GetVoidValue(name, valueType, pValue) || m_pairs2.GetVoidValue(name, valueType, pValue);
00020 }
00021
00022 void AlgorithmParametersBase::operator=(const AlgorithmParametersBase &rhs)
00023 {
00024 CRYPTOPP_UNUSED(rhs);
00025 assert(false);
00026 }
00027
00028 bool AlgorithmParametersBase::GetVoidValue(const char *name, const std::type_info &valueType, void *pValue) const
00029 {
00030 if (strcmp(name, "ValueNames") == 0)
00031 {
00032 NameValuePairs::ThrowIfTypeMismatch(name, typeid(std::string), valueType);
00033 if (m_next.get())
00034 m_next->GetVoidValue(name, valueType, pValue);
00035 (*reinterpret_cast<std::string *>(pValue) += m_name) += ";";
00036 return true;
00037 }
00038 else if (strcmp(name, m_name) == 0)
00039 {
00040 AssignValue(name, valueType, pValue);
00041 m_used = true;
00042 return true;
00043 }
00044 else if (m_next.get())
00045 return m_next->GetVoidValue(name, valueType, pValue);
00046 else
00047 return false;
00048 }
00049
00050 AlgorithmParameters::AlgorithmParameters()
00051 : m_defaultThrowIfNotUsed(true)
00052 {
00053 }
00054
00055 AlgorithmParameters::AlgorithmParameters(const AlgorithmParameters &x)
00056 : m_defaultThrowIfNotUsed(x.m_defaultThrowIfNotUsed)
00057 {
00058 m_next.reset(const_cast<AlgorithmParameters &>(x).m_next.release());
00059 }
00060
00061 AlgorithmParameters & AlgorithmParameters::operator=(const AlgorithmParameters &x)
00062 {
00063 m_next.reset(const_cast<AlgorithmParameters &>(x).m_next.release());
00064 return *this;
00065 }
00066
00067 bool AlgorithmParameters::GetVoidValue(const char *name, const std::type_info &valueType, void *pValue) const
00068 {
00069 if (m_next.get())
00070 return m_next->GetVoidValue(name, valueType, pValue);
00071 else
00072 return false;
00073 }
00074
00075 NAMESPACE_END
00076
00077 #endif