Solved

XPCOM function returns nsAString

Posted on 2008-10-23
4
765 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
  • 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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Suggested Solutions

Bada platform is becoming more and more famous this days and people talking about same. Some friends included those who have bada OS mobile asked me "what is bada?"and "what its features?". That encouraged me to research and write this article. [st…
SSL stands for “Secure Sockets Layer” and an SSL certificate is a critical component to keeping your website safe, secured, and compliant. Any ecommerce website must have an SSL certificate to ensure the safe handling of sensitive information like…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
Shows how to create a shortcut to site-search Experts Exchange using Google in the Chrome browser. This eliminates the need to type out site:experts-exchange.com whenever you want to search the site. Launch the Search Engine Menu: In chrome, via you…

803 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