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