4#ifndef _Stroika_Foundation_Memory_BLOB_h_
5#define _Stroika_Foundation_Memory_BLOB_h_ 1
7#include "Stroika/Foundation/StroikaPreComp.h"
14#include "Stroika/Foundation/Common/Common.h"
15#include "Stroika/Foundation/Common/Concepts.h"
17#include "Stroika/Foundation/Memory/Common.h"
31namespace Stroika::Foundation::Cryptography::Encoding::Algorithm::Base64 {
35namespace Stroika::Foundation::Memory {
87 template <ranges::range CONTAINER_OF_BYTE>
91 BLOB (span<const byte>
s);
104 explicit BLOB (
const shared_ptr<_IRep>& rep);
105 explicit BLOB (shared_ptr<_IRep>&& rep);
110 nonvirtual
BLOB& operator= (
BLOB&&
rhs)
noexcept =
default;
111 nonvirtual
BLOB& operator= (
const BLOB&
rhs) =
default;
171 template <Common::trivially_copyable T>
173 template <Common::trivially_copyable T>
175 template <Common::trivially_copyable T>
178 template <Common::trivially_copyable T>
181 template <Common::trivially_copyable T>
195 template <
typename BYTEISH,
size_t EXTENT = dynamic_extent>
198 template <
typename BYTEISH,
size_t EXTENT>
209 static BLOB AttachAndDelete (
const byte*
s,
size_t arrayLen);
215 nonvirtual
byte operator[] (
const size_t i)
const;
221 nonvirtual
bool empty ()
const;
240 template <
typename T>
242#if !qCompilerAndStdLib_template_requires_doesnt_work_with_specialization_Buggy
245 Common::IAnyOf<T,span<const byte>,
span<const uint8_t>,
pair<const byte*, const byte*>,
pair<const uint8_t*, const uint8_t*>,
vector<byte> ,
vector<uint8_t>,
Streams::InputStream::Ptr<byte>,
string>
263 template <
typename STRING_TYPE = Characters::String>
265#if !qCompilerAndStdLib_template_requires_doesnt_work_with_specialization_Buggy
281 template <
typename STRING_TYPE = Characters::String>
283#if !qCompilerAndStdLib_template_requires_doesnt_work_with_specialization_Buggy
287 template <
typename STRING_TYPE = Characters::String>
288 nonvirtual
STRING_TYPE AsBase64 (
const Cryptography::Encoding::Algorithm::Base64::Options&
o)
const
289#if !qCompilerAndStdLib_template_requires_doesnt_work_with_specialization_Buggy
321 nonvirtual
const byte*
begin ()
const;
328 nonvirtual
const byte*
end ()
const;
334 nonvirtual
size_t GetSize ()
const;
344 nonvirtual
bool operator== (
const BLOB&
rhs)
const;
353 nonvirtual
const byte*
data ()
const;
359 nonvirtual
size_t size ()
const;
365 nonvirtual
size_t length ()
const;
387 template <
typename T>
396 [[
deprecated (
"Since Stroika v3.0d4 use Attach")]]
static BLOB AttachApplicationLifetime (
const byte*
start,
const byte*
end)
400 template <
size_t SIZE>
401 [[
deprecated (
"Since Stroika v3.0d4 use Attach")]]
static BLOB AttachApplicationLifetime (
const byte (&
data)[
SIZE])
405 template <
typename...
ARGS>
410 template <
typename...
ARGS>
420 struct AdoptAndDeleteRep_;
424 shared_ptr<_IRep> fRep_;
426 static_assert (totally_ordered<BLOB>);
427 static_assert (regular<BLOB>);
428 static_assert (Common::explicitly_convertible_to<BLOB, span<const byte>>);
439 virtual ~_IRep () =
default;
440 virtual span<const byte> GetBounds ()
const = 0;
442 nonvirtual
const _IRep& operator= (
const _IRep&) =
delete;
445 inline namespace Literals {
457 inline BLOB operator""_blob (
const char* str,
size_t len);
#define qStroika_ATTRIBUTE_NO_UNIQUE_ADDRESS_VCFORCE
[[msvc::no_unique_address]] isn't always broken in MSVC. Annotate with this on things where its not b...
String is like std::u32string, except it is much easier to use, often much more space efficient,...
nonvirtual size_t length() const
nonvirtual const byte * end() const
nonvirtual STRING_TYPE AsBase64() const
nonvirtual Characters::String ToString(size_t maxBytesToShow=80) const
nonvirtual BLOB Repeat(unsigned int count) const
static BLOB FromHex(const char *b)
Convert string of hex bytes to BLOB.
nonvirtual byte operator[](const size_t i) const
nonvirtual BLOB Slice(size_t startAt, size_t endAt) const
nonvirtual BLOB operator+(const BLOB &rhs) const
nonvirtual bool empty() const
nonvirtual const byte * begin() const
nonvirtual STRING_TYPE AsHex(size_t maxBytesToShow=numeric_limits< size_t >::max()) const
nonvirtual size_t GetSize() const
static BLOB FromBase64(const char *b)
Convert string of base64 bytes to BLOB.
static BLOB FromRaw(const T *s, const T *e)
Convert pointed to/referenced data to BLOB (treating the argument as raw bytes).
nonvirtual size_t size() const
nonvirtual const byte * data() const
concept - trivial shorthand for variadic same_as A or same_as B, or ...