add support for usage flag

This commit is contained in:
Ralf Haferkamp 2007-01-09 12:24:04 +00:00
parent 69e3a58b2b
commit 7741e1eeff
2 changed files with 25 additions and 6 deletions

View File

@ -15,6 +15,7 @@ LDAPAttrType::LDAPAttrType(){
desc = string ();
names = StringList ();
single = false;
usage = 0;
}
LDAPAttrType::LDAPAttrType (const LDAPAttrType &at){
@ -25,6 +26,7 @@ LDAPAttrType::LDAPAttrType (const LDAPAttrType &at){
desc = at.desc;
names = at.names;
single = at.single;
usage = at.usage;
}
LDAPAttrType::LDAPAttrType (string at_item) {
@ -38,10 +40,11 @@ LDAPAttrType::LDAPAttrType (string at_item) {
a = ldap_str2attributetype (at_item.c_str(), &ret, &errp,SCHEMA_PARSE_FLAG);
if (a) {
this->setNames (a->at_names);
this->setDesc (a->at_desc);
this->setOid (a->at_oid);
this->setSingle (a->at_single_value);
this->setNames( a->at_names );
this->setDesc( a->at_desc );
this->setOid( a->at_oid );
this->setSingle( a->at_single_value );
this->setSingle( a->at_usage );
}
// else? -> error
}
@ -70,6 +73,10 @@ void LDAPAttrType::setOid (char *at_oid) {
oid = at_oid;
}
void LDAPAttrType::setUsage (int at_usage) {
usage = at_usage;
}
bool LDAPAttrType::isSingle () {
return single;
}
@ -93,3 +100,7 @@ string LDAPAttrType::getName () {
else
return *(names.begin());
}
int LDAPAttrType::getUsage () {
return usage;
}

View File

@ -24,6 +24,7 @@ class LDAPAttrType{
StringList names;
string desc, oid;
bool single;
int usage;
public :
@ -74,15 +75,22 @@ class LDAPAttrType{
StringList getNames();
/**
* Returns true if attribute type hllows only single value
* Returns true if attribute type allows only single value
*/
bool isSingle();
/**
* Return the 'usage' value:
* (0=userApplications, 1=directoryOperation, 2=distributedOperation,
* 3=dSAOperation)
*/
int getUsage ();
void setNames (char **at_names);
void setDesc (char *at_desc);
void setOid (char *at_oid);
void setSingle (int at_single_value);
void setUsage (int at_usage );
};
#endif // LDAP_ATTRTYPE_H