GridGain C++
query_text.h
Go to the documentation of this file.
1 /*
2  * Copyright 2019 GridGain Systems, Inc. and Contributors.
3  *
4  * Licensed under the GridGain Community Edition License (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  * https://www.gridgain.com/products/software/community-edition/gridgain-community-edition-license
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 
22 #ifndef _IGNITE_CACHE_QUERY_QUERY_TEXT
23 #define _IGNITE_CACHE_QUERY_QUERY_TEXT
24 
25 #include <stdint.h>
26 #include <string>
27 
29 
30 namespace ignite
31 {
32  namespace cache
33  {
34  namespace query
35  {
39  class TextQuery
40  {
41  public:
48  TextQuery(const std::string& type, const std::string& text) :
49  type(type), text(text), pageSize(1024), loc(false)
50  {
51  // No-op.
52  }
53 
59  const std::string& GetType() const
60  {
61  return type;
62  }
63 
69  void SetType(const std::string& type)
70  {
71  this->type = type;
72  }
73 
79  const std::string& GetText() const
80  {
81  return text;
82  }
83 
89  void SetText(const std::string& text)
90  {
91  this->text = text;
92  }
93 
99  int32_t GetPageSize() const
100  {
101  return pageSize;
102  }
103 
109  void SetPageSize(int32_t pageSize)
110  {
111  this->pageSize = pageSize;
112  }
113 
119  bool IsLocal() const
120  {
121  return loc;
122  }
123 
131  void SetLocal(bool loc)
132  {
133  this->loc = loc;
134  }
135 
141  void Write(binary::BinaryRawWriter& writer) const
142  {
143  writer.WriteBool(loc);
144  writer.WriteString(text);
145  writer.WriteString(type);
146  writer.WriteInt32(pageSize);
147  }
148 
149  private:
151  std::string type;
152 
154  std::string text;
155 
157  int32_t pageSize;
158 
160  bool loc;
161  };
162  }
163  }
164 }
165 
166 #endif //_IGNITE_CACHE_QUERY_QUERY_TEXT
ignite
Ignite API.
Definition: cache.h:47
ignite::binary::BinaryRawWriter::WriteInt32
void WriteInt32(int32_t val)
Write 32-byte signed integer.
Definition: binary_raw_writer.cpp:71
ignite::cache::query::TextQuery::SetPageSize
void SetPageSize(int32_t pageSize)
Set page size.
Definition: query_text.h:109
ignite::cache::query::TextQuery::SetText
void SetText(const std::string &text)
Set text string.
Definition: query_text.h:89
ignite::binary::BinaryRawWriter
Binary raw writer.
Definition: binary_raw_writer.h:61
ignite::cache::query::TextQuery::GetText
const std::string & GetText() const
Get text string.
Definition: query_text.h:79
ignite::cache::query::TextQuery
Text query.
Definition: query_text.h:39
ignite::binary::BinaryRawWriter::WriteString
void WriteString(const char *val)
Write string.
Definition: binary_raw_writer.cpp:151
ignite::binary::BinaryRawWriter::WriteBool
void WriteBool(bool val)
Write bool.
Definition: binary_raw_writer.cpp:41
ignite::cache::query::TextQuery::GetType
const std::string & GetType() const
Get type name.
Definition: query_text.h:59
ignite::cache::query::TextQuery::IsLocal
bool IsLocal() const
Get local flag.
Definition: query_text.h:119
binary_raw_writer.h
ignite::cache::query::TextQuery::SetType
void SetType(const std::string &type)
Set type name.
Definition: query_text.h:69
ignite::cache::query::TextQuery::GetPageSize
int32_t GetPageSize() const
Get page size.
Definition: query_text.h:99
ignite::cache::query::TextQuery::Write
void Write(binary::BinaryRawWriter &writer) const
Write query info to the stream.
Definition: query_text.h:141
ignite::cache::query::TextQuery::TextQuery
TextQuery(const std::string &type, const std::string &text)
Constructor.
Definition: query_text.h:48
ignite::cache::query::TextQuery::SetLocal
void SetLocal(bool loc)
Set local flag.
Definition: query_text.h:131