Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(39)

Side by Side Diff: mojo/public/cpp/bindings/string_data_view.h

Issue 2165233003: Mojo C++ bindings: provide data view for all object types. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef MOJO_PUBLIC_CPP_BINDINGS_STRING_DATA_VIEW_H_
6 #define MOJO_PUBLIC_CPP_BINDINGS_STRING_DATA_VIEW_H_
7
8 #include "mojo/public/cpp/bindings/lib/array_internal.h"
9 #include "mojo/public/cpp/bindings/lib/serialization_context.h"
10
11 namespace mojo {
12
13 // Access to the contents of a serialized string.
14 class StringDataView {
15 public:
16 StringDataView() {}
17
18 StringDataView(internal::String_Data* data,
19 internal::SerializationContext* context)
20 : data_(data) {}
21
22 bool is_null() const { return !data_; }
23
24 const char* storage() const { return data_->storage(); }
25
26 size_t size() const { return data_->size(); }
27
28 private:
29 internal::String_Data* data_ = nullptr;
30 };
31
32 } // namespace mojo
33
34 #endif // MOJO_PUBLIC_CPP_BINDINGS_STRING_DATA_VIEW_H_
OLDNEW
« no previous file with comments | « mojo/public/cpp/bindings/native_struct_data_view.h ('k') | mojo/public/cpp/bindings/string_traits.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698