LCOV - code coverage report
Current view: top level - sc/inc - queryentry.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 4 4 100.0 %
Date: 2015-06-13 12:38:46 Functions: 7 7 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 INCLUDED_SC_INC_QUERYENTRY_HXX
      21             : #define INCLUDED_SC_INC_QUERYENTRY_HXX
      22             : 
      23             : #include "address.hxx"
      24             : #include "global.hxx"
      25             : #include <svl/sharedstring.hxx>
      26             : 
      27             : #include <vector>
      28             : 
      29             : namespace utl {
      30             :     class SearchParam;
      31             :     class TextSearch;
      32             : }
      33             : 
      34             : /**
      35             :  * Each instance of this struct represents a single filtering criteria.
      36             :  */
      37             : struct SC_DLLPUBLIC ScQueryEntry
      38             : {
      39             :     enum QueryType { ByValue, ByString, ByDate, ByEmpty };
      40             : 
      41       48697 :     struct Item
      42             :     {
      43             :         QueryType     meType;
      44             :         double        mfVal;
      45             :         svl::SharedString maString;
      46             :         bool              mbMatchEmpty;
      47             : 
      48       10911 :         Item() : meType(ByValue), mfVal(0.0), mbMatchEmpty(false) {}
      49             : 
      50             :         bool operator== (const Item& r) const;
      51             :     };
      52             :     typedef std::vector<Item> QueryItemsType;
      53             : 
      54             :     bool            bDoQuery;
      55             :     SCCOLROW        nField;
      56             :     ScQueryOp       eOp;
      57             :     ScQueryConnect  eConnect;
      58             :     mutable utl::SearchParam* pSearchParam;       ///< if RegExp, not saved
      59             :     mutable utl::TextSearch*  pSearchText;        ///< if RegExp, not saved
      60             : 
      61             :     ScQueryEntry();
      62             :     ScQueryEntry(const ScQueryEntry& r);
      63             :     ~ScQueryEntry();
      64             : 
      65             :     /// creates pSearchParam and pSearchText if necessary, always RegExp!
      66             :     utl::TextSearch* GetSearchTextPtr( bool bCaseSens ) const;
      67             : 
      68          41 :     QueryItemsType& GetQueryItems() { return maQueryItems;}
      69        1090 :     const QueryItemsType& GetQueryItems() const { return maQueryItems;}
      70             :     void SetQueryByEmpty();
      71             :     bool IsQueryByEmpty() const;
      72             :     void SetQueryByNonEmpty();
      73             :     bool IsQueryByNonEmpty() const;
      74             :     const Item& GetQueryItem() const;
      75             :     Item& GetQueryItem();
      76             :     void            Clear();
      77             :     ScQueryEntry&   operator=( const ScQueryEntry& r );
      78             :     bool            operator==( const ScQueryEntry& r ) const;
      79             : 
      80             : private:
      81             :     /**
      82             :      * Stores all query items.  It must contain at least one item at all times
      83             :      * (for single equality match queries or comparative queries).  It may
      84             :      * contain multiple items for multi-equality match queries.
      85             :      */
      86             :     mutable QueryItemsType maQueryItems;
      87             : };
      88             : 
      89             : #endif
      90             : 
      91             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11