Counter Strike : Global Offensive Source Code
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

75 lines
1.9 KiB

  1. // algparam.cpp - written and placed in the public domain by Wei Dai
  2. #include "pch.h"
  3. #ifndef CRYPTOPP_IMPORTS
  4. #include "algparam.h"
  5. NAMESPACE_BEGIN(CryptoPP)
  6. PAssignIntToInteger g_pAssignIntToInteger = NULL;
  7. bool CombinedNameValuePairs::GetVoidValue(const char *name, const std::type_info &valueType, void *pValue) const
  8. {
  9. if (strcmp(name, "ValueNames") == 0)
  10. return m_pairs1.GetVoidValue(name, valueType, pValue) && m_pairs2.GetVoidValue(name, valueType, pValue);
  11. else
  12. return m_pairs1.GetVoidValue(name, valueType, pValue) || m_pairs2.GetVoidValue(name, valueType, pValue);
  13. }
  14. void AlgorithmParametersBase::operator=(const AlgorithmParametersBase& rhs)
  15. {
  16. assert(false);
  17. }
  18. bool AlgorithmParametersBase::GetVoidValue(const char *name, const std::type_info &valueType, void *pValue) const
  19. {
  20. if (strcmp(name, "ValueNames") == 0)
  21. {
  22. NameValuePairs::ThrowIfTypeMismatch(name, typeid(std::string), valueType);
  23. if (m_next.get())
  24. m_next->GetVoidValue(name, valueType, pValue);
  25. (*reinterpret_cast<std::string *>(pValue) += m_name) += ";";
  26. return true;
  27. }
  28. else if (strcmp(name, m_name) == 0)
  29. {
  30. AssignValue(name, valueType, pValue);
  31. m_used = true;
  32. return true;
  33. }
  34. else if (m_next.get())
  35. return m_next->GetVoidValue(name, valueType, pValue);
  36. else
  37. return false;
  38. }
  39. AlgorithmParameters::AlgorithmParameters()
  40. : m_defaultThrowIfNotUsed(true)
  41. {
  42. }
  43. AlgorithmParameters::AlgorithmParameters(const AlgorithmParameters &x)
  44. : m_defaultThrowIfNotUsed(x.m_defaultThrowIfNotUsed)
  45. {
  46. m_next.reset(const_cast<AlgorithmParameters &>(x).m_next.release());
  47. }
  48. AlgorithmParameters & AlgorithmParameters::operator=(const AlgorithmParameters &x)
  49. {
  50. m_next.reset(const_cast<AlgorithmParameters &>(x).m_next.release());
  51. return *this;
  52. }
  53. bool AlgorithmParameters::GetVoidValue(const char *name, const std::type_info &valueType, void *pValue) const
  54. {
  55. if (m_next.get())
  56. return m_next->GetVoidValue(name, valueType, pValue);
  57. else
  58. return false;
  59. }
  60. NAMESPACE_END
  61. #endif