21 #include "ksslx509map.h"
22 #include <tqstringlist.h>
36 m_pairs.replace(key, value);
41 if (!m_pairs.contains(key)) {
42 return TQString::null;
48 static TQStringList tokenizeBy(
const TQString& str,
const TQRegExp& tok,
bool keepEmpties =
false) {
50 unsigned int head, tail;
51 const char *chstr = str.ascii();
52 unsigned int length = str.length();
63 for(head = 0, tail = 0; tail < length-1; head = tail+1) {
66 tail = str.find(tok, head);
71 if (tail-head > 0 || keepEmpties) {
72 thisline = &(chstr[head]);
73 thisline.truncate(tail-head);
74 tokens.append(thisline);
81 void KSSLX509Map::parse(
const TQString& name) {
82 TQStringList vl = tokenizeBy(name, TQRegExp(
"/[A-Za-z]+="),
false);
86 for (TQStringList::Iterator j = vl.begin(); j != vl.end(); ++j) {
87 TQStringList apair = tokenizeBy(*j, TQRegExp(
"="),
false);
88 if (m_pairs.contains(apair[0])) {
89 TQString oldValue = m_pairs[apair[0]];
92 m_pairs.replace(apair[0], oldValue);
94 m_pairs.insert(apair[0], apair[1]);
KSSLX509Map(const TQString &name)
Construct an X.509 Map.
void reset(const TQString &name="")
Reset (clear) the internal storage.
~KSSLX509Map()
Destroy this map.
TQString getValue(const TQString &key) const
Get the value of an entry in the map.
void setValue(const TQString &key, const TQString &value)
Set a value in the map.