IDL File Creation

From $1

  

All interface definition files should contain the following elements:

  1. Songbird GPL License
  2. Doxygen File and InterfaceDocumentation
  3. Interface File Sections

See an example.

Including Files

All included files should use quotes. Please alphabetize.

Forward Declarations

All interfaces except the base interface should be forward-declared. This will speed up compilation. See the example.

Interface Definition

  • Interfaces may be marked as scriptable and should always contain a lowercase UUID.
  • Attributes should be used whenever possible (these translate into Get/Set methods in C++).
  • Favor AString over wstring unless you really need a character buffer.
  • Parameter names should always be preceeded by the letter "a".
  • Functions with multiple arguments should have each argument on a separate line.
  • Favor IDL types (boolean, unsigned long, etc.) over Mozilla-specific types (PRBool, PRUint32, etc.).

Example

/*
//
// BEGIN SONGBIRD GPL
// 
// This file is part of the Songbird web player.
//
// Copyright(c) 2006 POTI, Inc.
// http://songbirdnest.com
// 
// This file may be licensed under the terms of of the
// GNU General Public License Version 2 (the "GPL").
// 
// Software distributed under the License is distributed 
// on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either 
// express or implied. See the GPL for the specific language 
// governing rights and limitations.
//
// You should have received a copy of the GPL along with this 
// program. If not, go to http://www.gnu.org/licenses/gpl.html
// or write to the Free Software Foundation, Inc., 
// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
// 
// END SONGBIRD GPL
//
*/

#include "nsISupports.idl"

interface nsIObserver;
interface nsIURI;

/**
 * \interface sbISample
 *
 * \brief This is a sample interface.
 */
[scriptable, uuid(fc646e86-0974-4f51-ad8c-d5568fcf73e0)]
interface sbISample : nsISupports
{
  /**
   * \brief Returns the object's URI
   *
   * \throws NS_ERROR_NOT_INITIALIZED if the object isn't initialized
   */
  readonly attribute nsIURI uri;

  /**
   * \brief Finds an nsIObserver for a type and index.
   *
   * \param aType - the type to find
   * \param aIndex - an index
   *
   * \throws NS_ERROR_NOT_AVAILABLE if not available
   *
   * \return an nsIObserver
   */
  nsIObserver getObserverForType(in AString aType,
                                 in PRInt32 aIndex);
};

Page Title

This page has no content. Enrich Songbird Wiki by contributing.

Tags:
 
Images (0)
 
Comments (0)
You must login to post a comment.