LCOV - code coverage report
Current view: top level - sc/source/core/tool - typedstrdata.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 54 0.0 %
Date: 2014-04-14 Functions: 0 14 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             : 
      10             : #include "typedstrdata.hxx"
      11             : #include "global.hxx"
      12             : 
      13             : #include "unotools/collatorwrapper.hxx"
      14             : 
      15           0 : bool ScTypedStrData::LessCaseSensitive::operator() (const ScTypedStrData& left, const ScTypedStrData& right) const
      16             : {
      17           0 :     if (left.meStrType != right.meStrType)
      18           0 :         return left.meStrType < right.meStrType;
      19             : 
      20           0 :     if (left.meStrType == Value)
      21           0 :         return left.mfValue < right.mfValue;
      22             : 
      23           0 :     if (left.mbIsDate != right.mbIsDate)
      24           0 :         return left.mbIsDate < right.mbIsDate;
      25             : 
      26             :     return ScGlobal::GetCaseCollator()->compareString(
      27           0 :         left.maStrValue, right.maStrValue) < 0;
      28             : }
      29             : 
      30           0 : bool ScTypedStrData::LessCaseInsensitive::operator() (const ScTypedStrData& left, const ScTypedStrData& right) const
      31             : {
      32           0 :     if (left.meStrType != right.meStrType)
      33           0 :         return left.meStrType < right.meStrType;
      34             : 
      35           0 :     if (left.meStrType == Value)
      36           0 :         return left.mfValue < right.mfValue;
      37             : 
      38           0 :     if (left.mbIsDate != right.mbIsDate)
      39           0 :         return left.mbIsDate < right.mbIsDate;
      40             : 
      41             :     return ScGlobal::GetCollator()->compareString(
      42           0 :         left.maStrValue, right.maStrValue) < 0;
      43             : }
      44             : 
      45           0 : bool ScTypedStrData::EqualCaseSensitive::operator() (const ScTypedStrData& left, const ScTypedStrData& right) const
      46             : {
      47           0 :     if (left.meStrType != right.meStrType)
      48           0 :         return false;
      49             : 
      50           0 :     if (left.meStrType == Value && left.mfValue != right.mfValue)
      51           0 :         return false;
      52             : 
      53           0 :     if (left.mbIsDate != right.mbIsDate )
      54           0 :         return false;
      55             : 
      56             :     return ScGlobal::GetCaseCollator()->compareString(
      57           0 :         left.maStrValue, right.maStrValue) == 0;
      58             : }
      59             : 
      60           0 : bool ScTypedStrData::EqualCaseInsensitive::operator() (const ScTypedStrData& left, const ScTypedStrData& right) const
      61             : {
      62           0 :     if (left.meStrType != right.meStrType)
      63           0 :         return false;
      64             : 
      65           0 :     if (left.meStrType == Value && left.mfValue != right.mfValue)
      66           0 :         return false;
      67             : 
      68           0 :     if (left.mbIsDate != right.mbIsDate )
      69           0 :         return false;
      70             : 
      71             :     return ScGlobal::GetCollator()->compareString(
      72           0 :         left.maStrValue, right.maStrValue) == 0;
      73             : }
      74             : 
      75           0 : bool ScTypedStrData::operator== (const ScTypedStrData& r) const
      76             : {
      77             :     // Case insensitive comparison by default.
      78             :     EqualCaseInsensitive aHdl;
      79           0 :     return aHdl(*this, r);
      80             : }
      81             : 
      82           0 : bool ScTypedStrData::operator< (const ScTypedStrData& r) const
      83             : {
      84             :     // Case insensitive comparison by default.
      85             :     LessCaseInsensitive aHdl;
      86           0 :     return aHdl(*this, r);
      87             : }
      88             : 
      89           0 : ScTypedStrData::ScTypedStrData(
      90             :     const OUString& rStr, double nVal, StringType nType, bool bDate ) :
      91             :     maStrValue(rStr),
      92             :     mfValue(nVal),
      93             :     meStrType(nType),
      94           0 :     mbIsDate( bDate ) {}
      95             : 
      96           0 : ScTypedStrData::ScTypedStrData( const ScTypedStrData& rCpy ) :
      97             :     maStrValue(rCpy.maStrValue),
      98             :     mfValue(rCpy.mfValue),
      99             :     meStrType(rCpy.meStrType),
     100           0 :     mbIsDate( rCpy.mbIsDate ) {}
     101             : 
     102           0 : bool ScTypedStrData::IsStrData() const
     103             : {
     104           0 :     return meStrType != Value;
     105             : }
     106             : 
     107           0 : bool ScTypedStrData::IsDate() const
     108             : {
     109           0 :     return mbIsDate;
     110             : }
     111             : 
     112           0 : const 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