LCOV - code coverage report
Current view: top level - include/connectivity - predicateinput.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 1 1 100.0 %
Date: 2015-06-13 12:38:46 Functions: 1 1 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_CONNECTIVITY_PREDICATEINPUT_HXX
      21             : #define INCLUDED_CONNECTIVITY_PREDICATEINPUT_HXX
      22             : 
      23             : #include <com/sun/star/beans/XPropertySet.hpp>
      24             : #include <com/sun/star/uno/XComponentContext.hpp>
      25             : #include <com/sun/star/sdbc/XConnection.hpp>
      26             : #include <com/sun/star/util/XNumberFormatter.hpp>
      27             : #include <com/sun/star/i18n/XLocaleData4.hpp>
      28             : #include <connectivity/sqlparse.hxx>
      29             : #include <connectivity/dbtoolsdllapi.hxx>
      30             : #include <com/sun/star/uno/Any.hxx>
      31             : 
      32             : 
      33             : namespace dbtools
      34             : {
      35             : 
      36             : 
      37             : 
      38             :     //= OPredicateInputController
      39             : 
      40             :     /** A class which allows input of an SQL predicate for a row set column
      41             :         into a edit field.
      42             :     */
      43           4 :     class OOO_DLLPUBLIC_DBTOOLS OPredicateInputController
      44             :     {
      45             :     private:
      46             :         ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >
      47             :                 m_xConnection;
      48             :         ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >
      49             :                 m_xFormatter;
      50             :         ::com::sun::star::uno::Reference< ::com::sun::star::i18n::XLocaleData4 >
      51             :                 m_xLocaleData;
      52             : 
      53             :         ::connectivity::OSQLParser
      54             :                 m_aParser;
      55             : 
      56             :     public:
      57             :         OPredicateInputController(
      58             :             const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext,
      59             :             const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxConnection,
      60             :             const ::connectivity::IParseContext* _pParseContext = NULL
      61             :         );
      62             : 
      63             :         /** transforms a "raw" predicate value (usually obtained from a user input) into a valid predicate for the given column
      64             :         @param _rPredicateValue
      65             :             The text to normalize.
      66             :         @param _rxField
      67             :             The field for which the text should be a predicate value.
      68             :         @param _pErrorMessage
      69             :             If not <NULL/>, and a parsing error occurs, the error message will be copied to the string the argument
      70             :             points to.
      71             :         */
      72             :         bool        normalizePredicateString(
      73             :             OUString& _rPredicateValue,
      74             :             const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxField,
      75             :             OUString* _pErrorMessage = NULL
      76             :         ) const;
      77             : 
      78             :         /** get the value of the predicate, as a string to be used in a WHERE clause
      79             :         @param _rPredicateValue
      80             :             the value which has been normalized using normalizePredicateString
      81             :         @param _rxField
      82             :             is the field for which a predicate is to be entered
      83             :         @param _pErrorMessage
      84             :             If not <NULL/>, and a parsing error occurs, the error message will be copied to the string the argument
      85             :             points to.
      86             :         @see normalizePredicateString
      87             :         */
      88             :         OUString getPredicateValueStr(
      89             :             const OUString& _rPredicateValue,
      90             :             const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & _rxField,
      91             :             OUString* _pErrorMessage = NULL
      92             :         ) const;
      93             : 
      94             :         OUString getPredicateValueStr(
      95             :             const OUString& _sField
      96             :             , const OUString& _rPredicateValue
      97             :             , OUString* _pErrorMessage = NULL) const;
      98             : 
      99             :         /** get the value of the predicate, either as an empty or as a string
     100             :         @param _rPredicateValue
     101             :             the value which has been normalized using normalizePredicateString
     102             :         @param _rxField
     103             :             is the field for which a predicate is to be entered
     104             :         @param _pErrorMessage
     105             :             If not <NULL/>, and a parsing error occurs, the error message will be copied to the string the argument
     106             :             points to.
     107             :         @see normalizePredicateString
     108             :         */
     109             :         ::com::sun::star::uno::Any getPredicateValue(
     110             :             const OUString& _rPredicateValue,
     111             :             const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & _rxField,
     112             :             OUString* _pErrorMessage = NULL
     113             :         ) const;
     114             : 
     115             :     private:
     116             :         ::connectivity::OSQLParseNode* implPredicateTree(
     117             :             OUString& _rErrorMessage,
     118             :             const OUString& _rStatement,
     119             :             const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & _rxField
     120             :         ) const;
     121             : 
     122             :         bool getSeparatorChars(
     123             :             const ::com::sun::star::lang::Locale& _rLocale,
     124             :             sal_Unicode& _rDecSep,
     125             :             sal_Unicode& _rThdSep
     126             :         ) const;
     127             : 
     128             :         ::com::sun::star::uno::Any implParseNode(::connectivity::OSQLParseNode* pParseNode, bool _bForStatementUse) const;
     129             :     };
     130             : 
     131             : 
     132             : }   // namespace dbtools
     133             : 
     134             : 
     135             : #endif // INCLUDED_CONNECTIVITY_PREDICATEINPUT_HXX
     136             : 
     137             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11