parser/htmlparser/public/nsIParserService.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/parser/htmlparser/public/nsIParserService.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,98 @@
     1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.8 +
     1.9 +#ifndef nsIParserService_h__
    1.10 +#define nsIParserService_h__
    1.11 +
    1.12 +#include "nsISupports.h"
    1.13 +#include "nsString.h"
    1.14 +#include "nsHTMLTags.h"
    1.15 +
    1.16 +class nsIParser;
    1.17 +
    1.18 +#define NS_PARSERSERVICE_CONTRACTID "@mozilla.org/parser/parser-service;1"
    1.19 +
    1.20 +// {90a92e37-abd6-441b-9b39-4064d98e1ede}
    1.21 +#define NS_IPARSERSERVICE_IID \
    1.22 +{ 0x90a92e37, 0xabd6, 0x441b, { 0x9b, 0x39, 0x40, 0x64, 0xd9, 0x8e, 0x1e, 0xde } }
    1.23 +
    1.24 +class nsIParserService : public nsISupports {
    1.25 + public:
    1.26 +  NS_DECLARE_STATIC_IID_ACCESSOR(NS_IPARSERSERVICE_IID)
    1.27 +
    1.28 +  /**
    1.29 +   * Looks up the nsHTMLTag enum value corresponding to the tag in aAtom. The
    1.30 +   * lookup happens case insensitively.
    1.31 +   *
    1.32 +   * @param aAtom The tag to look up.
    1.33 +   *
    1.34 +   * @return int32_t The nsHTMLTag enum value corresponding to the tag in aAtom
    1.35 +   *                 or eHTMLTag_userdefined if the tag does not correspond to
    1.36 +   *                 any of the tag nsHTMLTag enum values.
    1.37 +   */
    1.38 +  virtual int32_t HTMLAtomTagToId(nsIAtom* aAtom) const = 0;
    1.39 +
    1.40 +  /**
    1.41 +   * Looks up the nsHTMLTag enum value corresponding to the tag in aAtom.
    1.42 +   *
    1.43 +   * @param aAtom The tag to look up.
    1.44 +   *
    1.45 +   * @return int32_t The nsHTMLTag enum value corresponding to the tag in aAtom
    1.46 +   *                 or eHTMLTag_userdefined if the tag does not correspond to
    1.47 +   *                 any of the tag nsHTMLTag enum values.
    1.48 +   */
    1.49 +  virtual int32_t HTMLCaseSensitiveAtomTagToId(nsIAtom* aAtom) const = 0;
    1.50 +
    1.51 +  /**
    1.52 +   * Looks up the nsHTMLTag enum value corresponding to the tag in aTag. The
    1.53 +   * lookup happens case insensitively.
    1.54 +   *
    1.55 +   * @param aTag The tag to look up.
    1.56 +   *
    1.57 +   * @return int32_t The nsHTMLTag enum value corresponding to the tag in aTag
    1.58 +   *                 or eHTMLTag_userdefined if the tag does not correspond to
    1.59 +   *                 any of the tag nsHTMLTag enum values.
    1.60 +   */
    1.61 +  virtual int32_t HTMLStringTagToId(const nsAString& aTag) const = 0;
    1.62 +
    1.63 +  /**
    1.64 +   * Gets the tag corresponding to the nsHTMLTag enum value in aId. The
    1.65 +   * returned tag will be in lowercase.
    1.66 +   *
    1.67 +   * @param aId The nsHTMLTag enum value to get the tag for.
    1.68 +   *
    1.69 +   * @return const char16_t* The tag corresponding to the nsHTMLTag enum
    1.70 +   *                          value, or nullptr if the enum value doesn't
    1.71 +   *                          correspond to a tag (eHTMLTag_unknown,
    1.72 +   *                          eHTMLTag_userdefined, eHTMLTag_text, ...).
    1.73 +   */
    1.74 +  virtual const char16_t *HTMLIdToStringTag(int32_t aId) const = 0;
    1.75 +
    1.76 +  /**
    1.77 +   * Gets the tag corresponding to the nsHTMLTag enum value in aId. The
    1.78 +   * returned tag will be in lowercase.
    1.79 +   *
    1.80 +   * @param aId The nsHTMLTag enum value to get the tag for.
    1.81 +   *
    1.82 +   * @return nsIAtom* The tag corresponding to the nsHTMLTag enum value, or
    1.83 +   *                  nullptr if the enum value doesn't correspond to a tag
    1.84 +   *                  (eHTMLTag_unknown, eHTMLTag_userdefined, eHTMLTag_text,
    1.85 +   *                  ...).
    1.86 +   */
    1.87 +  virtual nsIAtom *HTMLIdToAtomTag(int32_t aId) const = 0;
    1.88 +  
    1.89 +  NS_IMETHOD HTMLConvertEntityToUnicode(const nsAString& aEntity, 
    1.90 +                                        int32_t* aUnicode) const = 0;
    1.91 +
    1.92 +  NS_IMETHOD HTMLConvertUnicodeToEntity(int32_t aUnicode,
    1.93 +                                        nsCString& aEntity) const = 0;
    1.94 +
    1.95 +  NS_IMETHOD IsContainer(int32_t aId, bool& aIsContainer) const = 0;
    1.96 +  NS_IMETHOD IsBlock(int32_t aId, bool& aIsBlock) const = 0;
    1.97 +};
    1.98 +
    1.99 +NS_DEFINE_STATIC_IID_ACCESSOR(nsIParserService, NS_IPARSERSERVICE_IID)
   1.100 +
   1.101 +#endif // nsIParserService_h__

mercurial