Re: OAF::Attribute



On Sat, 29 Jul 2000, ERDI Gergo wrote:

> What was the eventual decision about this? Neither is checked into CVS.

I will check the attached patch in tomorrow if noone objects.

-- 
   .--= ULLA! =----------------------------.  finger cactus@cactus.rulez.org
   \      http://cactus.rulez.org           \   for PGP public key
    `----------= cactus@cactus.rulez.org =--'
Esszé: írd le a világegyetemet legfeljebb 500 szóban. Adj meg két példát is!
Index: idl/oaf.idl
===================================================================
RCS file: /cvs/gnome/oaf/idl/oaf.idl,v
retrieving revision 1.18
diff -u -r1.18 oaf.idl
--- idl/oaf.idl	2000/07/24 19:37:39	1.18
+++ idl/oaf.idl	2000/07/29 20:09:06
@@ -58,28 +58,28 @@
                 ActivationResultData res;
         };
 
-        /* Attribute */
-        enum AttributeType { 
-                A_STRING, 
-                A_NUMBER, 
-                A_BOOLEAN, 
-                A_STRINGV 
+        /* Property */
+        enum PropertyType { 
+                P_STRING, 
+                P_NUMBER, 
+                P_BOOLEAN, 
+                P_STRINGV 
         };
 
-        union AttributeValue switch (AttributeType) {
-        case A_STRING:
+        union PropertyValue switch (PropertyType) {
+        case P_STRING:
                 string value_string;
-        case A_NUMBER:
+        case P_NUMBER:
                 double value_number;
-        case A_BOOLEAN:
+        case P_BOOLEAN:
                 boolean value_boolean;
-        case A_STRINGV:
+        case P_STRINGV:
                 GNOME::stringlist value_stringv;
         };
 
-        struct Attribute {
+        struct Property {
                 string name;
-                AttributeValue v;
+                PropertyValue v;
         };
 
         /* Server */
@@ -90,7 +90,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.25
diff -u -r1.25 liboaf.h
--- liboaf/liboaf.h	2000/07/24 19:37:39	1.25
+++ liboaf/liboaf.h	2000/07/29 20:09:07
@@ -167,18 +167,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.9
diff -u -r1.9 oaf-util.c
--- liboaf/oaf-util.c	2000/07/24 19:37:39	1.9
+++ liboaf/oaf-util.c	2000/07/29 20:09:07
@@ -25,42 +25,42 @@
 
 #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);
                                 }
                         }
 
@@ -69,9 +69,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_P_STRING)
+                return prop->v._u.value_string;
 
 	return NULL;
 }
@@ -93,20 +93,20 @@
 }
 
 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) {
-	case OAF_A_STRING:
+	case OAF_P_STRING:
 		copy->_u.value_string =	CORBA_string_dup (original->_u.value_string);
 		break;
-	case OAF_A_NUMBER:
+	case OAF_P_NUMBER:
 		copy->_u.value_number =	original->_u.value_number;
 		break;
-	case OAF_A_BOOLEAN:
+	case OAF_P_BOOLEAN:
 		copy->_u.value_boolean = original->_u.value_boolean;
 		break;
-	case OAF_A_STRINGV:
+	case OAF_P_STRINGV:
 		CORBA_sequence_CORBA_string_copy
 			(&copy->_u.value_stringv,
 			 &original->_u.value_stringv);
@@ -117,23 +117,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);
@@ -148,7 +148,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.20
diff -u -r1.20 ac-query-expr.c
--- oafd/ac-query-expr.c	2000/07/24 19:37:40	1.20
+++ oafd/ac-query-expr.c	2000/07/29 20:09:08
@@ -796,36 +796,36 @@
 			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:
+				case OAF_P_STRING:
 					retval.type = CONST_STRING;
 					retval.u.v_string =
 						av->_u.value_string;
 					break;
-				case OAF_A_NUMBER:
+				case OAF_P_NUMBER:
 					retval.type = CONST_NUMBER;
 					retval.u.v_number =
 						av->_u.value_number;
 					break;
-				case OAF_A_BOOLEAN:
+				case OAF_P_BOOLEAN:
 					retval.type = CONST_BOOLEAN;
 					retval.u.v_boolean =
 						av->_u.value_boolean;
 					break;
-				case OAF_A_STRINGV:
+				case OAF_P_STRINGV:
 					{
 						/* XXX it would be nice to replace the
 						 * NULL-terminated string arrays with
Index: oafd/client.c
===================================================================
RCS file: /cvs/gnome/oaf/oafd/client.c,v
retrieving revision 1.7
diff -u -r1.7 client.c
--- oafd/client.c	2000/07/24 19:37:40	1.7
+++ oafd/client.c	2000/07/29 20:09:09
@@ -54,32 +54,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) {
-			case OAF_A_STRING:
-				g_print ("\"%s\"\n", attr->v._u.value_string);
+		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_P_STRING:
+				g_print ("\"%s\"\n", prop->v._u.value_string);
 				break;
-			case OAF_A_NUMBER:
-				g_print ("%f\n", attr->v._u.value_number);
+			case OAF_P_NUMBER:
+				g_print ("%f\n", prop->v._u.value_number);
 				break;
-			case OAF_A_BOOLEAN:
+			case OAF_P_BOOLEAN:
 				g_print ("%s\n",
-					 attr->v.
+					 prop->v.
 					 _u.value_boolean ? "TRUE" : "FALSE");
 				break;
-			case OAF_A_STRINGV:
+			case OAF_P_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.14
diff -u -r1.14 od-load.c
--- oafd/od-load.c	2000/07/26 01:01:50	1.14
+++ oafd/od-load.c	2000/07/29 20:09:09
@@ -51,24 +51,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;
@@ -82,14 +82,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_P_STRINGV;
 
 			for (o = 0, sub2 = sub->childs; sub2;
 			     sub2 = sub2->next) {
@@ -101,22 +101,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 ("");
 				}
@@ -126,27 +126,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_P_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_P_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_P_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);
@@ -154,7 +154,7 @@
 
 		free (type);
 
-		curattr++;
+		curprop++;
 	}
 }
 
@@ -286,7 +286,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);
                                 } else {


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