LCOV - code coverage report
Current view: top level - libreoffice/oox/inc/oox/helper - textinputstream.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 1 1 100.0 %
Date: 2012-12-27 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             : 
      20             : #ifndef OOX_HELPER_TEXTINPUTSTREAM_HXX
      21             : #define OOX_HELPER_TEXTINPUTSTREAM_HXX
      22             : 
      23             : #include <com/sun/star/uno/Reference.hxx>
      24             : #include <rtl/ustring.hxx>
      25             : 
      26             : namespace com { namespace sun { namespace star {
      27             :     namespace io { class XInputStream; }
      28             :     namespace io { class XTextInputStream; }
      29             :     namespace uno { class XComponentContext; }
      30             : } } }
      31             : 
      32             : namespace oox {
      33             : 
      34             : class BinaryInputStream;
      35             : 
      36             : // ============================================================================
      37             : 
      38             : class TextInputStream
      39             : {
      40             : public:
      41             :     explicit            TextInputStream(
      42             :                             const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext,
      43             :                             const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rxInStrm,
      44             :                             rtl_TextEncoding eTextEnc );
      45             : 
      46             :     explicit            TextInputStream(
      47             :                             const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext,
      48             :                             BinaryInputStream& rInStrm,
      49             :                             rtl_TextEncoding eTextEnc );
      50             : 
      51             :                         ~TextInputStream();
      52             : 
      53             :     /** Returns true, if no more text is available in the stream.
      54             :      */
      55             :     bool                isEof() const;
      56             : 
      57             :     /** Reads a text line from the stream.
      58             : 
      59             :         If the last line in the stream is not terminated with line-end
      60             :         character(s), the stream will immediately go into EOF state and return
      61             :         the text line. Otherwise, if the last character in the stream is a
      62             :         line-end character, the next call to this function will turn the stream
      63             :         into EOF state and return an empty string.
      64             :      */
      65             :     ::rtl::OUString     readLine();
      66             : 
      67             :     /** Reads a text portion from the stream until the specified character is
      68             :         found.
      69             : 
      70             :         If the end of the stream is not terminated with the specified
      71             :         character, the stream will immediately go into EOF state and return the
      72             :         remaining text portion. Otherwise, if the last character in the stream
      73             :         is the specified character (and caller specifies to read and return it,
      74             :         see parameter bIncludeChar), the next call to this function will turn
      75             :         the stream into EOF state and return an empty string.
      76             : 
      77             :         @param cChar
      78             :             The separator character to be read to.
      79             : 
      80             :         @param bIncludeChar
      81             :             True = if found, the specified character will be read from stream
      82             :                 and included in the returned string.
      83             :             False = the specified character will neither be read from the
      84             :                 stream nor included in the returned string, but will be
      85             :                 returned as first character in the next call of this function
      86             :                 or readLine().
      87             :      */
      88             :     ::rtl::OUString     readToChar( sal_Unicode cChar, bool bIncludeChar );
      89             : 
      90             :     // ------------------------------------------------------------------------
      91             : 
      92             :     /** Creates a UNO text input stream object from the passed UNO input stream.
      93             :      */
      94             :     static ::com::sun::star::uno::Reference< ::com::sun::star::io::XTextInputStream >
      95             :                         createXTextInputStream(
      96             :                             const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext,
      97             :                             const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rxInStrm,
      98             :                             rtl_TextEncoding eTextEnc );
      99             : 
     100             :     // ------------------------------------------------------------------------
     101             : private:
     102             :     void                init(
     103             :                             const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext,
     104             :                             const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rxInStrm,
     105             :                             rtl_TextEncoding eTextEnc );
     106             : 
     107             :     /** Adds the pending character in front of the passed string, if existing. */
     108             :     ::rtl::OUString     createFinalString( const ::rtl::OUString& rString );
     109             : 
     110             : private:
     111             :     ::com::sun::star::uno::Reference< ::com::sun::star::io::XTextInputStream >
     112             :                         mxTextStrm;
     113             :     sal_Unicode         mcPendingChar;
     114             : };
     115             : 
     116             : // ============================================================================
     117             : 
     118          51 : } // namespace oox
     119             : 
     120             : #endif
     121             : 
     122             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10