Re: [Vala] List problem in Valide



I have found the problem: these functions directly compare the adress
of the keys.

Becareful, the find function return the node of the list, not the data !

void main ()
{
  SList<string> list = new SList<string> ();

  list.append ("one");
  list.append ("two");
  list.append ("three");
  list.append ("four");

  string key = "three";

  unowned SList<string> node = list.find_custom (key, strcmp);
  int ix = list.position (node);

  print ("%s - %d\n", node.data, ix);
}


2009/5/31 Joss 4 <gpnet abraerp it>:
Nicolas Joseph wrote:

Hello,

Your first problem is due to the '<' character, could you post an
issue so that I will not forget:
http://code.google.com/p/valide/issues/list

libgee is now included in libvala-1.0.dll, you just add the vala-1.0
package.

2009/5/30 Joss 4 <gpnet abraerp it>:


@ Nicolas
I have problems with valide 4.0 version in windows env.

My example is :

using GLib;

    SList<string> list = new SList<string> ();
        list.append ("one");
        list.append ("two");
        list.append ("three");
        list.append ("four");

now if I write the sort function with first letter in uppercase like
list.Sort the compiler doesn't  warning any error, simply don't compile.
while if  manually compile on command line this way, I get the error:

main.vala:376.13-376.21: error: The name `Sort' does not exist in the
context of `GLib.SList<string>'
         list.Sort(strcmp);
         ^^^^^^^^^
also I have problems with indexeder and find functions; If I write code
like
this:

string key = "three";
int ix = list.index(key);        //  In this line I get -1

string foundkey =  (string)list.find(key);    // in this line i get null

stdout.printf ("%s %d \n", foundkey, ix );
Where I am wrong  ? Is there some error in  my settings ?.

@Nicolas Joseph ,
Could you also post a windows version of libgee-1.0.dll ??


_______________________________________________
Vala-list mailing list
Vala-list gnome org
http://mail.gnome.org/mailman/listinfo/vala-list



Thank you Nicolas


I tried the ArrayList with Gee and it works !

Sorry, What about the find and the indexer functions ? have you any news ?









-- 
Nicolas Joseph

Responsable des rubriques C et GTK+ de developpez.com /
In charge of the C and GTK+ sections on developpez.com

http://nicolasj.developpez.com



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