Botan 3.7.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 {
23
24 auto o2s = m_oid2str.find(oid);
25
26 if(o2s == m_oid2str.end()) {
27 m_oid2str.insert(std::make_pair(oid, str));
28 } else if(o2s->second != str) {
29 throw Invalid_State("Cannot register two different names to a single OID");
30 }
31
32 auto s2o = m_str2oid.find(std::string(str));
33
34 if(s2o == m_str2oid.end()) {
35 m_str2oid.insert(std::make_pair(str, oid));
36 }
37}
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().

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

◆ add_oid2str()

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

Definition at line 46 of file oid_map.cpp.

46 {
48 if(!m_oid2str.contains(oid)) {
49 m_oid2str.insert(std::make_pair(oid, str));
50 }
51}

References Botan::lock().

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

◆ add_str2oid()

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

Definition at line 39 of file oid_map.cpp.

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

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 53 of file oid_map.cpp.

53 {
55
56 auto i = m_oid2str.find(oid);
57 if(i != m_oid2str.end()) {
58 return i->second;
59 }
60
61 return "";
62}

References Botan::lock().

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

◆ str2oid()

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

Definition at line 64 of file oid_map.cpp.

64 {
66 auto i = m_str2oid.find(std::string(str));
67 if(i != m_str2oid.end()) {
68 return i->second;
69 }
70
71 return OID();
72}

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: