Bug 1710182 [wpt PR 28911] - [GridNG] Update test expectations of legacy grid failure...
[gecko.git] / intl / lwbrk / WordBreaker.h
blob57cb4b18b784a02663cd414fefe7ad02fa095ff0
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 #ifndef mozilla_intl_WordBreaker_h__
6 #define mozilla_intl_WordBreaker_h__
8 #include "nscore.h"
9 #include "nsISupports.h"
11 #define NS_WORDBREAKER_NEED_MORE_TEXT -1
13 namespace mozilla {
14 namespace intl {
16 typedef struct {
17 uint32_t mBegin;
18 uint32_t mEnd;
19 } WordRange;
21 enum WordBreakClass : uint8_t {
22 kWbClassSpace = 0,
23 kWbClassAlphaLetter,
24 kWbClassPunct,
25 kWbClassHanLetter,
26 kWbClassKatakanaLetter,
27 kWbClassHiraganaLetter,
28 kWbClassHWKatakanaLetter,
29 kWbClassScriptioContinua
32 class WordBreaker {
33 public:
34 NS_INLINE_DECL_REFCOUNTING(WordBreaker)
36 static already_AddRefed<WordBreaker> Create();
38 bool BreakInBetween(const char16_t* aText1, uint32_t aTextLen1,
39 const char16_t* aText2, uint32_t aTextLen2);
40 WordRange FindWord(const char16_t* aText1, uint32_t aTextLen1,
41 uint32_t aOffset);
42 int32_t NextWord(const char16_t* aText, uint32_t aLen, uint32_t aPos);
44 static WordBreakClass GetClass(char16_t aChar);
46 private:
47 ~WordBreaker() = default;
50 } // namespace intl
51 } // namespace mozilla
53 #endif /* mozilla_intl_WordBreaker_h__ */