I haven't been following the string API changes for the last couple of
months and my old code doesn't compile anymore. What is the current accepted
way for doing:

1) get a "const nsAReadableString&" into a buffer suitable to pass to the
OS. My string is Unicode and the OS call wants Unicode too. Does this
require a copy or is there a trick using nsPromiseFlatString where I can get
a buffer pointer for the 99.9% of time the string is only in one buffer? I
was doing this: "(void*)(const PRUnichar*)nsPromiseFlatString(value)"

2) I have a PRUnichar* to a string. I want to pass this to a routine that
takes "const nsAReadableString&". The routine being called is going to copy
the string so I just want to make a light weight wrapper around the
PRUnichar*. I was using temp nsLiteralString variables to do this.

3) Is there a macro for an empty string? I was using this: static
nsLiteralString static_empty(L"", 0);

4) I need to return an interface to a constant string. Old code....
const nsAReadableString& Template::getTemplateName() {
 static nsLiteralString xmlfile(NS_LITERAL_STRING("XMLFile"));
  return xmlfile;
}


Thanks for the help,
Jon Smirl
[EMAIL PROTECTED]




Reply via email to