Coverage Report

Created: 2025-12-12 07:27

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/hermes/public/hermes/Public/Buffer.h
Line
Count
Source
1
/*
2
 * Copyright (c) Meta Platforms, Inc. and affiliates.
3
 *
4
 * This source code is licensed under the MIT license found in the
5
 * LICENSE file in the root directory of this source tree.
6
 */
7
8
#ifndef HERMES_PUBLIC_BUFFER_H
9
#define HERMES_PUBLIC_BUFFER_H
10
11
#include <hermes/Public/HermesExport.h>
12
13
#include <cstddef>
14
#include <cstdint>
15
16
namespace hermes {
17
18
/// A generic buffer interface.  E.g. for memmapped bytecode.
19
class HERMES_EXPORT Buffer {
20
 public:
21
309
  Buffer() : data_(nullptr), size_(0) {}
22
23
113
  Buffer(const uint8_t *data, size_t size) : data_(data), size_(size) {}
24
25
  virtual ~Buffer();
26
27
618
  const uint8_t *data() const {
28
618
    return data_;
29
618
  };
30
31
1.49k
  size_t size() const {
32
1.49k
    return size_;
33
1.49k
  }
34
35
 protected:
36
  const uint8_t *data_ = nullptr;
37
  size_t size_ = 0;
38
};
39
40
} // namespace hermes
41
42
#endif