LCOV - code coverage report
Current view: top level - libreoffice/sc/source/core/tool - typedstrdata.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 44 0.0 %
Date: 2012-12-27 Functions: 0 13 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             :  * Version: MPL 1.1 / GPLv3+ / LGPLv3+
       4             :  *
       5             :  * The contents of this file are subject to the Mozilla Public License Version
       6             :  * 1.1 (the "License"); you may not use this file except in compliance with
       7             :  * the License or as specified alternatively below. You may obtain a copy of
       8             :  * the License at http://www.mozilla.org/MPL/
       9             :  *
      10             :  * Software distributed under the License is distributed on an "AS IS" basis,
      11             :  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
      12             :  * for the specific language governing rights and limitations under the
      13             :  * License.
      14             :  *
      15             :  * Major Contributor(s):
      16             :  *   Copyright (C) 2012 Kohei Yoshida <kohei.yoshida@suse.com>
      17             :  *
      18             :  * All Rights Reserved.
      19             :  *
      20             :  * For minor contributions see the git repository.
      21             :  *
      22             :  * Alternatively, the contents of this file may be used under the terms of
      23             :  * either the GNU General Public License Version 3 or later (the "GPLv3+"), or
      24             :  * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
      25             :  * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
      26             :  * instead of those above.
      27             :  */
      28             : 
      29             : #include "typedstrdata.hxx"
      30             : #include "global.hxx"
      31             : 
      32             : #include "unotools/transliterationwrapper.hxx"
      33             : 
      34           0 : bool ScTypedStrData::LessCaseSensitive::operator() (const ScTypedStrData& left, const ScTypedStrData& right) const
      35             : {
      36           0 :     if (left.meStrType != right.meStrType)
      37           0 :         return left.meStrType < right.meStrType;
      38             : 
      39           0 :     if (left.meStrType == Value)
      40           0 :         return left.mfValue < right.mfValue;
      41             : 
      42             :     return ScGlobal::GetCaseTransliteration()->compareString(
      43           0 :         left.maStrValue, right.maStrValue) < 0;
      44             : }
      45             : 
      46           0 : bool ScTypedStrData::LessCaseInsensitive::operator() (const ScTypedStrData& left, const ScTypedStrData& right) const
      47             : {
      48           0 :     if (left.meStrType != right.meStrType)
      49           0 :         return left.meStrType < right.meStrType;
      50             : 
      51           0 :     if (left.meStrType == Value)
      52           0 :         return left.mfValue < right.mfValue;
      53             : 
      54             :     return ScGlobal::GetpTransliteration()->compareString(
      55           0 :         left.maStrValue, right.maStrValue) < 0;
      56             : }
      57             : 
      58           0 : bool ScTypedStrData::EqualCaseSensitive::operator() (const ScTypedStrData& left, const ScTypedStrData& right) const
      59             : {
      60           0 :     if (left.meStrType != right.meStrType)
      61           0 :         return false;
      62             : 
      63           0 :     if (left.meStrType == Value && left.mfValue != right.mfValue)
      64           0 :         return false;
      65             : 
      66             :     return ScGlobal::GetCaseTransliteration()->compareString(
      67           0 :         left.maStrValue, right.maStrValue) == 0;
      68             : }
      69             : 
      70           0 : bool ScTypedStrData::EqualCaseInsensitive::operator() (const ScTypedStrData& left, const ScTypedStrData& right) const
      71             : {
      72           0 :     if (left.meStrType != right.meStrType)
      73           0 :         return false;
      74             : 
      75           0 :     if (left.meStrType == Value && left.mfValue != right.mfValue)
      76           0 :         return false;
      77             : 
      78             :     return ScGlobal::GetpTransliteration()->compareString(
      79           0 :         left.maStrValue, right.maStrValue) == 0;
      80             : }
      81             : 
      82           0 : bool ScTypedStrData::operator== (const ScTypedStrData& r) const
      83             : {
      84             :     // Case insensitive comparison by default.
      85             :     EqualCaseInsensitive aHdl;
      86           0 :     return aHdl(*this, r);
      87             : }
      88             : 
      89           0 : bool ScTypedStrData::operator< (const ScTypedStrData& r) const
      90             : {
      91             :     // Case insensitive comparison by default.
      92             :     LessCaseInsensitive aHdl;
      93           0 :     return aHdl(*this, r);
      94             : }
      95             : 
      96           0 : ScTypedStrData::ScTypedStrData(
      97             :     const rtl::OUString& rStr, double nVal, StringType nType ) :
      98             :     maStrValue(rStr),
      99             :     mfValue(nVal),
     100           0 :     meStrType(nType) {}
     101             : 
     102           0 : ScTypedStrData::ScTypedStrData( const ScTypedStrData& rCpy ) :
     103             :     maStrValue(rCpy.maStrValue),
     104             :     mfValue(rCpy.mfValue),
     105           0 :     meStrType(rCpy.meStrType) {}
     106             : 
     107           0 : bool ScTypedStrData::IsStrData() const
     108             : {
     109           0 :     return meStrType != Value;
     110             : }
     111             : 
     112           0 : const rtl::OUString& ScTypedStrData::GetString() const
     113             : {
     114           0 :     return maStrValue;
     115             : }
     116             : 
     117           0 : ScTypedStrData::StringType ScTypedStrData::GetStringType() const
     118             : {
     119           0 :     return meStrType;
     120             : }
     121             : 
     122           0 : FindTypedStrData::FindTypedStrData(const ScTypedStrData& rVal, bool bCaseSens) :
     123           0 :     maVal(rVal), mbCaseSens(bCaseSens) {}
     124             : 
     125           0 : bool FindTypedStrData::operator() (const ScTypedStrData& r) const
     126             : {
     127           0 :     if (mbCaseSens)
     128             :     {
     129             :         ScTypedStrData::EqualCaseSensitive aHdl;
     130           0 :         return aHdl(maVal, r);
     131             :     }
     132             :     else
     133             :     {
     134             :         ScTypedStrData::EqualCaseInsensitive aHdl;
     135           0 :         return aHdl(maVal, r);
     136             :     }
     137             : }
     138             : 
     139             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10