Botan 3.6.1
Crypto and TLS for C&
Botan::OID_Map Class Referencefinal

#include <oid_map.h>

Public Member Functions

void add_oid (const OID &oid, std::string_view str)
 
void add_oid2str (const OID &oid, std::string_view str)
 
void add_str2oid (const OID &oid, std::string_view str)
 
std::string oid2str (const OID &oid)
 
OID str2oid (std::string_view str)
 

Static Public Member Functions

static OID_Mapglobal_registry ()
 

Detailed Description

Definition at line 18 of file oid_map.h.

Member Function Documentation

◆ add_oid()

void Botan::OID_Map::add_oid ( const OID & oid,
std::string_view str )

Definition at line 21 of file oid_map.cpp.

21 {
22 const std::string oid_str = oid.to_string();
23
25
26 auto o2s = m_oid2str.find(oid_str);
27
28 if(o2s == m_oid2str.end()) {
29 m_oid2str.insert(std::make_pair(oid_str, str));
30 } else if(o2s->second != str) {
31 throw Invalid_State("Cannot register two different names to a single OID");
32 }
33
34 auto s2o = m_str2oid.find(std::string(str));
35
36 if(s2o == m_str2oid.end()) {
37 m_str2oid.insert(std::make_pair(str, oid));
38 }
39}
secure_vector< T > lock(const std::vector< T > &in)
Definition secmem.h:70
lock_guard< T > lock_guard_type
Definition mutex.h:55

References Botan::lock(), and Botan::OID::to_string().

Referenced by Botan::OID::register_oid().

◆ add_oid2str()

void Botan::OID_Map::add_oid2str ( const OID & oid,
std::string_view str )

Definition at line 48 of file oid_map.cpp.

48 {
49 const std::string oid_str = oid.to_string();
51 if(!m_oid2str.contains(oid_str)) {
52 m_oid2str.insert(std::make_pair(oid_str, str));
53 }
54}

References Botan::lock(), and Botan::OID::to_string().

Referenced by Botan::OIDS::add_oid2str().

◆ add_str2oid()

void Botan::OID_Map::add_str2oid ( const OID & oid,
std::string_view str )

Definition at line 41 of file oid_map.cpp.

41 {
43 if(!m_str2oid.contains(std::string(str))) {
44 m_str2oid.insert(std::make_pair(str, oid));
45 }
46}

References Botan::lock().

Referenced by Botan::OIDS::add_str2oid().

◆ global_registry()

OID_Map & Botan::OID_Map::global_registry ( )
static

◆ oid2str()

std::string Botan::OID_Map::oid2str ( const OID & oid)

Definition at line 56 of file oid_map.cpp.

56 {
57 const std::string oid_str = oid.to_string();
58
60
61 auto i = m_oid2str.find(oid_str);
62 if(i != m_oid2str.end()) {
63 return i->second;
64 }
65
66 return "";
67}

References Botan::lock(), and Botan::OID::to_string().

Referenced by Botan::OID::human_name_or_empty().

◆ str2oid()

OID Botan::OID_Map::str2oid ( std::string_view str)

Definition at line 69 of file oid_map.cpp.

69 {
71 auto i = m_str2oid.find(std::string(str));
72 if(i != m_str2oid.end()) {
73 return i->second;
74 }
75
76 return OID();
77}

References Botan::lock().

Referenced by Botan::OID::from_name(), and Botan::OID::from_string().


The documentation for this class was generated from the following files: