tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

mozEnglishWordUtils.h (1251B)


      1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
      2 /* This Source Code Form is subject to the terms of the Mozilla Public
      3 * License, v. 2.0. If a copy of the MPL was not distributed with this
      4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
      5 
      6 #ifndef mozEnglishWordUtils_h__
      7 #define mozEnglishWordUtils_h__
      8 
      9 #include "nsCOMPtr.h"
     10 #include "nsString.h"
     11 
     12 #include "mozITXTToHTMLConv.h"
     13 #include "nsCycleCollectionParticipant.h"
     14 
     15 class mozEnglishWordUtils final {
     16 public:
     17  NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(mozEnglishWordUtils)
     18  NS_DECL_CYCLE_COLLECTION_NATIVE_CLASS(mozEnglishWordUtils)
     19 
     20  mozEnglishWordUtils();
     21 
     22  /**
     23   * Given a unicode string and an offset, find the beginning and end of the
     24   * next word. Return false, begin and end are -1 if there are no words
     25   * remaining in the string. This should really be folded into the
     26   * Line/WordBreaker.
     27   */
     28  bool FindNextWord(const nsAString& aWord, uint32_t offset, int32_t* begin,
     29                    int32_t* end);
     30 
     31 protected:
     32  virtual ~mozEnglishWordUtils();
     33 
     34  static bool ucIsAlpha(char16_t aChar);
     35 
     36  nsCOMPtr<mozITXTToHTMLConv>
     37      mURLDetector;  // used to detect urls so the spell checker can skip them.
     38 };
     39 
     40 #endif