LCOV - code coverage report
Current view: top level - i18npool/inc - breakiterator_unicode.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 7 7 100.0 %
Date: 2015-06-13 12:38:46 Functions: 2 2 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : #ifndef INCLUDED_I18NPOOL_INC_BREAKITERATOR_UNICODE_HXX
      20             : #define INCLUDED_I18NPOOL_INC_BREAKITERATOR_UNICODE_HXX
      21             : 
      22             : #include <breakiteratorImpl.hxx>
      23             : 
      24             : #include <unicode/brkiter.h>
      25             : 
      26             : namespace com { namespace sun { namespace star { namespace i18n {
      27             : 
      28             : #define LOAD_CHARACTER_BREAKITERATOR    0
      29             : #define LOAD_WORD_BREAKITERATOR         1
      30             : #define LOAD_SENTENCE_BREAKITERATOR     2
      31             : #define LOAD_LINE_BREAKITERATOR         3
      32             : 
      33             : 
      34             : //  class BreakIterator_Unicode
      35             : 
      36             : class BreakIterator_Unicode : public BreakIteratorImpl
      37             : {
      38             : public:
      39             :     BreakIterator_Unicode();
      40             :     virtual ~BreakIterator_Unicode();
      41             : 
      42             :     virtual sal_Int32 SAL_CALL previousCharacters( const OUString& Text, sal_Int32 nStartPos,
      43             :         const com::sun::star::lang::Locale& nLocale, sal_Int16 nCharacterIteratorMode, sal_Int32 nCount,
      44             :         sal_Int32& nDone ) throw(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      45             :     virtual sal_Int32 SAL_CALL nextCharacters( const OUString& Text, sal_Int32 nStartPos,
      46             :         const com::sun::star::lang::Locale& rLocale, sal_Int16 nCharacterIteratorMode, sal_Int32 nCount,
      47             :         sal_Int32& nDone ) throw(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      48             : 
      49             :     virtual Boundary SAL_CALL previousWord( const OUString& Text, sal_Int32 nStartPos,
      50             :         const com::sun::star::lang::Locale& nLocale, sal_Int16 WordType) throw(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      51             :     virtual Boundary SAL_CALL nextWord( const OUString& Text, sal_Int32 nStartPos,
      52             :         const com::sun::star::lang::Locale& nLocale, sal_Int16 WordType) throw(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      53             :     virtual Boundary SAL_CALL getWordBoundary( const OUString& Text, sal_Int32 nPos,
      54             :         const com::sun::star::lang::Locale& nLocale, sal_Int16 WordType, sal_Bool bDirection )
      55             :         throw(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      56             : 
      57             :     virtual sal_Int32 SAL_CALL beginOfSentence( const OUString& Text, sal_Int32 nStartPos,
      58             :         const com::sun::star::lang::Locale& nLocale ) throw(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      59             :     virtual sal_Int32 SAL_CALL endOfSentence( const OUString& Text, sal_Int32 nStartPos,
      60             :         const com::sun::star::lang::Locale& nLocale ) throw(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      61             : 
      62             :     virtual LineBreakResults SAL_CALL getLineBreak( const OUString& Text, sal_Int32 nStartPos,
      63             :         const com::sun::star::lang::Locale& nLocale, sal_Int32 nMinBreakPos,
      64             :         const LineBreakHyphenationOptions& hOptions, const LineBreakUserOptions& bOptions )
      65             :         throw(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      66             : 
      67             :     //XServiceInfo
      68             :     virtual OUString SAL_CALL getImplementationName() throw( com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
      69             :     virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName)
      70             :         throw( com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
      71             :     virtual com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames()
      72             :         throw( com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
      73             : 
      74             : protected:
      75             :     const sal_Char *cBreakIterator, *lineRule;
      76             :     Boundary result; // for word break iterator
      77             : 
      78             :     struct BI_Data
      79             :     {
      80             :         OUString aICUText;
      81             :         UText *ut;
      82             :         icu::BreakIterator *aBreakIterator;
      83             :         com::sun::star::lang::Locale maLocale;
      84             : 
      85       35602 :         BI_Data()
      86             :             : ut(NULL)
      87       35602 :             , aBreakIterator(NULL)
      88             :         {
      89       35602 :         }
      90       35392 :         ~BI_Data()
      91       35392 :         {
      92       35392 :             utext_close(ut);
      93       35392 :         }
      94             : 
      95             :     } character, sentence, line, *icuBI;
      96             :     BI_Data words[4]; // 4 is css::i18n::WordType enumeration size
      97             : 
      98             :     sal_Int16 aBreakType;
      99             : 
     100             :     void SAL_CALL loadICUBreakIterator(const com::sun::star::lang::Locale& rLocale,
     101             :         sal_Int16 rBreakType, sal_Int16 rWordType, const sal_Char* name, const OUString& rText) throw(com::sun::star::uno::RuntimeException);
     102             : };
     103             : 
     104             : } } } }
     105             : 
     106             : #endif
     107             : 
     108             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11