This repository has been archived on 2022-03-12. You can view files and clone it, but cannot push or open issues or pull requests.

41 lines
740 B
C
Raw Normal View History

2021-04-02 02:24:13 +03:00
/*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
#ifndef HERMES_PUBLIC_BUFFER_H
#define HERMES_PUBLIC_BUFFER_H
#include <cstddef>
#include <cstdint>
namespace hermes {
/// A generic buffer interface. E.g. for memmapped bytecode.
class Buffer {
public:
Buffer() : data_(nullptr), size_(0) {}
Buffer(const uint8_t *data, size_t size) : data_(data), size_(size) {}
virtual ~Buffer() {}
const uint8_t *data() const {
return data_;
};
size_t size() const {
return size_;
}
protected:
const uint8_t *data_ = nullptr;
size_t size_ = 0;
};
} // namespace hermes
#endif