Re: OAF::Attribute



On Sun, 23 Jul 2000, ERDI Gergo wrote:

> Is it OK if I just s/Attribute/Property/ in oaf.idl to avoid reserved word
> clashes?

Sorry, I forgot the patch (see attached)

-- 
   .--= ULLA! =----------------------------.  finger cactus@cactus.rulez.org
   \      http://cactus.rulez.org           \   for PGP public key
    `----------= cactus@cactus.rulez.org =--'
Elvis meghalt és én sem érzem túl jól magam.
Index: idl/oaf.idl
===================================================================
RCS file: /cvs/gnome/oaf/idl/oaf.idl,v
retrieving revision 1.17
diff -u -u -r1.17 oaf.idl
--- idl/oaf.idl	2000/07/09 17:54:58	1.17
+++ idl/oaf.idl	2000/07/23 15:37:33
@@ -34,15 +34,15 @@
                 ActivationResultData res;
         };
 
-        /* Attribute */
-        enum AttributeType { 
+        /* Property */
+        enum PropertyType { 
                 A_STRING, 
                 A_NUMBER, 
                 A_BOOLEAN, 
                 A_STRINGV 
         };
 
-        union AttributeValue switch (AttributeType) {
+        union PropertyValue switch (PropertyType) {
         case A_STRING:
                 string value_string;
         case A_NUMBER:
@@ -53,9 +53,9 @@
                 GNOME::stringlist value_stringv;
         };
 
-        struct Attribute {
+        struct Property {
                 string name;
-                AttributeValue v;
+                PropertyValue v;
         };
 
         /* Server */
@@ -66,7 +66,7 @@
                 string location_info;
                 string username, hostname, domain;
 		
-                sequence<Attribute> attrs;
+                sequence<Property> props;
         };
 
         typedef sequence<ServerInfo> ServerInfoList;
Index: liboaf/liboaf.h
===================================================================
RCS file: /cvs/gnome/oaf/liboaf/liboaf.h,v
retrieving revision 1.24
diff -u -u -r1.24 liboaf.h
--- liboaf/liboaf.h	2000/07/10 15:33:53	1.24
+++ liboaf/liboaf.h	2000/07/23 15:37:34
@@ -137,18 +137,18 @@
 void oaf_active_server_unregister (const char *iid, CORBA_Object obj);
 
 /* oaf-util.c */
-OAF_Attribute *oaf_server_info_attr_find (OAF_ServerInfo * server,
-					  const char *attr_name);
-const char *oaf_server_info_attr_lookup (OAF_ServerInfo * server,
-					 const char *attr_name,
+OAF_Property *oaf_server_info_prop_find (OAF_ServerInfo * server,
+                                         const char *prop_name);
+const char *oaf_server_info_prop_lookup (OAF_ServerInfo * server,
+					 const char *prop_name,
 					 GSList * i18n_languages);
-void OAF_AttributeValue_copy (OAF_AttributeValue *copy,
-                              const OAF_AttributeValue *original);
-void OAF_Attribute_copy (OAF_Attribute *copy,
-                         const OAF_Attribute *original);
+void OAF_PropertyValue_copy (OAF_PropertyValue *copy,
+                             const OAF_PropertyValue *original);
+void OAF_Property_copy (OAF_Property *copy,
+                        const OAF_Property *original);
 void
-CORBA_sequence_OAF_Attribute_copy (CORBA_sequence_OAF_Attribute *copy,
-                                   const CORBA_sequence_OAF_Attribute *original);
+CORBA_sequence_OAF_Property_copy (CORBA_sequence_OAF_Property *copy,
+                                  const CORBA_sequence_OAF_Property *original);
 void
 OAF_ServerInfo_copy (OAF_ServerInfo *copy, const OAF_ServerInfo *original);
 OAF_ServerInfo *
Index: liboaf/oaf-util.c
===================================================================
RCS file: /cvs/gnome/oaf/liboaf/oaf-util.c,v
retrieving revision 1.8
diff -u -u -r1.8 oaf-util.c
--- liboaf/oaf-util.c	2000/06/19 16:08:13	1.8
+++ liboaf/oaf-util.c	2000/07/23 15:37:34
@@ -1,42 +1,42 @@
 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
 #include "liboaf.h"
 
-OAF_Attribute *
-oaf_server_info_attr_find (OAF_ServerInfo * server, const char *attr_name)
+OAF_Property *
+oaf_server_info_prop_find (OAF_ServerInfo * server, const char *prop_name)
 {
 	int i;
 
-	for (i = 0; i < server->attrs._length; i++) {
-		if (!strcmp (server->attrs._buffer[i].name, attr_name))
-			return &server->attrs._buffer[i];
+	for (i = 0; i < server->props._length; i++) {
+		if (!strcmp (server->props._buffer[i].name, prop_name))
+			return &server->props._buffer[i];
 	}
 
 	return NULL;
 }
 
 const char *
-oaf_server_info_attr_lookup (OAF_ServerInfo * server, const char *attr_name,
+oaf_server_info_prop_lookup (OAF_ServerInfo * server, const char *prop_name,
 			     GSList * i18n_languages)
 {
 	GSList *cur;
-	OAF_Attribute *attr;
+	OAF_Property *prop;
         const char *retval;
-        char *attr_name_buf;
+        char *prop_name_buf;
         char short_lang[3];
                      
 	if (i18n_languages) {
 		for (cur = i18n_languages; cur; cur = cur->next) {
-                        attr_name_buf = g_strdup_printf ("%s-%s", attr_name, (char *) cur->data);
+                        prop_name_buf = g_strdup_printf ("%s-%s", prop_name, (char *) cur->data);
 
-			retval = oaf_server_info_attr_lookup (server, attr_name_buf, NULL);
-                        g_free (attr_name_buf);
+			retval = oaf_server_info_prop_lookup (server, prop_name_buf, NULL);
+                        g_free (prop_name_buf);
 
                         if (!retval) {
                                 if (strlen ((char *) cur->data) > 2) {
                                         strncpy (short_lang, (char *) cur->data, 2);
-                                        attr_name_buf = g_strdup_printf ("%s-%s", attr_name, short_lang);
-                                        retval = oaf_server_info_attr_lookup (server, attr_name_buf, NULL);
-                                        g_free (attr_name_buf);
+                                        prop_name_buf = g_strdup_printf ("%s-%s", prop_name, short_lang);
+                                        retval = oaf_server_info_prop_lookup (server, prop_name_buf, NULL);
+                                        g_free (prop_name_buf);
                                 }
                         }
 
@@ -45,9 +45,9 @@
 		}
 	} 
 
-        attr = oaf_server_info_attr_find (server, attr_name);
-        if (attr != NULL && attr->v._d == OAF_A_STRING)
-                return attr->v._u.value_string;
+        prop = oaf_server_info_prop_find (server, prop_name);
+        if (prop != NULL && prop->v._d == OAF_A_STRING)
+                return prop->v._u.value_string;
 
 	return NULL;
 }
@@ -69,7 +69,7 @@
 }
 
 void
-OAF_AttributeValue_copy (OAF_AttributeValue *copy, const OAF_AttributeValue *original)
+OAF_PropertyValue_copy (OAF_PropertyValue *copy, const OAF_PropertyValue *original)
 {
 	copy->_d = original->_d;
 	switch (original->_d) {
@@ -93,23 +93,23 @@
 }
 
 void
-OAF_Attribute_copy (OAF_Attribute *copy, const OAF_Attribute *original)
+OAF_Property_copy (OAF_Property *copy, const OAF_Property *original)
 {
 	copy->name = CORBA_string_dup (original->name);
-	OAF_AttributeValue_copy (&copy->v, &original->v);
+	OAF_PropertyValue_copy (&copy->v, &original->v);
 }
 
 void
-CORBA_sequence_OAF_Attribute_copy (CORBA_sequence_OAF_Attribute *copy, const CORBA_sequence_OAF_Attribute *original)
+CORBA_sequence_OAF_Property_copy (CORBA_sequence_OAF_Property *copy, const CORBA_sequence_OAF_Property *original)
 {
 	int i;
 
 	copy->_maximum = original->_length;
 	copy->_length = original->_length;
-	copy->_buffer = CORBA_sequence_OAF_Attribute_allocbuf (original->_length);
+	copy->_buffer = CORBA_sequence_OAF_Property_allocbuf (original->_length);
 
 	for (i = 0; i < original->_length; i++) {
-		OAF_Attribute_copy (&copy->_buffer[i], &original->_buffer[i]);
+		OAF_Property_copy (&copy->_buffer[i], &original->_buffer[i]);
 	}
 
 	CORBA_sequence_set_release (copy, TRUE);
@@ -124,7 +124,7 @@
 	copy->username = CORBA_string_dup (original->username);
 	copy->hostname = CORBA_string_dup (original->hostname);
 	copy->domain = CORBA_string_dup (original->domain);
-	CORBA_sequence_OAF_Attribute_copy (&copy->attrs, &original->attrs);
+	CORBA_sequence_OAF_Property_copy (&copy->props, &original->props);
 }
 
 OAF_ServerInfo *
Index: oafd/ac-query-expr.c
===================================================================
RCS file: /cvs/gnome/oaf/oafd/ac-query-expr.c,v
retrieving revision 1.19
diff -u -u -r1.19 ac-query-expr.c
--- oafd/ac-query-expr.c	2000/06/15 21:19:41	1.19
+++ oafd/ac-query-expr.c	2000/07/23 15:37:35
@@ -773,18 +773,18 @@
 			retval.u.v_string = si->domain;
 		else {
 			int i;
-			for (i = 0; i < si->attrs._length; i++) {
+			for (i = 0; i < si->props._length; i++) {
 				if (!strcmp
 				    (e->u.id_value,
-				     si->attrs._buffer[i].name)) break;
+				     si->props._buffer[i].name)) break;
 			}
 
 			retval.value_known = FALSE;
 
-			if (i < si->attrs._length) {
-				OAF_AttributeValue *av;
+			if (i < si->props._length) {
+				OAF_PropertyValue *av;
 
-				av = &si->attrs._buffer[i].v;
+				av = &si->props._buffer[i].v;
 
 				switch (av->_d) {
 				case OAF_A_STRING:
Index: oafd/client.c
===================================================================
RCS file: /cvs/gnome/oaf/oafd/client.c,v
retrieving revision 1.6
diff -u -u -r1.6 client.c
--- oafd/client.c	2000/05/27 14:47:10	1.6
+++ oafd/client.c	2000/07/23 15:37:36
@@ -30,32 +30,32 @@
 			 list->_buffer[i].iid,
 			 list->_buffer[i].server_type,
 			 list->_buffer[i].location_info);
-		for (j = 0; j < list->_buffer[i].attrs._length; j++) {
-			OAF_Attribute *attr =
-				&(list->_buffer[i].attrs._buffer[j]);
-			g_print ("    %s = ", attr->name);
-			switch (attr->v._d) {
+		for (j = 0; j < list->_buffer[i].props._length; j++) {
+			OAF_Property *prop =
+				&(list->_buffer[i].props._buffer[j]);
+			g_print ("    %s = ", prop->name);
+			switch (prop->v._d) {
 			case OAF_A_STRING:
-				g_print ("\"%s\"\n", attr->v._u.value_string);
+				g_print ("\"%s\"\n", prop->v._u.value_string);
 				break;
 			case OAF_A_NUMBER:
-				g_print ("%f\n", attr->v._u.value_number);
+				g_print ("%f\n", prop->v._u.value_number);
 				break;
 			case OAF_A_BOOLEAN:
 				g_print ("%s\n",
-					 attr->v.
+					 prop->v.
 					 _u.value_boolean ? "TRUE" : "FALSE");
 				break;
 			case OAF_A_STRINGV:
 				g_print ("[");
 				for (k = 0;
-				     k < attr->v._u.value_stringv._length;
+				     k < prop->v._u.value_stringv._length;
 				     k++) {
 					g_print ("\"%s\"",
-						 attr->v._u.
+						 prop->v._u.
 						 value_stringv._buffer[k]);
 					if (k <
-					    (attr->v._u.
+					    (prop->v._u.
 					     value_stringv._length - 1))
 						g_print (", ");
 				}
Index: oafd/od-load.c
===================================================================
RCS file: /cvs/gnome/oaf/oafd/od-load.c,v
retrieving revision 1.11
diff -u -u -r1.11 od-load.c
--- oafd/od-load.c	2000/07/05 21:50:00	1.11
+++ oafd/od-load.c	2000/07/23 15:37:36
@@ -25,24 +25,24 @@
 }
 
 static void
-od_entry_read_attrs (OAF_ServerInfo * ent, xmlNodePtr node)
+od_entry_read_props (OAF_ServerInfo * ent, xmlNodePtr node)
 {
 	int i, n;
 	xmlNodePtr sub;
-	OAF_Attribute *curattr;
+	OAF_Property *curprop;
 
 	for (n = 0, sub = node->childs; sub; sub = sub->next) {
 		if (sub->type != XML_ELEMENT_NODE)
 			continue;
 
-		if (strcasecmp (sub->name, "oaf_attribute"))
+		if (strcasecmp (sub->name, "oaf_propibute"))
 			continue;
 
 		n++;
 	}
 
-	ent->attrs._length = n;
-	ent->attrs._buffer = curattr = g_new (OAF_Attribute, n);
+	ent->props._length = n;
+	ent->props._buffer = curprop = g_new (OAF_Property, n);
 
 	for (i = 0, sub = node->childs; i < n; sub = sub->next, i++) {
 		char *type, *valuestr;
@@ -56,14 +56,14 @@
 			free (type);
 			continue;
 		}
-		curattr->name = CORBA_string_dup (valuestr);
+		curprop->name = CORBA_string_dup (valuestr);
 		free (valuestr);
 
 		if (!strcasecmp (type, "stringv")) {
 			int j, o;
 			xmlNodePtr sub2;
 
-			curattr->v._d = OAF_A_STRINGV;
+			curprop->v._d = OAF_A_STRINGV;
 
 			for (o = 0, sub2 = sub->childs; sub2;
 			     sub2 = sub2->next) {
@@ -75,22 +75,22 @@
 				o++;
 			}
 
-			curattr->v._u.value_stringv._length = o;
-			curattr->v._u.value_stringv._buffer =
+			curprop->v._u.value_stringv._length = o;
+			curprop->v._u.value_stringv._buffer =
 				CORBA_sequence_CORBA_string_allocbuf (o);
 
 			for (j = 0, sub2 = sub->childs; j < o;
 			     sub2 = sub2->next, j++) {
 				valuestr = xmlGetProp (sub2, "value");
 				if (valuestr)
-					curattr->v._u.
+					curprop->v._u.
 						value_stringv._buffer[j] =
 						CORBA_string_dup (valuestr);
 				else {
 					g_warning
-						("Attribute '%s' has no value",
-						 curattr->name);
-					curattr->v._u.
+						("Property '%s' has no value",
+						 curprop->name);
+					curprop->v._u.
 						value_stringv._buffer[j] =
 						CORBA_string_dup ("");
 				}
@@ -100,27 +100,27 @@
 		} else if (!strcasecmp (type, "number")) {
 			valuestr = xmlGetProp (sub, "value");
 
-			curattr->v._d = OAF_A_NUMBER;
-			curattr->v._u.value_number = atof (valuestr);
+			curprop->v._d = OAF_A_NUMBER;
+			curprop->v._u.value_number = atof (valuestr);
 
 			free (valuestr);
 		} else if (!strcasecmp (type, "boolean")) {
 			valuestr = xmlGetProp (sub, "value");
-			curattr->v._d = OAF_A_BOOLEAN;
-			curattr->v._u.value_boolean =
+			curprop->v._d = OAF_A_BOOLEAN;
+			curprop->v._u.value_boolean =
 				od_string_to_boolean (valuestr);
 			free (valuestr);
 		} else {
 			valuestr = xmlGetProp (sub, "value");
 			/* Assume string */
-			curattr->v._d = OAF_A_STRING;
+			curprop->v._d = OAF_A_STRING;
 			if (valuestr)
-				curattr->v._u.value_string =
+				curprop->v._u.value_string =
 					CORBA_string_dup (valuestr);
 			else {
-				g_warning ("Attribute '%s' has no value",
-					   curattr->name);
-				curattr->v._u.value_string =
+				g_warning ("Property '%s' has no value",
+					   curprop->name);
+				curprop->v._u.value_string =
 					CORBA_string_dup ("");
 			}
 			free (valuestr);
@@ -128,7 +128,7 @@
 
 		free (type);
 
-		curattr++;
+		curprop++;
 	}
 }
 
@@ -247,7 +247,7 @@
 					CORBA_string_dup (g_get_user_name ());
 				free (ctmp);
 
-				od_entry_read_attrs (new_ent, curnode);
+				od_entry_read_props (new_ent, curnode);
 
 				my_slist_prepend (entries, new_ent);
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]