diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-27 11:11:40 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-27 11:11:40 +0000 |
commit | 7731832751ab9f3c6ddeb66f186d3d7fa1934a6d (patch) | |
tree | e91015872543a59be2aad26c2fea02e41b57005d /contrib/ldapc++/src/LDAPAttrType.cpp | |
parent | Initial commit. (diff) | |
download | openldap-7731832751ab9f3c6ddeb66f186d3d7fa1934a6d.tar.xz openldap-7731832751ab9f3c6ddeb66f186d3d7fa1934a6d.zip |
Adding upstream version 2.4.57+dfsg.upstream/2.4.57+dfsgupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | contrib/ldapc++/src/LDAPAttrType.cpp | 148 |
1 files changed, 148 insertions, 0 deletions
diff --git a/contrib/ldapc++/src/LDAPAttrType.cpp b/contrib/ldapc++/src/LDAPAttrType.cpp new file mode 100644 index 0000000..da07299 --- /dev/null +++ b/contrib/ldapc++/src/LDAPAttrType.cpp @@ -0,0 +1,148 @@ +// $OpenLDAP$ +/* + * Copyright 2003-2021 The OpenLDAP Foundation, All Rights Reserved. + * COPYING RESTRICTIONS APPLY, see COPYRIGHT file + */ + +#include "debug.h" +#include "LDAPAttrType.h" + + +LDAPAttrType::LDAPAttrType(){ + DEBUG(LDAP_DEBUG_CONSTRUCT, + "LDAPAttrType::LDAPAttrType( )" << endl); + + oid = string (); + desc = string (); + names = StringList (); + single = false; + usage = 0; +} + +LDAPAttrType::LDAPAttrType (string at_item, int flags ) { + + DEBUG(LDAP_DEBUG_CONSTRUCT, + "LDAPAttrType::LDAPAttrType( )" << endl); + + LDAPAttributeType *a; + int ret; + const char *errp; + a = ldap_str2attributetype (at_item.c_str(), &ret, &errp, flags); + + if (a) { + this->setNames( a->at_names ); + this->setDesc( a->at_desc ); + this->setOid( a->at_oid ); + this->setSingle( a->at_single_value ); + this->setUsage( a->at_usage ); + this->setSuperiorOid( a->at_sup_oid ); + this->setEqualityOid( a->at_equality_oid ); + this->setOrderingOid( a->at_ordering_oid ); + this->setSubstringOid( a->at_substr_oid ); + this->setSyntaxOid( a->at_syntax_oid ); + } + // else? -> error +} + +LDAPAttrType::~LDAPAttrType() { + DEBUG(LDAP_DEBUG_DESTROY,"LDAPAttrType::~LDAPAttrType()" << endl); +} + +void LDAPAttrType::setSingle (int at_single) { + single = (at_single == 1); +} + +void LDAPAttrType::setNames ( char **at_names ) { + names = StringList(at_names); +} + +void LDAPAttrType::setDesc (const char *at_desc) { + desc = string (); + if (at_desc) + desc = at_desc; +} + +void LDAPAttrType::setOid (const char *at_oid) { + oid = string (); + if (at_oid) + oid = at_oid; +} + +void LDAPAttrType::setUsage (int at_usage) { + usage = at_usage; +} + +void LDAPAttrType::setSuperiorOid( const char *oid ){ + if ( oid ) + superiorOid = oid; +} + +void LDAPAttrType::setEqualityOid( const char *oid ){ + if ( oid ) + equalityOid = oid; +} + +void LDAPAttrType::setOrderingOid( const char *oid ){ + if ( oid ) + orderingOid = oid; +} + +void LDAPAttrType::setSubstringOid( const char *oid ){ + if ( oid ) + substringOid = oid; +} + +void LDAPAttrType::setSyntaxOid( const char *oid ){ + if ( oid ) + syntaxOid = oid; +} + +bool LDAPAttrType::isSingle() const { + return single; +} + +string LDAPAttrType::getOid() const { + return oid; +} + +string LDAPAttrType::getDesc() const { + return desc; +} + +StringList LDAPAttrType::getNames() const { + return names; +} + +string LDAPAttrType::getName() const { + + if (names.empty()) + return ""; + else + return *(names.begin()); +} + +int LDAPAttrType::getUsage() const { + return usage; +} + +std::string LDAPAttrType::getSuperiorOid() const { + return superiorOid; +} + +std::string LDAPAttrType::getEqualityOid() const { + return equalityOid; +} + +std::string LDAPAttrType::getOrderingOid() const { + return orderingOid; +} + +std::string LDAPAttrType::getSubstringOid() const { + return substringOid; +} + +std::string LDAPAttrType::getSyntaxOid() const { + return syntaxOid; +} + + |