LibreOffice Module connectivity (master) 1
fcomp.hxx
Go to the documentation of this file.
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#pragma once
20
21#include <file/fcode.hxx>
22#include <utility>
23
24namespace connectivity
25{
26 class OSQLParseNode;
27 namespace file
28 {
29 class OCode;
30 class OOperand;
31 class OSQLAnalyzer;
32 typedef std::vector<std::unique_ptr<OCode>> OCodeList;
33
35 {
37 friend class OSQLAnalyzer;
38
40 css::uno::Reference< css::container::XNameAccess> m_orgColumns; // in filecurs this are the filecolumns
42 sal_Int32 m_nParamCounter;
43 public:
45
46 virtual ~OPredicateCompiler() override;
47
48 void dispose();
49
50 void start(connectivity::OSQLParseNode const * pSQLParseNode);
51 OOperand* execute(connectivity::OSQLParseNode const * pPredicateNode);
52
53 void Clean();
54 bool isClean() const {return m_aCodeList.empty();}
55 bool hasCode() const {return !isClean();}
56 void setOrigColumns(const css::uno::Reference< css::container::XNameAccess>& rCols) { m_orgColumns = rCols; }
57 const css::uno::Reference< css::container::XNameAccess>& getOrigColumns() const { return m_orgColumns; }
58 private:
61 void execute_COMPARE(connectivity::OSQLParseNode const * pPredicateNode);
64 void execute_LIKE(connectivity::OSQLParseNode const * pPredicateNode);
67 void execute_BETWEEN(connectivity::OSQLParseNode const * pPredicateNode);
70 void execute_ISNULL(connectivity::OSQLParseNode const * pPredicateNode);
76 void execute_Fold(OSQLParseNode const * pPredicateNode);
79 void executeFunction(OSQLParseNode const * pPredicateNode);
80 };
81
82
85 {
88
89 public:
91 virtual ~OPredicateInterpreter() override;
92
93 bool evaluate(OCodeList& rCodeList);
94 void evaluateSelection(OCodeList& rCodeList, ORowSetValueDecoratorRef const & _rVal);
95
96 bool start()
97 {
98 return evaluate(m_rCompiler->m_aCodeList);
99 }
100
102 {
103 evaluateSelection(m_rCompiler->m_aCodeList,_rVal);
104 }
105
106
107 };
108 }
109}
110
111/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
void execute_LIKE(connectivity::OSQLParseNode const *pPredicateNode)
Definition: fcomp.cxx:264
const css::uno::Reference< css::container::XNameAccess > & getOrigColumns() const
Definition: fcomp.hxx:57
void execute_COMPARE(connectivity::OSQLParseNode const *pPredicateNode)
Definition: fcomp.cxx:218
void execute_Fold(OSQLParseNode const *pPredicateNode)
Definition: fcomp.cxx:582
void execute_ISNULL(connectivity::OSQLParseNode const *pPredicateNode)
Definition: fcomp.cxx:389
void setOrigColumns(const css::uno::Reference< css::container::XNameAccess > &rCols)
Definition: fcomp.hxx:56
void start(connectivity::OSQLParseNode const *pSQLParseNode)
Definition: fcomp.cxx:62
void executeFunction(OSQLParseNode const *pPredicateNode)
Definition: fcomp.cxx:598
void execute_BETWEEN(connectivity::OSQLParseNode const *pPredicateNode)
Definition: fcomp.cxx:312
OOperand * execute_Operand(connectivity::OSQLParseNode const *pPredicateNode)
Definition: fcomp.cxx:407
OOperand * execute(connectivity::OSQLParseNode const *pPredicateNode)
Definition: fcomp.cxx:133
OPredicateCompiler(OSQLAnalyzer *pAnalyzer)
Definition: fcomp.cxx:44
css::uno::Reference< css::container::XNameAccess > m_orgColumns
Definition: fcomp.hxx:40
virtual ~OPredicateCompiler() override
Definition: fcomp.cxx:51
void evaluateSelection(OCodeList &rCodeList, ORowSetValueDecoratorRef const &_rVal)
Definition: fcomp.cxx:557
::rtl::Reference< OPredicateCompiler > m_rCompiler
Definition: fcomp.hxx:87
OPredicateInterpreter(::rtl::Reference< OPredicateCompiler > xComp)
Definition: fcomp.hxx:90
bool evaluate(OCodeList &rCodeList)
Definition: fcomp.cxx:531
void startSelection(ORowSetValueDecoratorRef const &_rVal)
Definition: fcomp.hxx:101
std::vector< std::unique_ptr< OCode > > OCodeList
Definition: fcomp.hxx:31
std::stack< OOperand * > OCodeStack
Definition: fcode.hxx:36