MCPcopy Create free account
hub / github.com/Duet3D/RepRapFirmware / StringHandle

Class StringHandle

src/Platform/StringHandle.h:17–39  ·  view source on GitHub ↗

Note: StringHandle is a union member in ExpressionValue, therefore it must be no larger than 32 bits and it cannot have a non-trivial destructor, copy constructor etc. This means that when an object containing a StringHandle is copied or destroyed, that object must handle the reference count. Classes other than ExpressionValue should use AutoStringHandle instead;

Source from the content-addressed store, hash-verified

15// This means that when an object containing a StringHandle is copied or destroyed, that object must handle the reference count.
16// Classes other than ExpressionValue should use AutoStringHandle instead;
17class StringHandle
18{
19public:
20 StringHandle() noexcept { slotPtr = nullptr; }
21 explicit StringHandle(const char *_ecv_array s) noexcept;
22 StringHandle(const char *_ecv_array s, size_t len) noexcept;
23
24#if 0 // unused
25 StringHandle(const char *_ecv_array s1, const char *_ecv_array s2) noexcept;
26#endif
27
28 ReadLockedPointer<const char> Get() const noexcept;
29 size_t GetLength() const noexcept;
30 void Delete() noexcept;
31 const StringHandle& IncreaseRefCount() const noexcept;
32 bool IsNull() const noexcept { return slotPtr == nullptr; }
33 void Assign(const char *_ecv_array s) noexcept;
34
35protected:
36 void InternalAssign(const char *_ecv_array s, size_t len) noexcept;
37
38 Heap::IndexSlot * null slotPtr;
39};
40
41// Version of StringHandle that updates the reference counts automatically
42class AutoStringHandle : public StringHandle

Callers 3

ProcessEventMethod · 0.85
THROWSFunction · 0.85
THROWSFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected