I have an IDL file and I want to add a new attribute that contains an array of strings. The interface is implemented in JavaScript and I'm writing C++ code.
IDL: readonly attribute nsIArray osPaths; // DOMString[] Consuming in C++: nsCOMPtr<nsIArray> bla; app->GetOsPaths(getter_AddRefs(bla)); uint32_t length; bla->GetLength(&length); printf("Length=%d\n", length); All OK. Prints 'Length=1' when I add one element in the array. But now... how do I get the strings out of here. I found do_QueryElement and it's nsISupports* friends, but none of them say they can handle it... for (uint32_t j = 0; j < length; ++j) { nsCOMPtr<nsISupportsPrimitive> isp = do_QueryElementAt(bla, j); nsCOMPtr<nsISupportsCString> iscs = do_QueryElementAt(bla, j); nsCOMPtr<nsISupportsString> iss = do_QueryElementAt(bla, j); nsCOMPtr<nsISupportsPRBool> isb = do_QueryElementAt(bla, j); nsCOMPtr<nsISupportsPRUint8> isu8 = do_QueryElementAt(bla, j); nsCOMPtr<nsISupportsPRUint16> isu16 = do_QueryElementAt(bla, j); nsCOMPtr<nsISupportsPRUint32> isu32 = do_QueryElementAt(bla, j); nsCOMPtr<nsISupportsChar> isc = do_QueryElementAt(bla, j); nsCOMPtr<nsISupportsPRInt16> isi16 = do_QueryElementAt(bla, j); nsCOMPtr<nsISupportsPRInt32> isi32 = do_QueryElementAt(bla, j); nsCOMPtr<nsISupportsFloat> isf = do_QueryElementAt(bla, j); nsCOMPtr<nsISupportsDouble> isd = do_QueryElementAt(bla, j); nsCOMPtr<nsISupportsInterfacePointer> isip = do_QueryElementAt(bla, j); printf("isp=%d ", !!isp); printf("iscs=%d ", !!iscs); printf("iss=%d ", !!iss); printf("isb=%d ", !!isb); printf("isu8=%d ", !!isu8); printf("isu16=%d ", !!isu16); printf("isu32=%d ", !!isu32); printf("isc=%d ", !!isc); printf("isi16=%d ", !!isi16); printf("isi32=%d ", !!isi32); printf("isf=%d ", !!isf); printf("isd=%d ", !!isd); printf("isip=%d ", !!isip); printf("\n"); } Result: isp=0 iscs=0 iss=0 isb=0 isu8=0 isu16=0 isu32=0 isc=0 isi16=0 isi32=0 isf=0 isd=0 isip=0 So what type is in here, and how can I get it out of the array? I just want normal nsString objects. _______________________________________________ dev-platform mailing list dev-platform@lists.mozilla.org https://lists.mozilla.org/listinfo/dev-platform