A non-owning reference to a range of memory.
| 17 | |
| 18 | //! A non-owning reference to a range of memory. |
| 19 | class TRef |
| 20 | : public TRange<char> |
| 21 | { |
| 22 | public: |
| 23 | //! Creates a null TRef. |
| 24 | TRef() = default; |
| 25 | |
| 26 | //! Creates a TRef for a given block of memory. |
| 27 | TRef(const void* data, size_t size); |
| 28 | |
| 29 | //! Creates a TRef for a given range of memory. |
| 30 | TRef(const void* begin, const void* end); |
| 31 | |
| 32 | //! Creates an empty TRef. |
| 33 | static TRef MakeEmpty(); |
| 34 | |
| 35 | //! Creates a non-owning TRef for a given blob. |
| 36 | static TRef FromBlob(const TBlob& blob); |
| 37 | |
| 38 | //! Creates a non-owning TRef for a given string. |
| 39 | static TRef FromString(const TString& str); |
| 40 | |
| 41 | //! Creates a non-owning TRef for a given std::string. |
| 42 | static TRef FromString(const std::string& str); |
| 43 | |
| 44 | //! Creates a non-owning TRef for a given stringbuf. |
| 45 | static TRef FromStringBuf(TStringBuf strBuf); |
| 46 | |
| 47 | //! Creates a non-owning TRef for a given pod structure. |
| 48 | template <class T> |
| 49 | static TRef FromPod(const T& data); |
| 50 | |
| 51 | //! Converts to TStringBuf. |
| 52 | TStringBuf ToStringBuf() const; |
| 53 | |
| 54 | //! Creates a TRef for a part of existing range. |
| 55 | TRef Slice(size_t startOffset, size_t endOffset) const; |
| 56 | |
| 57 | //! Compares the content for bitwise equality. |
| 58 | static bool AreBitwiseEqual(TRef lhs, TRef rhs); |
| 59 | }; |
| 60 | |
| 61 | //////////////////////////////////////////////////////////////////////////////// |
| 62 |
no outgoing calls
no test coverage detected