Solved

XPCOM function returns nsAString

Posted on 2008-10-23
4
767 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: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

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

Several part series to implement Internet Explorer 11 Enterprise Mode
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…
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.

726 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