SourceForge.net Logo
Result.hpp
Go to the documentation of this file.
1/*
2 * Copyright (c) 2001, 2008,
3 * DecisionSoft Limited. All rights reserved.
4 * Copyright (c) 2004, 2015 Oracle and/or its affiliates. All rights reserved.
5 *
6 *
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
10 *
11 * http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 */
19
20#ifndef _RESULT_HPP
21#define _RESULT_HPP
22
23#include <string>
24#include <xercesc/util/XercesDefs.hpp>
25
26#include <xqilla/framework/XQillaExport.hpp>
27#include <xqilla/items/Item.hpp>
29#include <xqilla/runtime/EmptyResult.hpp>
30
31class Sequence;
32class SequenceType;
33class DynamicContext;
34class StaticType;
35
37class XQILLA_API Result
38{
39public:
40 Result(const Item::Ptr &item);
41 Result(const Sequence &seq);
43 Result(const Result &o);
46
48 ResultImpl *operator->();
49
51 const ResultImpl *operator->() const;
52
54 ResultImpl *get();
55
57 const ResultImpl *get() const;
58
60 bool isNull() const;
61
62 EmptyResult* getEmpty() const;
63
64private:
65 ResultImpl *_impl;
66
67 static EmptyResult _empty;
68};
69
70inline bool Result::isNull() const
71{
72 return _impl == 0;
73}
74
76{
77 if(_impl) return _impl;
78 return getEmpty();
79}
80
81inline const ResultImpl *Result::get() const
82{
83 if(_impl) return _impl;
84 return getEmpty();
85}
86
88{
89 return get();
90}
91
92inline const ResultImpl *Result::operator->() const
93{
94 return get();
95}
96
97#endif
The execution time dynamic context interface.
Definition: DynamicContext.hpp:39
A lazily evaluated query result.
Definition: ResultImpl.hpp:34
A scoped pointer wrapper for the lazily evaluated query result.
Definition: Result.hpp:38
Result(ResultImpl *impl)
Result(const Item::Ptr &item)
bool isNull() const
Returns true if the underlying pointer is null.
Definition: Result.hpp:70
ResultImpl * operator->()
Returns the underlying ResultImpl object.
Definition: Result.hpp:87
Result & operator=(const Result &o)
ResultImpl * get()
Returns the underlying ResultImpl object.
Definition: Result.hpp:75
Result(const Result &o)
Result(const Sequence &seq)
EmptyResult * getEmpty() const
An eagerly evaluated result of a query execution.
Definition: Sequence.hpp:40
Class that represents the static type of an expression.
Definition: StaticType.hpp:33