Solved

XPCOM function returns nsAString

Posted on 2008-10-23
4
769 Views
Last Modified: 2013-12-07
Can someone provide me an example to XPCOM function which has a return value as nsAString?

Thanks,

MF
0
Comment
Question by:metalfish
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 19

Accepted Solution

by:
mrwad99 earned 500 total points
ID: 22794798
Interesting.  I cannot find any either.

I think there is probably some dark mysterious reason for that, but, in the meantime, if you just want to get a nsAString back from a function, pass one in as a reference, modifying it internally.  EG

void Function ( nsAString& strIN )
{
     // Modify strIN here
}

HTH
0
 

Author Comment

by:metalfish
ID: 22796066
Thanks. That works.

By the way, do you know how to convert .NET String to nsAString? Any example will be helpful.

MF
0
 
LVL 19

Expert Comment

by:mrwad99
ID: 22796203
Glad to help.
>> By the way, do you know how to convert .NET String to nsAString? Any example will be helpful.
Without extensive research I cannot give you complete code to do this.  However, you can get a char* from a System.String (I assume that is what you mean when you say .NET string) by following the extensive advice here http://support.microsoft.com/kb/311259.  And according to https://developer.mozilla.org/en/XPCOM_string_guide, you can use nsDependentString to convert char* to nsAString(https://developer.mozilla.org/en/XPCOM_string_guide#Raw_Character_Pointers).  
HTH :o)
0
 

Author Comment

by:metalfish
ID: 22798285
I will look into that. Thanks again for the help
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Internet is a big network which is formed by connecting multiple small networks.It is a platform for all the users which are connected to it.Internet act as platform in different fields. Such as: Internet  as a collaboration platform. Internet  as…
#Citrix #Internet Explorer #Enterprise Mode #IE 11 #IE 8
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

696 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question