]> git.sur5r.net Git - openldap/commitdiff
- Use "const" where appropriate
authorQuanah Gibson-Mount <quanah@openldap.org>
Thu, 1 May 2008 23:28:42 +0000 (23:28 +0000)
committerQuanah Gibson-Mount <quanah@openldap.org>
Thu, 1 May 2008 23:28:42 +0000 (23:28 +0000)
- removed unneeded copy constructor
- handle more AttributeType properties

contrib/ldapc++/src/LDAPAttrType.cpp
contrib/ldapc++/src/LDAPAttrType.h
contrib/ldapc++/src/LDAPObjClass.cpp
contrib/ldapc++/src/LDAPObjClass.h

index ccfa390298b8b75cb3bc51729b2c03addecd1a12..39898cd3e34747e54216cd06a0549e2747cc8aad 100644 (file)
@@ -19,17 +19,6 @@ LDAPAttrType::LDAPAttrType(){
     usage = 0;
 }
 
-LDAPAttrType::LDAPAttrType (const LDAPAttrType &at){
-    DEBUG(LDAP_DEBUG_CONSTRUCT,
-            "LDAPAttrType::LDAPAttrType( )" << endl);
-
-    oid = at.oid;
-    desc = at.desc;
-    names = at.names;
-    single = at.single;
-    usage = at.usage;
-}
-
 LDAPAttrType::LDAPAttrType (string at_item) { 
 
     DEBUG(LDAP_DEBUG_CONSTRUCT,
@@ -46,6 +35,11 @@ LDAPAttrType::LDAPAttrType (string at_item) {
        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
 }
@@ -58,17 +52,17 @@ void LDAPAttrType::setSingle (int at_single) {
     single = (at_single == 1);
 }
     
-void LDAPAttrType::setNames (char **at_names) {
-    names = StringList (at_names);
+void LDAPAttrType::setNames ( char **at_names ) {
+    names = StringList(at_names);
 }
 
-void LDAPAttrType::setDesc (char *at_desc) {
+void LDAPAttrType::setDesc (const char *at_desc) {
     desc = string ();
     if (at_desc)
        desc = at_desc;
 }
 
-void LDAPAttrType::setOid (char *at_oid) {
+void LDAPAttrType::setOid (const char *at_oid) {
     oid = string ();
     if (at_oid)
        oid = at_oid;
@@ -78,23 +72,48 @@ void LDAPAttrType::setUsage (int at_usage) {
     usage = at_usage;
 }
 
-bool LDAPAttrType::isSingle () {
-    return single;
+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;
 }
 
-string LDAPAttrType::getOid () {
+bool LDAPAttrType::isSingle() const {
+    return single;
+} 
+
+string LDAPAttrType::getOid() const {
     return oid;
 }
 
-string LDAPAttrType::getDesc () {
+string LDAPAttrType::getDesc() const {
     return desc;
 }
 
-StringList LDAPAttrType::getNames () {
+StringList LDAPAttrType::getNames() const {
     return names;
 }
 
-string LDAPAttrType::getName () {
+string LDAPAttrType::getName() const {
 
     if (names.empty())
        return "";
@@ -102,6 +121,28 @@ string LDAPAttrType::getName () {
        return *(names.begin());
 }
 
-int LDAPAttrType::getUsage () {
+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;
+}
+
+
index 445f5f79dac2bf95b0bf31f992e648e1baf09601..1069f27fdb685311c6dda579f4e3b682bffedf33 100644 (file)
@@ -23,10 +23,11 @@ using namespace std;
 class LDAPAttrType{
     private :
        StringList names;
-       string desc, oid;
+       std::string desc, oid, superiorOid, equalityOid;
+        std::string orderingOid, substringOid, syntaxOid;
        bool single;
        int usage;
-       
+
     public :
 
         /**
@@ -34,11 +35,6 @@ class LDAPAttrType{
          */   
         LDAPAttrType();
 
-        /**
-         * Copy constructor
-         */   
-       LDAPAttrType (const LDAPAttrType& oc);
-
         /**
         * Constructs new object and fills the data structure by parsing the
         * argument.
@@ -58,40 +54,50 @@ class LDAPAttrType{
        /**
         * Returns attribute description
         */
-       string getDesc ();
+       string getDesc() const;
        
        /**
         * Returns attribute oid
         */
-       string getOid ();
+       string getOid() const;
 
        /**
         * Returns attribute name (first one if there are more of them)
         */
-       string getName ();
+       string getName() const;
 
        /**
         * Returns all attribute names
         */
-       StringList getNames();
+       StringList getNames() const;
        
        /**
         * Returns true if attribute type allows only single value
         */
-       bool isSingle();
+       bool isSingle() const;
        
        /**
         * Return the 'usage' value:
         * (0=userApplications, 1=directoryOperation, 2=distributedOperation, 
         *  3=dSAOperation)
         */
-       int getUsage ();
+       int getUsage () const;
+        std::string getSuperiorOid() const;
+        std::string getEqualityOid() const;
+        std::string getOrderingOid() const;
+        std::string getSubstringOid() const;
+        std::string getSyntaxOid() const;
 
-       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 );
+       void setNames( char **at_names);
+       void setDesc(const char *at_desc);
+       void setOid(const char *at_oid);
+       void setSingle(int at_single_value);
+       void setUsage(int at_usage );
+        void setSuperiorOid( const char *oid );
+        void setEqualityOid( const char *oid );
+        void setOrderingOid( const char *oid );
+        void setSubstringOid( const char *oid );
+        void setSyntaxOid( const char *oid );
 };
 
 #endif // LDAP_ATTRTYPE_H
index 618f3401e50bb54412068c703968fede5fcac65b..b7621afe07011e82596e61ec2c0cebddde9378a5 100644 (file)
@@ -91,31 +91,31 @@ void LDAPObjClass::setOid (char *oc_oid) {
        oid = oc_oid;
 }
 
-string LDAPObjClass::getOid () {
+string LDAPObjClass::getOid() const {
     return oid;
 }
 
-string LDAPObjClass::getDesc () {
+string LDAPObjClass::getDesc() const {
     return desc;
 }
 
-StringList LDAPObjClass::getNames () {
+StringList LDAPObjClass::getNames() const {
     return names;
 }
 
-StringList LDAPObjClass::getMust () {
+StringList LDAPObjClass::getMust() const {
     return must;
 }
 
-StringList LDAPObjClass::getMay () {
+StringList LDAPObjClass::getMay() const {
     return may;
 }
 
-StringList LDAPObjClass::getSup () {
+StringList LDAPObjClass::getSup() const {
     return sup;
 }
 
-string LDAPObjClass::getName () {
+string LDAPObjClass::getName() const {
 
     if (names.empty())
        return "";
@@ -123,7 +123,7 @@ string LDAPObjClass::getName () {
        return *(names.begin());
 }
 
-int LDAPObjClass::getKind () {
+int LDAPObjClass::getKind() const {
      return kind;
 }
 
index 02175235dd6b2e0da465b016857cec2b880791b9..87f87f1dc393af365ea3fd78d3b234aac57d986f 100644 (file)
@@ -56,42 +56,42 @@ class LDAPObjClass{
        /**
         * Returns object class description
         */
-       string getDesc ();
+       string getDesc() const;
        
        /**
         * Returns object class oid
         */
-       string getOid ();
+       string getOid() const;
 
        /**
         * Returns object class name (first one if there are more of them)
         */
-       string getName ();
+       string getName() const;
 
        /**
         * Returns object class kind: 0=ABSTRACT, 1=STRUCTURAL, 2=AUXILIARY
         */
-       int getKind ();
+       int getKind() const;
 
        /**
         * Returns all object class names
         */
-       StringList getNames();
+       StringList getNames() const;
        
        /**
         * Returns list of required attributes
         */
-       StringList getMust();
+       StringList getMust() const;
        
        /**
         * Returns list of allowed (and not required) attributes
         */
-       StringList getMay();
+       StringList getMay() const;
        
         /**
         * Returns list of the OIDs of the superior ObjectClasses
         */
-       StringList getSup();
+       StringList getSup() const;
 
        void setNames (char **oc_names);
        void setMay (char **oc_may);