LCOV - code coverage report
Current view: top level - dbaccess/source/ui/misc - charsets.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 0 49 0.0 %
Date: 2015-06-13 12:38:46 Functions: 0 15 0.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             : #include "charsets.hxx"
      21             : #include <osl/diagnose.h>
      22             : #include "dbu_misc.hrc"
      23             : #include <rtl/tencinfo.h>
      24             : #include <tools/rcid.h>
      25             : #include "moduledbu.hxx"
      26             : 
      27             : namespace dbaui
      28             : {
      29             :     using namespace ::dbtools;
      30             : 
      31             :     // OCharsetDisplay
      32           0 :     OCharsetDisplay::OCharsetDisplay()
      33             :         :OCharsetMap()
      34             :         ,SvxTextEncodingTable()
      35           0 :         , m_aSystemDisplayName(ModuleRes( STR_RSC_CHARSETS ))
      36             :     {
      37           0 :     }
      38             : 
      39           0 :     bool OCharsetDisplay::approveEncoding( const rtl_TextEncoding _eEncoding, const rtl_TextEncodingInfo& _rInfo ) const
      40             :     {
      41           0 :         if ( !OCharsetMap::approveEncoding( _eEncoding, _rInfo ) )
      42           0 :             return false;
      43             : 
      44           0 :         if ( RTL_TEXTENCODING_DONTKNOW == _eEncoding )
      45           0 :             return true;
      46             : 
      47           0 :         return !GetTextString(_eEncoding).isEmpty();
      48             :     }
      49             : 
      50           0 :     OCharsetDisplay::const_iterator OCharsetDisplay::begin() const
      51             :     {
      52           0 :         return const_iterator( this, OCharsetMap::begin() );
      53             :     }
      54             : 
      55           0 :     OCharsetDisplay::const_iterator OCharsetDisplay::end() const
      56             :     {
      57           0 :         return const_iterator( this, OCharsetMap::end() );
      58             :     }
      59             : 
      60           0 :     OCharsetDisplay::const_iterator OCharsetDisplay::findEncoding(const rtl_TextEncoding _eEncoding) const
      61             :     {
      62           0 :         OCharsetMap::const_iterator aBaseIter = OCharsetMap::find(_eEncoding);
      63           0 :         return const_iterator( this, aBaseIter );
      64             :     }
      65             : 
      66           0 :     OCharsetDisplay::const_iterator OCharsetDisplay::findIanaName(const OUString& _rIanaName) const
      67             :     {
      68           0 :         OCharsetMap::const_iterator aBaseIter = OCharsetMap::find(_rIanaName, OCharsetMap::IANA());
      69           0 :         return const_iterator( this, aBaseIter );
      70             :     }
      71             : 
      72           0 :     OCharsetDisplay::const_iterator OCharsetDisplay::findDisplayName(const OUString& _rDisplayName) const
      73             :     {
      74           0 :         rtl_TextEncoding eEncoding = RTL_TEXTENCODING_DONTKNOW;
      75           0 :         if ( _rDisplayName != m_aSystemDisplayName )
      76             :         {
      77           0 :             eEncoding = GetTextEncoding( _rDisplayName );
      78             :             OSL_ENSURE( RTL_TEXTENCODING_DONTKNOW != eEncoding,
      79             :                 "OCharsetDisplay::find: non-empty display name, but DONTKNOW!" );
      80             :         }
      81           0 :         return const_iterator( this, OCharsetMap::find( eEncoding ) );
      82             :     }
      83             : 
      84             :     // CharsetDisplayDerefHelper
      85           0 :     CharsetDisplayDerefHelper::CharsetDisplayDerefHelper(const CharsetDisplayDerefHelper& _rSource)
      86             :         :CharsetDisplayDerefHelper_Base(_rSource)
      87           0 :         ,m_sDisplayName(_rSource.m_sDisplayName)
      88             :     {
      89           0 :     }
      90             : 
      91           0 :     CharsetDisplayDerefHelper::CharsetDisplayDerefHelper(const CharsetDisplayDerefHelper_Base& _rBase, const OUString& _rDisplayName)
      92             :         :CharsetDisplayDerefHelper_Base(_rBase)
      93           0 :         ,m_sDisplayName(_rDisplayName)
      94             :     {
      95             :         OSL_ENSURE( !m_sDisplayName.isEmpty(), "CharsetDisplayDerefHelper::CharsetDisplayDerefHelper: invalid display name!" );
      96           0 :     }
      97             : 
      98             :     // OCharsetDisplay::ExtendedCharsetIterator
      99           0 :     OCharsetDisplay::ExtendedCharsetIterator::ExtendedCharsetIterator( const OCharsetDisplay* _pContainer, const base_iterator& _rPosition )
     100             :         :m_pContainer(_pContainer)
     101           0 :         ,m_aPosition(_rPosition)
     102             :     {
     103             :         OSL_ENSURE(m_pContainer, "OCharsetDisplay::ExtendedCharsetIterator::ExtendedCharsetIterator : invalid container!");
     104           0 :     }
     105             : 
     106           0 :     OCharsetDisplay::ExtendedCharsetIterator::ExtendedCharsetIterator(const ExtendedCharsetIterator& _rSource)
     107             :         :m_pContainer( _rSource.m_pContainer )
     108           0 :         ,m_aPosition( _rSource.m_aPosition )
     109             :     {
     110           0 :     }
     111             : 
     112           0 :     CharsetDisplayDerefHelper OCharsetDisplay::ExtendedCharsetIterator::operator*() const
     113             :     {
     114             :         OSL_ENSURE( m_aPosition != m_pContainer->OCharsetDisplay_Base::end(), "OCharsetDisplay::ExtendedCharsetIterator::operator* : invalid position!");
     115             : 
     116           0 :         rtl_TextEncoding eEncoding = (*m_aPosition).getEncoding();
     117             :         return CharsetDisplayDerefHelper(
     118             :             *m_aPosition,
     119             :             RTL_TEXTENCODING_DONTKNOW == eEncoding ? m_pContainer->m_aSystemDisplayName : m_pContainer->GetTextString( eEncoding )
     120           0 :         );
     121             :     }
     122             : 
     123           0 :     const OCharsetDisplay::ExtendedCharsetIterator& OCharsetDisplay::ExtendedCharsetIterator::operator++()
     124             :     {
     125             :         OSL_ENSURE( m_aPosition != m_pContainer->OCharsetDisplay_Base::end(), "OCharsetDisplay::ExtendedCharsetIterator::operator++ : invalid position!");
     126           0 :         if ( m_aPosition != m_pContainer->OCharsetDisplay_Base::end() )
     127           0 :             ++m_aPosition;
     128           0 :         return *this;
     129             :     }
     130             : 
     131           0 :     const OCharsetDisplay::ExtendedCharsetIterator& OCharsetDisplay::ExtendedCharsetIterator::operator--()
     132             :     {
     133             :         OSL_ENSURE( m_aPosition != m_pContainer->OCharsetDisplay_Base::begin(), "OCharsetDisplay::ExtendedCharsetIterator::operator-- : invalid position!");
     134           0 :         if ( m_aPosition != m_pContainer->OCharsetDisplay_Base::begin() )
     135           0 :             --m_aPosition;
     136           0 :         return *this;
     137             :     }
     138             : 
     139           0 :     bool operator==(const OCharsetDisplay::ExtendedCharsetIterator& lhs, const OCharsetDisplay::ExtendedCharsetIterator& rhs)
     140             :     {
     141           0 :         return (lhs.m_pContainer == rhs.m_pContainer) && (lhs.m_aPosition == rhs.m_aPosition);
     142             :     }
     143             : 
     144             : }   // namespace dbaui
     145             : 
     146             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11