Click here to Skip to main content
Click here to Skip to main content
Add your own
alternative version

String Handling in XPCOM

, 16 Aug 2010
Using different types of strings in XPCOM.
/*
 * DO NOT EDIT.  THIS FILE IS GENERATED FROM ISample.idl
 */

#ifndef __gen_ISample_h__
#define __gen_ISample_h__


#ifndef __gen_nsISupports_h__
#include "nsISupports.h"
#endif

/* For IDL files that don't want to include root IDL files. */
#ifndef NS_NO_VTABLE
#define NS_NO_VTABLE
#endif

/* starting interface:    ISample */
#define ISAMPLE_IID_STR "658abc9e-29cc-43e9-8a97-9d3c0b67ae8b"

#define ISAMPLE_IID \
  {0x658abc9e, 0x29cc, 0x43e9, \
    { 0x8a, 0x97, 0x9d, 0x3c, 0x0b, 0x67, 0xae, 0x8b }}

class NS_NO_VTABLE NS_SCRIPTABLE ISample : public nsISupports {
 public: 

  NS_DECLARE_STATIC_IID_ACCESSOR(ISAMPLE_IID)

  /* long Add (in long a, in long b); */
  NS_SCRIPTABLE NS_IMETHOD Add(PRInt32 a, PRInt32 b, PRInt32 *_retval NS_OUTPARAM) = 0;

  /* string ReverseString (in string s); */
  NS_SCRIPTABLE NS_IMETHOD ReverseString(const char *s, char **_retval NS_OUTPARAM) = 0;

  /* AString ReverseAString (in AString nStr); */
  NS_SCRIPTABLE NS_IMETHOD ReverseAString(const nsAString & nStr, nsAString & _retval NS_OUTPARAM) = 0;

  /* wstring ReverseUnichar (in wstring nStr); */
  NS_SCRIPTABLE NS_IMETHOD ReverseUnichar(const PRUnichar *nStr, PRUnichar **_retval NS_OUTPARAM) = 0;

  /* ACString ReverseACString (in ACString nStr); */
  NS_SCRIPTABLE NS_IMETHOD ReverseACString(const nsACString & nStr, nsACString & _retval NS_OUTPARAM) = 0;

};

  NS_DEFINE_STATIC_IID_ACCESSOR(ISample, ISAMPLE_IID)

/* Use this macro when declaring classes that implement this interface. */
#define NS_DECL_ISAMPLE \
  NS_SCRIPTABLE NS_IMETHOD Add(PRInt32 a, PRInt32 b, PRInt32 *_retval NS_OUTPARAM); \
  NS_SCRIPTABLE NS_IMETHOD ReverseString(const char *s, char **_retval NS_OUTPARAM); \
  NS_SCRIPTABLE NS_IMETHOD ReverseAString(const nsAString & nStr, nsAString & _retval NS_OUTPARAM); \
  NS_SCRIPTABLE NS_IMETHOD ReverseUnichar(const PRUnichar *nStr, PRUnichar **_retval NS_OUTPARAM); \
  NS_SCRIPTABLE NS_IMETHOD ReverseACString(const nsACString & nStr, nsACString & _retval NS_OUTPARAM); 

/* Use this macro to declare functions that forward the behavior of this interface to another object. */
#define NS_FORWARD_ISAMPLE(_to) \
  NS_SCRIPTABLE NS_IMETHOD Add(PRInt32 a, PRInt32 b, PRInt32 *_retval NS_OUTPARAM) { return _to Add(a, b, _retval); } \
  NS_SCRIPTABLE NS_IMETHOD ReverseString(const char *s, char **_retval NS_OUTPARAM) { return _to ReverseString(s, _retval); } \
  NS_SCRIPTABLE NS_IMETHOD ReverseAString(const nsAString & nStr, nsAString & _retval NS_OUTPARAM) { return _to ReverseAString(nStr, _retval); } \
  NS_SCRIPTABLE NS_IMETHOD ReverseUnichar(const PRUnichar *nStr, PRUnichar **_retval NS_OUTPARAM) { return _to ReverseUnichar(nStr, _retval); } \
  NS_SCRIPTABLE NS_IMETHOD ReverseACString(const nsACString & nStr, nsACString & _retval NS_OUTPARAM) { return _to ReverseACString(nStr, _retval); } 

/* Use this macro to declare functions that forward the behavior of this interface to another object in a safe way. */
#define NS_FORWARD_SAFE_ISAMPLE(_to) \
  NS_SCRIPTABLE NS_IMETHOD Add(PRInt32 a, PRInt32 b, PRInt32 *_retval NS_OUTPARAM) { return !_to ? NS_ERROR_NULL_POINTER : _to->Add(a, b, _retval); } \
  NS_SCRIPTABLE NS_IMETHOD ReverseString(const char *s, char **_retval NS_OUTPARAM) { return !_to ? NS_ERROR_NULL_POINTER : _to->ReverseString(s, _retval); } \
  NS_SCRIPTABLE NS_IMETHOD ReverseAString(const nsAString & nStr, nsAString & _retval NS_OUTPARAM) { return !_to ? NS_ERROR_NULL_POINTER : _to->ReverseAString(nStr, _retval); } \
  NS_SCRIPTABLE NS_IMETHOD ReverseUnichar(const PRUnichar *nStr, PRUnichar **_retval NS_OUTPARAM) { return !_to ? NS_ERROR_NULL_POINTER : _to->ReverseUnichar(nStr, _retval); } \
  NS_SCRIPTABLE NS_IMETHOD ReverseACString(const nsACString & nStr, nsACString & _retval NS_OUTPARAM) { return !_to ? NS_ERROR_NULL_POINTER : _to->ReverseACString(nStr, _retval); } 

#if 0
/* Use the code below as a template for the implementation class for this interface. */

/* Header file */
class _MYCLASS_ : public ISample
{
public:
  NS_DECL_ISUPPORTS
  NS_DECL_ISAMPLE

  _MYCLASS_();

private:
  ~_MYCLASS_();

protected:
  /* additional members */
};

/* Implementation file */
NS_IMPL_ISUPPORTS1(_MYCLASS_, ISample)

_MYCLASS_::_MYCLASS_()
{
  /* member initializers and constructor code */
}

_MYCLASS_::~_MYCLASS_()
{
  /* destructor code */
}

/* long Add (in long a, in long b); */
NS_IMETHODIMP _MYCLASS_::Add(PRInt32 a, PRInt32 b, PRInt32 *_retval NS_OUTPARAM)
{
    return NS_ERROR_NOT_IMPLEMENTED;
}

/* string ReverseString (in string s); */
NS_IMETHODIMP _MYCLASS_::ReverseString(const char *s, char **_retval NS_OUTPARAM)
{
    return NS_ERROR_NOT_IMPLEMENTED;
}

/* AString ReverseAString (in AString nStr); */
NS_IMETHODIMP _MYCLASS_::ReverseAString(const nsAString & nStr, nsAString & _retval NS_OUTPARAM)
{
    return NS_ERROR_NOT_IMPLEMENTED;
}

/* wstring ReverseUnichar (in wstring nStr); */
NS_IMETHODIMP _MYCLASS_::ReverseUnichar(const PRUnichar *nStr, PRUnichar **_retval NS_OUTPARAM)
{
    return NS_ERROR_NOT_IMPLEMENTED;
}

/* ACString ReverseACString (in ACString nStr); */
NS_IMETHODIMP _MYCLASS_::ReverseACString(const nsACString & nStr, nsACString & _retval NS_OUTPARAM)
{
    return NS_ERROR_NOT_IMPLEMENTED;
}

/* End of implementation class template. */
#endif


#endif /* __gen_ISample_h__ */

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Md. Mazharul Islam Khan
Software Developer (Senior) Eyeball Networks Inc, Dhaka
Bangladesh Bangladesh
I strongly believe, a person's strongest point is to know his/her weak point. I try to be simple.
 
I have completed BSc in Computer Science & Engineering from Shah Jalal University of Science & Technology, Sylhet, Bangladesh (SUST).
 

Watch out for my other CodeProject Articles.

| Advertise | Privacy | Mobile
Web01 | 2.8.140821.2 | Last Updated 16 Aug 2010
Article Copyright 2010 by Md. Mazharul Islam Khan
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid