1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/xpcom/components/nsIClassInfo.idl Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,99 @@ 1.4 +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- 1.5 + * 1.6 + * This Source Code Form is subject to the terms of the Mozilla Public 1.7 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.8 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.9 + 1.10 +#include "nsISupports.idl" 1.11 + 1.12 +/** 1.13 + * Provides information about a specific implementation class. If you want 1.14 + * your class to implement nsIClassInfo, see nsIClassInfoImpl.h for 1.15 + * instructions--you most likely do not want to inherit from nsIClassInfo. 1.16 + */ 1.17 + 1.18 +[scriptable, uuid(986c11d0-f340-11d4-9075-0010a4e73d9a)] 1.19 +interface nsIClassInfo : nsISupports 1.20 +{ 1.21 + /** 1.22 + * Get an ordered list of the interface ids that instances of the class 1.23 + * promise to implement. Note that nsISupports is an implicit member 1.24 + * of any such list and need not be included. 1.25 + * 1.26 + * Should set *count = 0 and *array = null and return NS_OK if getting the 1.27 + * list is not supported. 1.28 + */ 1.29 + void getInterfaces(out uint32_t count, 1.30 + [array, size_is(count), retval] out nsIIDPtr array); 1.31 + 1.32 + /** 1.33 + * Get a language mapping specific helper object that may assist in using 1.34 + * objects of this class in a specific lanaguage. For instance, if asked 1.35 + * for the helper for nsIProgrammingLanguage::JAVASCRIPT this might return 1.36 + * an object that can be QI'd into the nsIXPCScriptable interface to assist 1.37 + * XPConnect in supplying JavaScript specific behavior to callers of the 1.38 + * instance object. 1.39 + * 1.40 + * see: nsIProgrammingLanguage.idl 1.41 + * 1.42 + * Should return null if no helper available for given language. 1.43 + */ 1.44 + nsISupports getHelperForLanguage(in uint32_t language); 1.45 + 1.46 + /** 1.47 + * A contract ID through which an instance of this class can be created 1.48 + * (or accessed as a service, if |flags & SINGLETON|), or null. 1.49 + */ 1.50 + readonly attribute string contractID; 1.51 + 1.52 + /** 1.53 + * A human readable string naming the class, or null. 1.54 + */ 1.55 + readonly attribute string classDescription; 1.56 + 1.57 + /** 1.58 + * A class ID through which an instance of this class can be created 1.59 + * (or accessed as a service, if |flags & SINGLETON|), or null. 1.60 + */ 1.61 + readonly attribute nsCIDPtr classID; 1.62 + 1.63 + /** 1.64 + * Return language type from list in nsIProgrammingLanguage 1.65 + */ 1.66 + 1.67 + readonly attribute uint32_t implementationLanguage; 1.68 + 1.69 + /** 1.70 + * Bitflags for 'flags' attribute. 1.71 + */ 1.72 + const uint32_t SINGLETON = 1 << 0; 1.73 + const uint32_t THREADSAFE = 1 << 1; 1.74 + const uint32_t MAIN_THREAD_ONLY = 1 << 2; 1.75 + const uint32_t DOM_OBJECT = 1 << 3; 1.76 + const uint32_t PLUGIN_OBJECT = 1 << 4; 1.77 + const uint32_t SINGLETON_CLASSINFO = 1 << 5; 1.78 + 1.79 + /** 1.80 + * 'flags' attribute bitflag: whether objects of this type implement 1.81 + * nsIContent. 1.82 + */ 1.83 + const uint32_t CONTENT_NODE = 1 << 6; 1.84 + 1.85 + // The high order bit is RESERVED for consumers of these flags. 1.86 + // No implementor of this interface should ever return flags 1.87 + // with this bit set. 1.88 + const uint32_t RESERVED = 1 << 31; 1.89 + 1.90 + 1.91 + readonly attribute uint32_t flags; 1.92 + 1.93 + /** 1.94 + * Also a class ID through which an instance of this class can be created 1.95 + * (or accessed as a service, if |flags & SINGLETON|). If the class does 1.96 + * not have a CID, it should return NS_ERROR_NOT_AVAILABLE. This attribute 1.97 + * exists so C++ callers can avoid allocating and freeing a CID, as would 1.98 + * happen if they used classID. 1.99 + */ 1.100 + [noscript] readonly attribute nsCID classIDNoAlloc; 1.101 + 1.102 +};