Skip to content

Commit b77f34e

Browse files
committed
Merge branch 'main' of github.com:hikoworks/hikolang
2 parents 7130c18 + 4c7a99e commit b77f34e

File tree

1 file changed

+26
-11
lines changed

1 file changed

+26
-11
lines changed

src/utility/fqname.hpp

Lines changed: 26 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,31 +7,46 @@
77
#include <iterator>
88
#include <cstddef>
99
#include <algorithm>
10+
#include <array>
1011

1112
namespace hk {
1213

13-
class fqname_long {
14-
public:
15-
private:
14+
struct fqname_long {
1615
uint8_t _capacity;
17-
uint8_t _component_positions[16];
18-
uint8_t _text[];
16+
1917
};
2018

2119
class fqname {
2220
public:
21+
~fqname()
22+
{
23+
if (_capacity != 0) {
24+
delete _buffer;
25+
}
26+
}
27+
28+
constexpr fqname() noexcept : _ptr(nullptr) {}
29+
30+
fqname()
31+
{
32+
}
33+
34+
fqname& operator+=(std::string_view component)
35+
{
36+
37+
return *this;
38+
}
2339

2440
private:
2541
union {
26-
fqname_long *_ptr;
27-
uint8_t _text[sizeof(fqname_long *)];
42+
uint8_t *_ptr;
43+
uint8_t _buffer[8];
2844
};
29-
uint8_t _component_positions[7];
30-
uint8_t _prefix_dots : 4 = 0;
31-
uint8_t _is_long : 1 = 0;
45+
uint8_t _positions[22] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
46+
uint8_t _prefix = 0;
47+
uint8_t _capacity = 0;
3248
};
3349

34-
3550
class fqname {
3651
public:
3752
class const_iterator {

0 commit comments

Comments
 (0)