LCOV - code coverage report
Current view: top level - obj-x86_64-pc-linux-gnu/dist/include - nsIAtom.h (source / functions) Hit Total Coverage
Test: output.info Lines: 33 33 100.0 %
Date: 2017-07-14 16:53:18 Functions: 15 15 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /*
       2             :  * DO NOT EDIT.  THIS FILE IS GENERATED FROM ../../../dist/idl/nsIAtom.idl
       3             :  */
       4             : 
       5             : #ifndef __gen_nsIAtom_h__
       6             : #define __gen_nsIAtom_h__
       7             : 
       8             : 
       9             : #ifndef __gen_nsISupports_h__
      10             : #include "nsISupports.h"
      11             : #endif
      12             : 
      13             : /* For IDL files that don't want to include root IDL files. */
      14             : #ifndef NS_NO_VTABLE
      15             : #define NS_NO_VTABLE
      16             : #endif
      17             : #include "nsStringGlue.h"
      18             : #include "nsCOMPtr.h"
      19             : #include "nsStringBuffer.h"
      20             : 
      21             : /* starting interface:    nsIAtom */
      22             : #define NS_IATOM_IID_STR "8b8c11d4-3ed5-4079-8974-73c7576cdb34"
      23             : 
      24             : #define NS_IATOM_IID \
      25             :   {0x8b8c11d4, 0x3ed5, 0x4079, \
      26             :     { 0x89, 0x74, 0x73, 0xc7, 0x57, 0x6c, 0xdb, 0x34 }}
      27             : 
      28       10867 : class nsIAtom : public nsISupports {
      29             :  public:
      30             : 
      31             :   NS_DECLARE_STATIC_IID_ACCESSOR(NS_IATOM_IID)
      32             : 
      33             :   /* [binaryname(ScriptableToString)] AString toString (); */
      34             :   NS_IMETHOD ScriptableToString(nsAString & _retval) = 0;
      35             : 
      36             :   /* [noscript] AUTF8String toUTF8String (); */
      37             :   NS_IMETHOD ToUTF8String(nsACString & _retval) = 0;
      38             : 
      39             :   /* [binaryname(ScriptableEquals)] boolean equals (in AString aString); */
      40             :   NS_IMETHOD ScriptableEquals(const nsAString & aString, bool *_retval) = 0;
      41             : 
      42             :   /* [noscript,notxpcom] size_t SizeOfIncludingThis (in MallocSizeOf aMallocSizeOf); */
      43             :   NS_IMETHOD_(size_t) SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) = 0;
      44             : 
      45             :    // note these are NOT virtual so they won't muck with the vtable!
      46       41140 :   inline bool Equals(char16ptr_t aString, uint32_t aLength) const
      47             :   {
      48       76752 :     return mLength == aLength &&
      49       76752 :            memcmp(mString, aString, mLength * sizeof(char16_t)) == 0;
      50             :   }
      51       12015 :   inline bool Equals(const nsAString& aString) const {
      52       12015 :     return Equals(aString.BeginReading(), aString.Length());
      53             :   }
      54       24652 :   inline bool IsStaticAtom() const {
      55       24652 :     return mIsStatic;
      56             :   }
      57       20729 :   inline char16ptr_t GetUTF16String() const {
      58       20729 :     return mString;
      59             :   }
      60       15957 :   inline uint32_t GetLength() const {
      61       15957 :     return mLength;
      62             :   }
      63        2313 :   inline void ToString(nsAString& aBuf) const {
      64             :     // See the comment on |mString|'s declaration.
      65        2313 :     nsStringBuffer::FromData(mString)->ToString(mLength, aBuf);
      66        2313 :   }
      67         950 :   inline nsStringBuffer* GetStringBuffer() const {
      68             :     // See the comment on |mString|'s declaration.
      69         950 :     return nsStringBuffer::FromData(mString);
      70             :   }
      71             :   /**
      72             :    * A hashcode that is better distributed than the actual atom
      73             :    * pointer, for use in situations that need a well-distributed
      74             :    * hashcode.
      75             :    */
      76       19918 :   inline uint32_t hash() const {
      77       19918 :     return mHash;
      78             :   }
      79             : protected:
      80             :   uint32_t mLength:31;
      81             :   uint32_t mIsStatic:1;
      82             :   uint32_t mHash;
      83             :   /**
      84             :    * WARNING! There is an invisible constraint on |mString|: the chars it
      85             :    * points to must belong to an nsStringBuffer. This is so that the
      86             :    * nsStringBuffer::FromData() calls above are valid.
      87             :    */
      88             :   char16_t* mString;
      89             : };
      90             : 
      91             :   NS_DEFINE_STATIC_IID_ACCESSOR(nsIAtom, NS_IATOM_IID)
      92             : 
      93             : /* Use this macro when declaring classes that implement this interface. */
      94             : #define NS_DECL_NSIATOM \
      95             :   NS_IMETHOD ScriptableToString(nsAString & _retval) override; \
      96             :   NS_IMETHOD ToUTF8String(nsACString & _retval) override; \
      97             :   NS_IMETHOD ScriptableEquals(const nsAString & aString, bool *_retval) override; \
      98             :   NS_IMETHOD_(size_t) SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) override; \
      99             : 
     100             : /* Use this macro when declaring the members of this interface when the
     101             :    class doesn't implement the interface. This is useful for forwarding. */
     102             : #define NS_DECL_NON_VIRTUAL_NSIATOM \
     103             :   nsresult ScriptableToString(nsAString & _retval); \
     104             :   nsresult ToUTF8String(nsACString & _retval); \
     105             :   nsresult ScriptableEquals(const nsAString & aString, bool *_retval); \
     106             :   nsresult_(size_t) SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf); \
     107             : 
     108             : /* Use this macro to declare functions that forward the behavior of this interface to another object. */
     109             : #define NS_FORWARD_NSIATOM(_to) \
     110             :   NS_IMETHOD ScriptableToString(nsAString & _retval) override { return _to ScriptableToString(_retval); } \
     111             :   NS_IMETHOD ToUTF8String(nsACString & _retval) override { return _to ToUTF8String(_retval); } \
     112             :   NS_IMETHOD ScriptableEquals(const nsAString & aString, bool *_retval) override { return _to ScriptableEquals(aString, _retval); } \
     113             :   NS_IMETHOD_(size_t) SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) override { return _to SizeOfIncludingThis(aMallocSizeOf); } \
     114             : 
     115             : /* Use this macro to declare functions that forward the behavior of this interface to another object in a safe way. */
     116             : #define NS_FORWARD_SAFE_NSIATOM(_to) \
     117             :   NS_IMETHOD ScriptableToString(nsAString & _retval) override { return !_to ? NS_ERROR_NULL_POINTER : _to->ScriptableToString(_retval); } \
     118             :   NS_IMETHOD ToUTF8String(nsACString & _retval) override { return !_to ? NS_ERROR_NULL_POINTER : _to->ToUTF8String(_retval); } \
     119             :   NS_IMETHOD ScriptableEquals(const nsAString & aString, bool *_retval) override { return !_to ? NS_ERROR_NULL_POINTER : _to->ScriptableEquals(aString, _retval); } \
     120             :   NS_IMETHOD_(size_t) SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) override; \
     121             : 
     122             : #if 0
     123             : /* Use the code below as a template for the implementation class for this interface. */
     124             : 
     125             : /* Header file */
     126             : class nsAtom : public nsIAtom
     127             : {
     128             : public:
     129             :   NS_DECL_ISUPPORTS
     130             :   NS_DECL_NSIATOM
     131             : 
     132             :   nsAtom();
     133             : 
     134             : private:
     135             :   ~nsAtom();
     136             : 
     137             : protected:
     138             :   /* additional members */
     139             : };
     140             : 
     141             : /* Implementation file */
     142             : NS_IMPL_ISUPPORTS(nsAtom, nsIAtom)
     143             : 
     144             : nsAtom::nsAtom()
     145             : {
     146             :   /* member initializers and constructor code */
     147             : }
     148             : 
     149             : nsAtom::~nsAtom()
     150             : {
     151             :   /* destructor code */
     152             : }
     153             : 
     154             : /* [binaryname(ScriptableToString)] AString toString (); */
     155             : NS_IMETHODIMP nsAtom::ScriptableToString(nsAString & _retval)
     156             : {
     157             :     return NS_ERROR_NOT_IMPLEMENTED;
     158             : }
     159             : 
     160             : /* [noscript] AUTF8String toUTF8String (); */
     161             : NS_IMETHODIMP nsAtom::ToUTF8String(nsACString & _retval)
     162             : {
     163             :     return NS_ERROR_NOT_IMPLEMENTED;
     164             : }
     165             : 
     166             : /* [binaryname(ScriptableEquals)] boolean equals (in AString aString); */
     167             : NS_IMETHODIMP nsAtom::ScriptableEquals(const nsAString & aString, bool *_retval)
     168             : {
     169             :     return NS_ERROR_NOT_IMPLEMENTED;
     170             : }
     171             : 
     172             : /* [noscript,notxpcom] size_t SizeOfIncludingThis (in MallocSizeOf aMallocSizeOf); */
     173             : NS_IMETHODIMP_(size_t) nsAtom::SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf)
     174             : {
     175             :     return NS_ERROR_NOT_IMPLEMENTED;
     176             : }
     177             : 
     178             : /* End of implementation class template. */
     179             : #endif
     180             : 
     181             : /*
     182             :  * The four forms of NS_Atomize (for use with |nsCOMPtr<nsIAtom>|) return the
     183             :  * atom for the string given. At any given time there will always be one atom
     184             :  * representing a given string. Atoms are intended to make string comparison
     185             :  * cheaper by simplifying it to pointer equality. A pointer to the atom that
     186             :  * does not own a reference is not guaranteed to be valid.
     187             :  */
     188             : /**
     189             :  * Find an atom that matches the given UTF-8 string.
     190             :  * The string is assumed to be zero terminated.  Never returns null.
     191             :  */
     192             : extern already_AddRefed<nsIAtom> NS_Atomize(const char* aUTF8String);
     193             : /**
     194             :  * Find an atom that matches the given UTF-8 string.  Never returns null.
     195             :  */
     196             : extern already_AddRefed<nsIAtom> NS_Atomize(const nsACString& aUTF8String);
     197             : /**
     198             :  * Find an atom that matches the given UTF-16 string.
     199             :  * The string is assumed to be zero terminated.  Never returns null.
     200             :  */
     201             : extern already_AddRefed<nsIAtom> NS_Atomize(const char16_t* aUTF16String);
     202             : /**
     203             :  * Find an atom that matches the given UTF-16 string.  Never returns null.
     204             :  */
     205             : extern already_AddRefed<nsIAtom> NS_Atomize(const nsAString& aUTF16String);
     206             : /**
     207             :  * An optimized version of the method above for the main thread.
     208             :  */
     209             : extern already_AddRefed<nsIAtom> NS_AtomizeMainThread(const nsAString& aUTF16String);
     210             : /**
     211             :  * Return a count of the total number of atoms currently
     212             :  * alive in the system.
     213             :  */
     214             : extern nsrefcnt NS_GetNumberOfAtoms(void);
     215             : /**
     216             :  * Return a pointer for a static atom for the string or null if there's 
     217             :  * no static atom for this string.
     218             :  */
     219             : extern nsIAtom* NS_GetStaticAtom(const nsAString& aUTF16String);
     220             : /**
     221             :  * Seal the static atom table
     222             :  */
     223             : extern void NS_SealStaticAtomTable();
     224           3 : class nsAtomString : public nsString
     225             : {
     226             : public:
     227           3 :   explicit nsAtomString(const nsIAtom* aAtom)
     228           3 :   {
     229           3 :     aAtom->ToString(*this);
     230           3 :   }
     231             : };
     232          21 : class nsAtomCString : public nsCString
     233             : {
     234             : public:
     235          21 :   explicit nsAtomCString(nsIAtom* aAtom)
     236          21 :   {
     237          21 :     aAtom->ToUTF8String(*this);
     238          21 :   }
     239             : };
     240       12056 : class nsDependentAtomString : public nsDependentString
     241             : {
     242             : public:
     243       12056 :   explicit nsDependentAtomString(const nsIAtom* aAtom)
     244       12056 :     : nsDependentString(aAtom->GetUTF16String(), aAtom->GetLength())
     245             :   {
     246       12056 :   }
     247             : };
     248             : 
     249             : #endif /* __gen_nsIAtom_h__ */

Generated by: LCOV version 1.13