6#error Internationalization is expected to be enabled. 
   22#include "unicode/brkiter.h" 
   34  std::vector<std::string> requested_locales =
 
   38  const char* service = 
"Intl.Segmenter";
 
   58                          requested_locales, matcher, {});
 
   66      isolate->factory()->NewStringFromAsciiChecked(
r.locale.c_str());
 
   71      isolate, options, 
"granularity", service,
 
   72      {
"grapheme", 
"word", 
"sentence"},
 
   78  icu::Locale icu_locale = 
r.icu_locale;
 
   79  DCHECK(!icu_locale.isBogus());
 
   81  UErrorCode status = U_ZERO_ERROR;
 
   82  std::unique_ptr<icu::BreakIterator> icu_break_iterator;
 
   84  switch (granularity_enum) {
 
   86      icu_break_iterator.reset(
 
   87          icu::BreakIterator::createCharacterInstance(icu_locale, status));
 
   90      icu_break_iterator.reset(
 
   91          icu::BreakIterator::createWordInstance(icu_locale, status));
 
   94      icu_break_iterator.reset(
 
   95          icu::BreakIterator::createSentenceInstance(icu_locale, status));
 
  104                                        std::move(icu_break_iterator));
 
  110  segmenter->set_flags(0);
 
  113  segmenter->set_locale(*locale_str);
 
  116  segmenter->set_granularity(granularity_enum);
 
  118  segmenter->set_icu_break_iterator(*managed_break_iterator);
 
 
  127  Factory* factory = isolate->factory();
 
  147                        segmenter->GranularityAsString(isolate), 
NONE);
 
 
  158  Factory* factory = isolate->factory();
 
  161      return factory->grapheme_string();
 
  163      return factory->word_string();
 
  165      return factory->sentence_string();
 
 
V8_INLINE T FromJust() const &
V8_INLINE bool IsNothing() const
Handle< JSObject > NewJSObject(DirectHandle< JSFunction > constructor, AllocationType allocation=AllocationType::kYoung, NewJSObjectType=NewJSObjectType::kNoAPIWrapper)
static const std::set< std::string > & GetAvailableLocales()
static Maybe< std::vector< std::string > > CanonicalizeLocaleList(Isolate *isolate, DirectHandle< Object > locales, bool only_return_one_result=false)
static Maybe< ResolvedLocale > ResolveLocale(Isolate *isolate, const std::set< std::string > &available_locales, const std::vector< std::string > &requested_locales, MatcherOption options, const std::set< std::string > &relevant_extension_keys)
static V8_WARN_UNUSED_RESULT Maybe< MatcherOption > GetLocaleMatcher(Isolate *isolate, DirectHandle< JSReceiver > options, const char *method_name)
static V8_EXPORT_PRIVATE void AddProperty(Isolate *isolate, DirectHandle< JSObject > object, DirectHandle< Name > name, DirectHandle< Object > value, PropertyAttributes attributes)
static Handle< String > GetGranularityString(Isolate *isolate, Granularity granularity)
static V8_WARN_UNUSED_RESULT MaybeDirectHandle< JSSegmenter > New(Isolate *isolate, DirectHandle< Map > map, DirectHandle< Object > locales, DirectHandle< Object > options)
static V8_EXPORT_PRIVATE const std::set< std::string > & GetAvailableLocales()
Granularity granularity() const
Handle< String > GranularityAsString(Isolate *isolate) const
static V8_WARN_UNUSED_RESULT DirectHandle< JSObject > ResolvedOptions(Isolate *isolate, DirectHandle< JSSegmenter > segmenter_holder)
static DirectHandle< Managed< CppType > > From(Isolate *isolate, size_t estimated_size, std::shared_ptr< CppType > shared_ptr, AllocationType allocation_type=AllocationType::kYoung)
#define ASSIGN_RETURN_ON_EXCEPTION(isolate, dst, call)
#define THROW_NEW_ERROR(isolate, call)
#define MAYBE_RETURN(call, value)
DirectHandle< JSReceiver > options
ZoneVector< RpoNumber > & result
MaybeDirectHandle< JSReceiver > GetOptionsObject(Isolate *isolate, DirectHandle< Object > options, const char *method_name)
Maybe< bool > GetStringOption(Isolate *isolate, DirectHandle< JSReceiver > options, const char *property, const std::vector< const char * > &values, const char *method_name, std::unique_ptr< char[]> *result)
Tagged< To > Cast(Tagged< From > value, const v8::SourceLocation &loc=INIT_SOURCE_LOCATION_IN_DEBUG)
#define DCHECK_NOT_NULL(val)
#define DCHECK(condition)