• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • tdeio/kssl
 

tdeio/kssl

  • tdeio
  • kssl
ksslx509map.cpp
1/* This file is part of the KDE project
2 *
3 * Copyright (C) 2000 George Staikos <staikos@kde.org>
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Library General Public License for more details.
14 *
15 * You should have received a copy of the GNU Library General Public License
16 * along with this library; see the file COPYING.LIB. If not, write to
17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 * Boston, MA 02110-1301, USA.
19 */
20
21#include "ksslx509map.h"
22#include <tqstringlist.h>
23#include <tqregexp.h>
24
25KSSLX509Map::KSSLX509Map(const TQString& name) {
26 parse(name);
27}
28
29
30KSSLX509Map::~KSSLX509Map() {
31
32}
33
34
35void KSSLX509Map::setValue(const TQString& key, const TQString& value) {
36 m_pairs.replace(key, value);
37}
38
39
40TQString KSSLX509Map::getValue(const TQString& key) const {
41 if (!m_pairs.contains(key)) {
42 return TQString::null;
43 }
44
45 return m_pairs[key];
46}
47
48static TQStringList tokenizeBy(const TQString& str, const TQRegExp& tok, bool keepEmpties = false) {
49TQStringList tokens;
50unsigned int head, tail;
51const char *chstr = str.ascii();
52unsigned int length = str.length();
53
54 if (length < 1) {
55 return tokens;
56 }
57
58 if (length == 1) {
59 tokens.append(str);
60 return tokens;
61 }
62
63 for(head = 0, tail = 0; tail < length-1; head = tail+1) {
64 TQString thisline;
65
66 tail = str.find(tok, head);
67
68 if (tail > length) // last token - none at end
69 tail = length;
70
71 if (tail-head > 0 || keepEmpties) { // it has to be at least 1 long!
72 thisline = &(chstr[head]);
73 thisline.truncate(tail-head);
74 tokens.append(thisline);
75 }
76 }
77 return tokens;
78}
79
80
81void KSSLX509Map::parse(const TQString& name) {
82TQStringList vl = tokenizeBy(name, TQRegExp("/[A-Za-z]+="), false);
83
84 m_pairs.clear();
85
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]];
90 oldValue += "\n";
91 oldValue += apair[1];
92 m_pairs.replace(apair[0], oldValue);
93 } else {
94 m_pairs.insert(apair[0], apair[1]);
95 }
96 }
97}
98
99
100void KSSLX509Map::reset(const TQString& name) {
101 parse(name);
102}
103
KSSLX509Map::KSSLX509Map
KSSLX509Map(const TQString &name)
Construct an X.509 Map.
Definition: ksslx509map.cpp:25
KSSLX509Map::reset
void reset(const TQString &name="")
Reset (clear) the internal storage.
Definition: ksslx509map.cpp:100
KSSLX509Map::~KSSLX509Map
~KSSLX509Map()
Destroy this map.
Definition: ksslx509map.cpp:30
KSSLX509Map::getValue
TQString getValue(const TQString &key) const
Get the value of an entry in the map.
Definition: ksslx509map.cpp:40
KSSLX509Map::setValue
void setValue(const TQString &key, const TQString &value)
Set a value in the map.
Definition: ksslx509map.cpp:35

tdeio/kssl

Skip menu "tdeio/kssl"
  • Main Page
  • Alphabetical List
  • Class List
  • File List
  • Class Members
  • Related Pages

tdeio/kssl

Skip menu "tdeio/kssl"
  • arts
  • dcop
  • dnssd
  • interfaces
  •   kspeech
  •     interface
  •     library
  •   tdetexteditor
  • kate
  • kded
  • kdoctools
  • kimgio
  • kjs
  • libtdemid
  • libtdescreensaver
  • tdeabc
  • tdecmshell
  • tdecore
  • tdefx
  • tdehtml
  • tdeinit
  • tdeio
  •   bookmarks
  •   httpfilter
  •   kpasswdserver
  •   kssl
  •   tdefile
  •   tdeio
  •   tdeioexec
  • tdeioslave
  •   http
  • tdemdi
  •   tdemdi
  • tdenewstuff
  • tdeparts
  • tdeprint
  • tderandr
  • tderesources
  • tdespell2
  • tdesu
  • tdeui
  • tdeunittest
  • tdeutils
  • tdewallet
Generated for tdeio/kssl by doxygen 1.9.4
This website is maintained by Timothy Pearson.