1 /* 2 * Copyright (c) 2024 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef INTERFACES_CJ_INCLUDE_I18N_BREAKITERATOR_IMPL_H_ 17 #define INTERFACES_CJ_INCLUDE_I18N_BREAKITERATOR_IMPL_H_ 18 19 #include <string> 20 #include <vector> 21 #include "i18n_break_iterator.h" 22 #include "ffi_remote_data.h" 23 24 namespace OHOS { 25 namespace Global { 26 namespace I18n { 27 class CBreakIterator : public OHOS::FFI::FFIData { 28 DECL_TYPE(CBreakIterator, FFIData) 29 public: 30 explicit CBreakIterator(std::string localeTag); 31 ~CBreakIterator() = default; 32 void SetLineBreakText(const char* text); 33 std::string GetLineBreakText(); 34 int32_t current(); 35 int32_t first(); 36 int32_t last(); 37 int32_t next(int32_t number); 38 int32_t previous(); 39 int32_t following(int32_t offset); 40 bool IsBoundary(int32_t offset); 41 private: 42 std::unique_ptr<I18nBreakIterator> brkiter_ = nullptr; 43 }; 44 45 } // namespace I18n 46 } // namespace Global 47 } // namespace OHOS 48 49 #endif // INTERFACES_CJ_INCLUDE_I18N_BREAKITERATOR_IMPL_H_ 50