1 /*
2   Copyright (c) DataStax, Inc.
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 #ifndef DATASTAX_INTERNAL_ROW_HPP
18 #define DATASTAX_INTERNAL_ROW_HPP
19 
20 #include "decoder.hpp"
21 #include "external.hpp"
22 #include "string_ref.hpp"
23 #include "value.hpp"
24 
25 namespace datastax { namespace internal { namespace core {
26 
27 class ResultResponse;
28 
29 class Row {
30 public:
Row()31   Row()
32       : result_(NULL) {}
33 
Row(const ResultResponse * result)34   Row(const ResultResponse* result)
35       : result_(result) {}
36 
37   OutputValueVec values;
38 
39   const Value* get_by_name(const StringRef& name) const;
40 
41   bool get_string_by_name(const StringRef& name, String* out) const;
42 
43   bool get_uuid_by_name(const StringRef& name, CassUuid* out) const;
44 
result() const45   const ResultResponse* result() const { return result_; }
46 
set_result(ResultResponse * result)47   void set_result(ResultResponse* result) { result_ = result; }
48 
49 private:
50   const ResultResponse* result_;
51 };
52 
53 bool decode_row(Decoder& decoder, const ResultResponse* result, OutputValueVec& output);
54 
55 }}} // namespace datastax::internal::core
56 
57 EXTERNAL_TYPE(datastax::internal::core::Row, CassRow)
58 
59 #endif
60