Hello,

I am trying to use a MutableArray in a XPCOM, but I noticed I have no
idea how to add new elements of primitive types such as string (char
*) and short (PRInt16). I cannot find any code that shows how to do
this. I tried something like:

char *elem = "hi";
nsCOMPtr<nsISupportsString> arg =
do_CreateInstance(NS_SUPPORTS_STRING_CONTRACTID);;
NS_ENSURE_TRUE(arg, NS_ERROR_FAILURE);

arg->SetData(elem);

rv = m_present->AppendElement(arg, PR_FALSE);

I got this error:

error: no matching function for call to
'nsDerivedSafe<nsISupportsString>::SetData(char*&)

Besides, even if I get this to compile, the initializations of so many
nsISupportsString or nsISupportsPRUint16 will be overkill

Any help will be greatly appreciated

Thanks,

Mark

_______________________________________________
dev-tech-xpcom mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-xpcom

Reply via email to