lib-ruby-parser (C++ bindings)  4.0.1+ruby-3.1.1
C++ bindings for lib-ruby-parser library
bytes.hpp
Go to the documentation of this file.
1 #ifndef LIB_RUBY_PARSER_BYTES_HPP
2 #define LIB_RUBY_PARSER_BYTES_HPP
3 
4 #include <cstddef>
5 #include <cstdint>
6 
7 namespace lib_ruby_parser
8 {
11  class ByteList
12  {
13  public:
14  char *ptr;
15  size_t capacity;
16  size_t len;
17 
18  ByteList() = delete;
19  ByteList(char *ptr, size_t len, size_t capacity);
20 
21  ByteList(const ByteList &) = delete;
22  ByteList &operator=(ByteList const &) = delete;
23 
24  ByteList(ByteList &&);
26 
27  ~ByteList();
28 
31  static ByteList Owned(char *s, size_t len);
32 
34  static ByteList Copied(const char *s, size_t len);
35  };
36 
37  extern "C"
38  {
39  struct ByteListBlob
40  {
41  uint8_t bytes[sizeof(ByteList)];
42  };
43  }
44 
46  class Bytes
47  {
48  public:
50 
51  Bytes() = delete;
52  explicit Bytes(ByteList raw);
53 
54  Bytes(const Bytes &) = delete;
55  Bytes &operator=(Bytes const &) = delete;
56 
57  Bytes(Bytes &&) = default;
58  Bytes &operator=(Bytes &&) = default;
59  };
60 } // namespace lib_ruby_parser
61 
62 #endif // LIB_RUBY_PARSER_BYTES_HPP
lib_ruby_parser::ByteList::Copied
static ByteList Copied(const char *s, size_t len)
Constructs a ByteList by copying given pointer.
lib_ruby_parser::ByteList::ptr
char * ptr
Definition: bytes.hpp:14
lib_ruby_parser::Bytes::operator=
Bytes & operator=(Bytes const &)=delete
lib_ruby_parser::Bytes
Rerpresentation of Bytes struct from lib-ruby-parser.
Definition: bytes.hpp:46
lib_ruby_parser::ByteList::~ByteList
~ByteList()
lib_ruby_parser::ByteList::operator=
ByteList & operator=(ByteList const &)=delete
lib_ruby_parser::Bytes::Bytes
Bytes()=delete
lib_ruby_parser::ByteList
Definition: bytes.hpp:11
lib_ruby_parser::ByteList::Owned
static ByteList Owned(char *s, size_t len)
lib_ruby_parser::ByteListBlob
Definition: bytes.hpp:39
lib_ruby_parser::ByteList::len
size_t len
Definition: bytes.hpp:16
lib_ruby_parser::ByteListBlob::bytes
uint8_t bytes[sizeof(ByteList)]
Definition: bytes.hpp:41
lib_ruby_parser::ByteList::capacity
size_t capacity
Definition: bytes.hpp:15
lib_ruby_parser
Definition: api.hpp:7
lib_ruby_parser::ByteList::ByteList
ByteList()=delete
lib_ruby_parser::Bytes::raw
ByteList raw
Definition: bytes.hpp:49