• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /macosx-10.10/WebCore-7600.1.25/platform/text/icu/

Lines Matching refs:text

60 static inline UTextProviderContext textUTF16ContextAwareGetCurrentContext(const UText* text)
62 if (!text->chunkContents)
64 return text->chunkContents == text->p ? UTextProviderContext::PrimaryContext : UTextProviderContext::PriorContext;
67 static void textUTF16ContextAwareMoveInPrimaryContext(UText* text, int64_t nativeIndex, int64_t nativeLength, UBool forward)
69 ASSERT(text->chunkContents == text->p);
70 ASSERT_UNUSED(forward, forward ? nativeIndex >= text->b : nativeIndex > text->b);
72 text->chunkNativeStart = text->b;
73 text->chunkNativeLimit = nativeLength;
74 int64_t length = text->chunkNativeLimit - text->chunkNativeStart;
77 text->chunkLength = length < std::numeric_limits<int32_t>::max() ? static_cast<int32_t>(length) : 0;
78 text->nativeIndexingLimit = text->chunkLength;
79 int64_t offset = nativeIndex - text->chunkNativeStart;
82 text->chunkOffset = std::min(offset < std::numeric_limits<int32_t>::max() ? static_cast<int32_t>(offset) : 0, text->chunkLength);
85 static void textUTF16ContextAwareSwitchToPrimaryContext(UText* text, int64_t nativeIndex, int64_t nativeLength, UBool forward)
87 ASSERT(!text->chunkContents || text->chunkContents == text->q);
88 text->chunkContents = static_cast<const UChar*>(text->p);
89 textUTF16ContextAwareMoveInPrimaryContext(text, nativeIndex, nativeLength, forward);
92 static void textUTF16ContextAwareMoveInPriorContext(UText* text, int64_t nativeIndex, int64_t nativeLength, UBool forward)
94 ASSERT(text->chunkContents == text->q);
95 ASSERT(forward ? nativeIndex < text->b : nativeIndex <= text->b);
98 text->chunkNativeStart = 0;
99 text->chunkNativeLimit = text->b;
100 text->chunkLength = text->b;
101 text->nativeIndexingLimit = text->chunkLength;
102 int64_t offset = nativeIndex - text->chunkNativeStart;
105 text->chunkOffset = std::min(offset < std::numeric_limits<int32_t>::max() ? static_cast<int32_t>(offset) : 0, text->chunkLength);
108 static void textUTF16ContextAwareSwitchToPriorContext(UText* text, int64_t nativeIndex, int64_t nativeLength, UBool forward)
110 ASSERT(!text->chunkContents || text->chunkContents == text->p);
111 text->chunkContents = static_cast<const UChar*>(text->q);
112 textUTF16ContextAwareMoveInPriorContext(text, nativeIndex, nativeLength, forward);
120 static inline int64_t uTextUTF16ContextAwareNativeLength(UText* text)
122 return text->a + text->b;
125 static UBool uTextUTF16ContextAwareAccess(UText* text, int64_t nativeIndex, UBool forward)
127 if (!text->context)
129 int64_t nativeLength = uTextUTF16ContextAwareNativeLength(text);
131 if (uTextAccessInChunkOrOutOfRange(text, nativeIndex, nativeLength, forward, isAccessible))
134 UTextProviderContext currentContext = textUTF16ContextAwareGetCurrentContext(text);
135 UTextProviderContext newContext = uTextProviderContext(text, nativeIndex, forward);
139 textUTF16ContextAwareMoveInPrimaryContext(text, nativeIndex, nativeLength, forward);
141 textUTF16ContextAwareMoveInPriorContext(text, nativeIndex, nativeLength, forward);
143 textUTF16ContextAwareSwitchToPrimaryContext(text, nativeIndex, nativeLength, forward);
146 textUTF16ContextAwareSwitchToPriorContext(text, nativeIndex, nativeLength, forward);
153 // In the present context, this text provider is used only with ICU functions
160 static void uTextUTF16ContextAwareClose(UText* text)
162 text->context = nullptr;
165 UText* openUTF16ContextAwareUTextProvider(UText* text, const UChar* string, unsigned length, const UChar* priorContext, int priorContextLength, UErrorCode* status)
173 text = utext_setup(text, 0, status);
175 ASSERT(!text);
179 initializeContextAwareUTextProvider(text, &textUTF16ContextAwareFuncs, string, length, priorContext, priorContextLength);
180 return text;