Hazelcast C++ Client
Hazelcast C++ Client Library
query.cpp
1 /*
2  * Copyright (c) 2008-2022, Hazelcast, Inc. All Rights Reserved.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #include "hazelcast/client/query/predicates.h"
18 #include "hazelcast/client/spi/ClientContext.h"
19 
20 namespace hazelcast {
21 namespace client {
22 namespace query {
23 const char* const query_constants::KEY_ATTRIBUTE_NAME = "__key";
24 const char* const query_constants::THIS_ATTRIBUTE_NAME = "this";
25 
26 base_predicate::base_predicate(hazelcast_client& client)
27  : out_stream(spi::ClientContext(client)
28  .get_serialization_service()
29  .new_output_stream())
30 {}
31 
32 named_predicate::named_predicate(hazelcast_client& client,
33  const std::string& attribute_name)
34  : base_predicate(client)
35 {
36  out_stream.write(attribute_name);
37 }
38 
39 instance_of_predicate::instance_of_predicate(hazelcast_client& client,
40  const std::string& java_class_name)
41  : base_predicate(client)
42 {
43  out_stream.write(java_class_name);
44 }
45 
46 sql_predicate::sql_predicate(hazelcast_client& client, const std::string& sql)
47  : base_predicate(client)
48 {
49  out_stream.write(sql);
50 }
51 
53  const std::string& attribute,
54  const std::string& expression)
55  : named_predicate(client, attribute)
56 {
57  out_stream.write(expression);
58 }
59 
61  const std::string& attribute,
62  const std::string& expression)
63  : named_predicate(client, attribute)
64 {
65  out_stream.write(expression);
66 }
67 
69  const std::string& attribute,
70  const std::string& expression)
71  : named_predicate(client, attribute)
72 {
73  out_stream.write(expression);
74 }
75 
76 true_predicate::true_predicate(hazelcast_client& client)
77  : base_predicate(client)
78 {}
79 
80 false_predicate::false_predicate(hazelcast_client& client)
81  : base_predicate(client)
82 {}
83 } // namespace query
84 } // namespace client
85 } // namespace hazelcast
ilike_predicate(hazelcast_client &client, const std::string &attribute, const std::string &expression)
Definition: query.cpp:60
like_predicate(hazelcast_client &client, const std::string &attribute, const std::string &expression)
Definition: query.cpp:52
regex_predicate(hazelcast_client &client, const std::string &attribute, const std::string &expression)
Definition: query.cpp:68
sql_predicate(hazelcast_client &client, const std::string &sql)
Definition: query.cpp:46