#ifndef V8_OBJECTS_JS_SEGMENTER_H_
#define V8_OBJECTS_JS_SEGMENTER_H_
#ifndef V8_INTL_SUPPORT
#error Internationalization is expected to be enabled.
#endif
#include <set>
#include <string>
#include "src/base/bit-field.h"
#include "src/execution/isolate.h"
#include "src/heap/factory.h"
#include "src/objects/managed.h"
#include "src/objects/objects.h"
#include "unicode/uversion.h"
#include "src/objects/object-macros.h"
namespace U_ICU_NAMESPACE {
class BreakIterator;
}
namespace v8 {
namespace internal {
#include "torque-generated/src/objects/js-segmenter-tq.inc"
class JSSegmenter : public TorqueGeneratedJSSegmenter<JSSegmenter, JSObject> {
public:
V8_WARN_UNUSED_RESULT static MaybeDirectHandle<JSSegmenter> New(
Isolate* isolate, DirectHandle<Map> map, DirectHandle<Object> locales,
DirectHandle<Object> options, const char* method_name);
V8_WARN_UNUSED_RESULT static DirectHandle<JSObject> ResolvedOptions(
Isolate* isolate, DirectHandle<JSSegmenter> segmenter_holder);
V8_EXPORT_PRIVATE static const std::set<std::string>& GetAvailableLocales();
Handle<String> GranularityAsString(Isolate* isolate) const;
DECL_ACCESSORS(icu_break_iterator, Tagged<Managed<icu::BreakIterator>>)
enum class Granularity {
GRAPHEME,
WORD,
SENTENCE
};
inline void set_granularity(Granularity granularity);
inline Granularity granularity() const;
Handle<String> static GetGranularityString(Isolate* isolate,
Granularity granularity);
DEFINE_TORQUE_GENERATED_JS_SEGMENTER_FLAGS()
static_assert(GranularityBits::is_valid(Granularity::GRAPHEME));
static_assert(GranularityBits::is_valid(Granularity::WORD));
static_assert(GranularityBits::is_valid(Granularity::SENTENCE));
DECL_PRINTER(JSSegmenter)
TQ_OBJECT_CONSTRUCTORS(JSSegmenter)
};
}
}
#include "src/objects/object-macros-undef.h"
#endif