LCOV - code coverage report
Current view: top level - sw/inc - ToxWhitespaceStripper.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 2 2 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             : 
      10             : 
      11             : #ifndef TOXWHITESPACESTRIPPER_HXX_
      12             : #define TOXWHITESPACESTRIPPER_HXX_
      13             : 
      14             : #include "rtl/ustring.hxx"
      15             : #include <swdllapi.h>
      16             : #include <vector>
      17             : 
      18             : namespace sw {
      19             : 
      20             : /** This class helps to remove unwanted whitespaces from a string to use in a Tox.
      21             :  *
      22             :  * The new string will have
      23             :  * - Newlines changed to spaces
      24             :  * - Consecutive spaces merged
      25             :  * - Trailing spaces removed
      26             :  *
      27             :  * It also allows to find the corresponding new positions of the input string in the stripped string.
      28             :  * This is important for attributes which might have to be imported, e.g., it helps to answer the question:
      29             :  * The 3rd character of the input string is subscript, which character in the output string is that?
      30             :  *
      31             :  * @note One leading whitespace is preserved.
      32             :  */
      33          16 : class ToxWhitespaceStripper
      34             : {
      35             : public:
      36             :     ToxWhitespaceStripper(const OUString&);
      37             : 
      38             :     sal_Int32
      39             :     GetPositionInStrippedString(sal_Int32 pos) const;
      40             : 
      41             :     OUString
      42          10 :     GetStrippedString() const { return mStripped;}
      43             : 
      44             : private:
      45             :     OUString mStripped;
      46             :     std::vector<sal_Int32> mNewPositions;
      47             : };
      48             : 
      49             : } // end namespace sw
      50             : 
      51             : 
      52             : 
      53             : #endif /* TOXWHITESPACESTRIPPER_HXX_ */

Generated by: LCOV version 1.11