29 class LdapDN::LdapDNPrivate
32 LdapDNPrivate() : m_dn() {}
35 bool isValidRDNString(
const QString &rdn )
const;
41 bool LdapDN::LdapDNPrivate::isValidRDNString(
const QString &rdn )
const
43 kDebug() <<
"Testing rdn:" << rdn;
47 if ( rdnParts.
size() > 1 ) {
48 for (
int i = 0; i < rdnParts.
size(); i++ ) {
49 if ( !isValidRDNString( rdnParts.
at( i ) ) ) {
60 if ( components.
size() != 2 ) {
68 const QChar &ch )
const
73 int strPartStartIndex = 0;
74 while ( ( index = str.
indexOf( ch, searchFrom ) ) != -1 ) {
75 const QChar prev = str[std::max( 0, index - 1 )];
79 QString tmp = str.
mid( strPartStartIndex, index - strPartStartIndex );
82 strPartStartIndex = index + 1;
85 searchFrom = index + 1;
97 : d( new LdapDNPrivate )
102 LdapDN::LdapDN(
const QString &dn )
103 : d( new LdapDNPrivate )
108 LdapDN::LdapDN(
const LdapDN &that )
109 : d( new LdapDNPrivate )
114 LdapDN &LdapDN::operator=(
const LdapDN &that )
116 if (
this == &that ) {
134 bool LdapDN::isEmpty()
const
136 return d->m_dn.isEmpty();
139 QString LdapDN::toString()
const
144 QString LdapDN::toString(
int depth )
const
147 if ( depth >= rdns.
size() ) {
153 for (
int i = depth; i >= 0; i-- ) {
155 kDebug() <<
"dn =" << dn;
162 QString LdapDN::rdnString()
const
169 QString LdapDN::rdnString(
int depth )
const
172 if ( depth >= rdns.
size() ) {
175 return rdns.
at( rdns.
size() - 1 - depth );
178 bool LdapDN::isValid()
const
180 kDebug() <<
"Testing dn:" << d->m_dn;
186 for (
int i = 0; i < rdns.
size(); i++ ) {
187 if ( !d->isValidRDNString( rdns.
at( i ) ) ) {
195 int LdapDN::depth()
const
201 bool LdapDN::operator == (
const LdapDN &rhs )
const
203 return d->m_dn == rhs.d->m_dn;
206 bool LdapDN::operator != (
const LdapDN &rhs )
const
208 return d->m_dn != rhs.d->m_dn;
int indexOf(QChar ch, int from, Qt::CaseSensitivity cs) const
QStringList split(const QString &sep, SplitBehavior behavior, Qt::CaseSensitivity cs) const
const T & at(int i) const
void append(const T &value)
QString mid(int position, int n) const
QString left(int n) const