Gray C++ Libraries  0.0.2
A set of C++ libraries for MSVC, GNU on Windows, WinCE, Linux
cASNSets.h
Go to the documentation of this file.
1 //
5 
6 #ifndef _INC_cASNSets_H
7 #define _INC_cASNSets_H
8 #ifndef NO_PRAGMA_ONCE
9 #pragma once
10 #endif
11 
12 #include "cASNReader.h"
14 
15 namespace GrayLib
16 {
17  class cASNWriterRev;
18 
20  {
23 
24  public:
27 
28  public:
29  bool isEmptySet() const
30  {
31  return m_oid.isEmptyBuf();
32  }
33 
34  void SetEmptySet()
35  {
36  m_oid.SetEmptyBuf();
37  m_val.SetEmptyBuf();
38  }
39 
40  bool IsEqualSet(const cASNSet1* b) const
41  {
42  if (b == nullptr)
43  return false;
44  if (!this->m_oid.IsEqualBuf(b->m_oid)) // type
45  return false;
46  if (!this->m_val.IsEqualStr(b->m_val)) // value
47  return false;
48  return true;
49  }
50 
51  HRESULT ReadSet2(cASNReader& r);
52  HRESULT ReadSet1(cASNReader& r);
53 
54  HRESULT GetDescriptionSet(StrBuilder& s) const;
55  };
56 
58  {
63 
64  public:
67 
68  private:
69  static void GRAYCALL FreeASNSets(cASNSets* pCur)
70  {
72  while (pCur != nullptr)
73  {
74  cASNSets* pNext = pCur->m_pNextSet;
75  pCur->m_pNextSet = nullptr;
76  delete pCur;
77  pCur = pNext;
78  }
79  }
80 
81  public:
83  : m_bNextMerged(false)
84  , m_pNextSet(nullptr)
85  {
86  }
88  {
89  SetEmptySets();
90  m_bNextMerged = false;
91  }
92 
93  void SetEmptySets()
94  {
95  // free chain but leave the current.
96  SetEmptySet();
97  cASNSets* pNext = m_pNextSet;
98  m_pNextSet = nullptr;
99  FreeASNSets(pNext);
100  }
101 
102  bool IsEqualSets(const cASNSets& rb) const;
103 
104  HRESULT GetDescriptionSets(StrBuilder& s) const;
105 
106  cASNSets* FindOIDInSets(const char* oid, size_t len) const;
107 
108  cASNSets* AddOIDToSets(const char* oid, size_t oid_len, const BYTE* val, size_t val_len);
109 
110  HRESULT AddOIDToExtensionList(const char* oid, size_t oid_len, const BYTE* val, size_t val_len, bool bCritical=false);
111 
112  HRESULT SetSetsFromStr(const char* name);
113 
115  };
116 }
117 
118 #endif
119 
#define GRAYCALL
declare calling convention for static functions so everyone knows the arg passing scheme....
Definition: GrayCore.h:36
#define GRAYLIB_LINK
Definition: GrayLibBase.h:35
INT32 HRESULT
_WIN32 style error codes. INT32
Definition: SysTypes.h:465
Definition: cASN.h:184
void SetEmptyBuf()
Definition: cASN.h:208
bool isEmptyBuf() const
Definition: cASN.h:106
bool IsEqualStr(const void *pStr, size_t nSize) const
Definition: cASN.h:136
bool IsEqualBuf(const cASNBuf &b) const
Definition: cASN.h:130
Definition: cASNReader.h:22
Definition: cASNSets.h:20
void SetEmptySet()
Definition: cASNSets.h:34
bool IsEqualSet(const cASNSet1 *b) const
Definition: cASNSets.h:40
cASNBufAlloc m_val
The value.
Definition: cASNSets.h:26
cASNBufAlloc m_oid
The object identifier. name.
Definition: cASNSets.h:25
bool isEmptySet() const
Definition: cASNSets.h:29
Definition: cASNSets.h:58
~cASNSets()
Definition: cASNSets.h:87
UNITTEST_FRIEND(cASNSets)
cASNSets()
Definition: cASNSets.h:82
bool m_bNextMerged
Merge next item into the current one?
Definition: cASNSets.h:65
cASNSets * m_pNextSet
The next entry in the sequence.
Definition: cASNSets.h:66
void SetEmptySets()
Definition: cASNSets.h:93
Definition: StrBuilder.h:18
Definition: cMesh.h:22