dart-sdk/runtime/bin/typed_data_utils.h
Ben Konyi 3ab7cf0590 Revert "[dart:io] Revert recent non-utf8 path handling"
This reverts commit 42bcdcd332.

Change-Id: I11fb7db2aac3b7dc15cb35a22fea38b31069cbc0
Reviewed-on: https://dart-review.googlesource.com/55502
Reviewed-by: Zach Anderson <zra@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2018-05-23 21:01:44 +00:00

46 lines
1.1 KiB
C++

// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
#ifndef RUNTIME_BIN_TYPED_DATA_UTILS_H_
#define RUNTIME_BIN_TYPED_DATA_UTILS_H_
#include "include/dart_api.h"
#include "platform/globals.h"
namespace dart {
namespace bin {
class TypedDataScope {
public:
explicit TypedDataScope(Dart_Handle data);
~TypedDataScope() { Release(); }
void Release();
const char* GetCString() const {
return reinterpret_cast<const char*>(data_);
}
const char* GetScopedCString() const;
void* data() const { return data_; }
intptr_t length() const { return length_; }
intptr_t size_in_bytes() const;
Dart_TypedData_Type type() const { return type_; }
private:
Dart_Handle data_handle_;
void* data_;
intptr_t length_;
Dart_TypedData_Type type_;
DISALLOW_ALLOCATION();
DISALLOW_IMPLICIT_CONSTRUCTORS(TypedDataScope);
};
} // namespace bin
} // namespace dart
#endif // RUNTIME_BIN_TYPED_DATA_UTILS_H_