Gray C++ Libraries  0.0.2
A set of C++ libraries for MSVC, GNU on Windows, WinCE, Linux
cKeyTypeDef.h
Go to the documentation of this file.
1 //
4 //
5 
6 #ifndef _INC_cKeyTypeDef_H
7 #define _INC_cKeyTypeDef_H
8 #ifndef NO_PRAGMA_ONCE
9 #pragma once
10 #endif
11 
12 #include "cKeyBase.h"
16 
17 namespace GrayLib
18 {
20 
21  class GRAYLIB_LINK cKeyTypeDef // : public cObjectFactory
22  {
25 
26  public:
28  const char* const m_pszName;
29 
30  public:
31  cKeyTypeDef(SSL_Key_TYPE eKeyType, const char* pszName) noexcept
32  : m_eKeyType(eKeyType)
33  , m_pszName(pszName)
34  {
35  }
36  virtual ~cKeyTypeDef()
37  {
38  }
39 
40  SSL_Key_TYPE get_HashCode() const noexcept
41  {
43  return this->m_eKeyType;
44  }
45 
47  virtual bool HasKeyType(SSL_Key_TYPE eKeyType) const noexcept = 0;
48 
50  virtual cKeyBase* AllocKey(void) const = 0;
51 
53  };
54 
55  class GRAYLIB_LINK cKeyTypeMgr : public cSingleton<cKeyTypeMgr>
56  {
59  private:
61  public:
62  cKeyTypeMgr();
63 
64  void LoadAllKeyTypes();
65 
66  void AddKeyType(const cKeyTypeDef* pDef)
67  {
68  m_a.Add(pDef);
69  }
71  {
72  return m_a.FindArgForKey(e);
73  }
74  };
75 }
76 
77 #endif
#define GRAYLIB_LINK
Definition: GrayLibBase.h:35
Definition: cKeyBase.h:56
Definition: cKeyTypeDef.h:22
SSL_Key_TYPE const m_eKeyType
Public key type.
Definition: cKeyTypeDef.h:27
virtual cKeyBase * AllocKey(void) const =0
Allocate a new context.
virtual ~cKeyTypeDef()
Definition: cKeyTypeDef.h:36
const char *const m_pszName
Type name.
Definition: cKeyTypeDef.h:28
UNITTEST_FRIEND(cKeyTypeDef)
virtual bool HasKeyType(SSL_Key_TYPE eKeyType) const noexcept=0
Tell if the context implements this type (e.g. ECKEY can do ECDSA)
SSL_Key_TYPE get_HashCode() const noexcept
Definition: cKeyTypeDef.h:40
cKeyTypeDef(SSL_Key_TYPE eKeyType, const char *pszName) noexcept
Definition: cKeyTypeDef.h:31
Definition: cKeyTypeDef.h:56
void AddKeyType(const cKeyTypeDef *pDef)
Definition: cKeyTypeDef.h:66
const cKeyTypeDef * GetKeyType(SSL_Key_TYPE e) const
Definition: cKeyTypeDef.h:70
TYPE_PTR FindArgForKey(TYPE_KEY key1) const noexcept
Definition: cArraySort.h:455
Definition: cArraySort.h:613
ITERATE_t Add(TYPE_ARG pNew)
Definition: cArraySort.h:186
Definition: cSingleton.h:127
Definition: cMesh.h:22
UNITTEST2_PREDEF(cQuadtree)
SSL_Key_TYPE
Definition: cKeyBase.h:24