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/. */
6 #ifndef nsHyphenator_h__
7 #define nsHyphenator_h__
9 #include "base/shared_memory.h"
10 #include "mozilla/UniquePtr.h"
11 #include "mozilla/Variant.h"
22 class DefaultDelete
<const HyphDic
> {
24 void operator()(const HyphDic
* ptr
) const;
28 class DefaultDelete
<const CompiledData
> {
30 void operator()(const CompiledData
* ptr
) const;
32 } // namespace mozilla
36 nsHyphenator(nsIURI
* aURI
, bool aHyphenateCapitalized
);
38 NS_INLINE_DECL_REFCOUNTING(nsHyphenator
)
42 nsresult
Hyphenate(const nsAString
& aText
, nsTArray
<bool>& aHyphens
);
44 void CloneHandle(base::SharedMemoryHandle
* aOutHandle
, uint32_t* aOutSize
);
47 ~nsHyphenator() = default;
49 void HyphenateWord(const nsAString
& aString
, uint32_t aStart
, uint32_t aLimit
,
50 nsTArray
<bool>& aHyphens
);
52 mozilla::Variant
<const void*, // raw pointer to uncompressed omnijar data
53 mozilla::UniquePtr
<base::SharedMemory
>, // shmem block
54 mozilla::UniquePtr
<const HyphDic
> // loaded by mapped_hyph
57 uint32_t mDictSize
; // size of mDict data (not used if type is HyphDic)
58 bool mHyphenateCapitalized
;
61 #endif // nsHyphenator_h__