diff options
Diffstat (limited to 'src')
22 files changed, 404 insertions, 423 deletions
diff --git a/src/zencore/base64.cpp b/src/zencore/base64.cpp index b97dfebbf..1f56ee6c3 100644 --- a/src/zencore/base64.cpp +++ b/src/zencore/base64.cpp @@ -101,7 +101,7 @@ Base64::Encode(const uint8_t* Source, uint32_t Length, CharType* Dest) return uint32_t(EncodedBytes - Dest); } -template ZENCORE_API uint32_t Base64::Encode<char>(const uint8_t* Source, uint32_t Length, char* Dest); -template ZENCORE_API uint32_t Base64::Encode<wchar_t>(const uint8_t* Source, uint32_t Length, wchar_t* Dest); +template uint32_t Base64::Encode<char>(const uint8_t* Source, uint32_t Length, char* Dest); +template uint32_t Base64::Encode<wchar_t>(const uint8_t* Source, uint32_t Length, wchar_t* Dest); } // namespace zen diff --git a/src/zencore/filesystem.cpp b/src/zencore/filesystem.cpp index c34dba23c..92a065707 100644 --- a/src/zencore/filesystem.cpp +++ b/src/zencore/filesystem.cpp @@ -1641,7 +1641,7 @@ ReadFile(const std::filesystem::path& Path) return Contents; } -ZENCORE_API void +void ScanFile(void* NativeHandle, uint64_t Offset, uint64_t Size, diff --git a/src/zencore/include/zencore/basicfile.h b/src/zencore/include/zencore/basicfile.h index f5c82b8fe..f397370fc 100644 --- a/src/zencore/include/zencore/basicfile.h +++ b/src/zencore/include/zencore/basicfile.h @@ -192,6 +192,6 @@ private: IoBuffer WriteToTempFile(CompositeBuffer&& Buffer, const std::filesystem::path& Path); -ZENCORE_API void basicfile_forcelink(); +void basicfile_forcelink(); } // namespace zen diff --git a/src/zencore/include/zencore/compactbinary.h b/src/zencore/include/zencore/compactbinary.h index 82ca055ab..b128e4205 100644 --- a/src/zencore/include/zencore/compactbinary.h +++ b/src/zencore/include/zencore/compactbinary.h @@ -138,8 +138,8 @@ public: int GetSeconds() const { return (int)((Ticks / TicksPerSecond) % 60); } - ZENCORE_API std::string ToString(const char* Format) const; - ZENCORE_API std::string ToString() const; + std::string ToString(const char* Format) const; + std::string ToString() const; friend inline DateTime operator+(const DateTime& Lhs, const TimeSpan& Rhs); friend inline DateTime operator+(const TimeSpan& Lhs, const DateTime& Rhs); @@ -492,7 +492,7 @@ class CbFieldView public: CbFieldView() = default; - ZENCORE_API CbFieldView(const void* DataPointer, CbFieldType FieldType = CbFieldType::HasFieldType); + CbFieldView(const void* DataPointer, CbFieldType FieldType = CbFieldType::HasFieldType); /** Construct a field from a value, without access to the name. */ inline explicit CbFieldView(const CbValue& Value); @@ -508,13 +508,13 @@ public: /** Returns the value for unchecked access. Prefer the typed accessors below. */ inline CbValue GetValue() const; - ZENCORE_API MemoryView AsBinaryView(MemoryView Default = MemoryView()); - ZENCORE_API CbObjectView AsObjectView(); - ZENCORE_API CbArrayView AsArrayView(); - ZENCORE_API std::string_view AsString(std::string_view Default = std::string_view()); - ZENCORE_API std::u8string_view AsU8String(std::u8string_view Default = std::u8string_view()); + MemoryView AsBinaryView(MemoryView Default = MemoryView()); + CbObjectView AsObjectView(); + CbArrayView AsArrayView(); + std::string_view AsString(std::string_view Default = std::string_view()); + std::u8string_view AsU8String(std::u8string_view Default = std::u8string_view()); - ZENCORE_API void IterateAttachments(const std::function<void(CbFieldView)>& Visitor) const; + void IterateAttachments(const std::function<void(CbFieldView)>& Visitor) const; /** Access the field as an int8. Returns the provided default on error. */ inline int8_t AsInt8(int8_t Default = 0) { return AsInteger<int8_t>(Default); } @@ -534,53 +534,53 @@ public: inline uint64_t AsUInt64(uint64_t Default = 0) { return AsInteger<uint64_t>(Default); } /** Access the field as a float. Returns the provided default on error. */ - ZENCORE_API float AsFloat(float Default = 0.0f); + float AsFloat(float Default = 0.0f); /** Access the field as a double. Returns the provided default on error. */ - ZENCORE_API double AsDouble(double Default = 0.0); + double AsDouble(double Default = 0.0); /** Access the field as a bool. Returns the provided default on error. */ - ZENCORE_API bool AsBool(bool bDefault = false); + bool AsBool(bool bDefault = false); /** Access the field as a hash referencing a compact binary attachment. Returns the provided default on error. */ - ZENCORE_API IoHash AsObjectAttachment(const IoHash& Default = IoHash()); + IoHash AsObjectAttachment(const IoHash& Default = IoHash()); /** Access the field as a hash referencing a binary attachment. Returns the provided default on error. */ - ZENCORE_API IoHash AsBinaryAttachment(const IoHash& Default = IoHash()); + IoHash AsBinaryAttachment(const IoHash& Default = IoHash()); /** Access the field as a hash referencing an attachment. Returns the provided default on error. */ - ZENCORE_API IoHash AsAttachment(const IoHash& Default = IoHash()); + IoHash AsAttachment(const IoHash& Default = IoHash()); /** Access the field as a hash. Returns the provided default on error. */ - ZENCORE_API IoHash AsHash(const IoHash& Default = IoHash()); + IoHash AsHash(const IoHash& Default = IoHash()); /** Access the field as a UUID. Returns a nil UUID on error. */ - ZENCORE_API Guid AsUuid(); + Guid AsUuid(); /** Access the field as a UUID. Returns the provided default on error. */ - ZENCORE_API Guid AsUuid(const Guid& Default); + Guid AsUuid(const Guid& Default); /** Access the field as an OID. Returns a nil OID on error. */ - ZENCORE_API Oid AsObjectId(); + Oid AsObjectId(); /** Access the field as a OID. Returns the provided default on error. */ - ZENCORE_API Oid AsObjectId(const Oid& Default); + Oid AsObjectId(const Oid& Default); /** Access the field as a custom sub-type with an integer identifier. Returns the provided default on error. */ - ZENCORE_API CbCustomById AsCustomById(CbCustomById Default); + CbCustomById AsCustomById(CbCustomById Default); /** Access the field as a custom sub-type with a string identifier. Returns the provided default on error. */ - ZENCORE_API CbCustomByName AsCustomByName(CbCustomByName Default); + CbCustomByName AsCustomByName(CbCustomByName Default); /** Access the field as a date/time tick count. Returns the provided default on error. */ - ZENCORE_API int64_t AsDateTimeTicks(int64_t Default = 0); + int64_t AsDateTimeTicks(int64_t Default = 0); /** Access the field as a date/time. Returns a date/time at the epoch on error. */ - ZENCORE_API DateTime AsDateTime(); + DateTime AsDateTime(); /** Access the field as a date/time. Returns the provided default on error. */ - ZENCORE_API DateTime AsDateTime(DateTime Default); + DateTime AsDateTime(DateTime Default); /** Access the field as a timespan tick count. Returns the provided default on error. */ - ZENCORE_API int64_t AsTimeSpanTicks(int64_t Default = 0); + int64_t AsTimeSpanTicks(int64_t Default = 0); /** Access the field as a timespan. Returns an empty timespan on error. */ - ZENCORE_API TimeSpan AsTimeSpan(); + TimeSpan AsTimeSpan(); /** Access the field as a timespan. Returns the provided default on error. */ - ZENCORE_API TimeSpan AsTimeSpan(TimeSpan Default); + TimeSpan AsTimeSpan(TimeSpan Default); /** True if the field has a name. */ constexpr inline bool HasName() const { return CbFieldTypeOps::HasFieldName(Type); } @@ -628,12 +628,12 @@ public: constexpr inline CbFieldError GetError() const { return Error; } /** Returns the size of the field in bytes, including the type and name. */ - ZENCORE_API uint64_t GetSize() const; + uint64_t GetSize() const; /** Calculate the hash of the field, including the type and name. */ - ZENCORE_API IoHash GetHash() const; + IoHash GetHash() const; - ZENCORE_API void GetHash(IoHashStream& HashStream) const; + void GetHash(IoHashStream& HashStream) const; /** Feed the field (including type and name) to the stream function */ inline void WriteToStream(auto Hash) const @@ -645,10 +645,10 @@ public: } /** Copy the field into a buffer of exactly GetSize() bytes, including the type and name. */ - ZENCORE_API void CopyTo(MutableMemoryView Buffer) const; + void CopyTo(MutableMemoryView Buffer) const; /** Copy the field into an archive, including its type and name. */ - ZENCORE_API void CopyTo(BinaryWriter& Ar) const; + void CopyTo(BinaryWriter& Ar) const; /** * Whether this field is identical to the other field. @@ -659,10 +659,10 @@ public: * these assumptions do not hold, this may return false for equivalent inputs. Validation can * be performed with ValidateCompactBinary, except for field order and field name case. */ - ZENCORE_API bool Equals(const CbFieldView& Other) const; + bool Equals(const CbFieldView& Other) const; /** Returns a view of the field, including the type and name when present. */ - ZENCORE_API MemoryView GetView() const; + MemoryView GetView() const; /** * Try to get a view of the field as it would be serialized, such as by CopyTo. @@ -682,7 +682,7 @@ public: protected: /** Returns a view of the name and value payload, which excludes the type. */ - ZENCORE_API MemoryView GetViewNoType() const; + MemoryView GetViewNoType() const; /** Returns a view of the value payload, which excludes the type and name. */ inline MemoryView GetPayloadView() const { return MemoryView(Payload, GetPayloadSize()); } @@ -697,7 +697,7 @@ protected: inline const void* GetPayloadEnd() const { return static_cast<const uint8_t*>(Payload) + GetPayloadSize(); } /** Returns the size of the value payload in bytes, which is the field excluding the type and name. */ - ZENCORE_API uint64_t GetPayloadSize() const; + uint64_t GetPayloadSize() const; /** Assign a field from a pointer to its data and an optional externally-provided type. */ inline void Assign(const void* InData, const CbFieldType InType) @@ -719,7 +719,7 @@ private: return IntType(AsInteger(uint64_t(Default), CompactBinaryPrivate::MakeIntegerParams<IntType>())); } - ZENCORE_API uint64_t AsInteger(uint64_t Default, CompactBinaryPrivate::IntegerParams Params); + uint64_t AsInteger(uint64_t Default, CompactBinaryPrivate::IntegerParams Params); private: /** The field type, with the transient HasFieldType flag if the field contains its type. */ @@ -766,11 +766,11 @@ public: inline void Reset() { *this = TCbFieldIterator(); } /** Returns the size of the fields in the range in bytes. */ - ZENCORE_API uint64_t GetRangeSize() const; + uint64_t GetRangeSize() const; /** Calculate the hash of every field in the range. */ - ZENCORE_API IoHash GetRangeHash() const; - ZENCORE_API void GetRangeHash(IoHashStream& Hash) const; + IoHash GetRangeHash() const; + void GetRangeHash(IoHashStream& Hash) const; using FieldType::Equals; @@ -793,10 +793,10 @@ public: } /** Copy the field range into a buffer of exactly GetRangeSize() bytes. */ - ZENCORE_API void CopyRangeTo(MutableMemoryView Buffer) const; + void CopyRangeTo(MutableMemoryView Buffer) const; /** Invoke the visitor for every attachment in the field range. */ - ZENCORE_API void IterateRangeAttachments(const std::function<void(CbFieldView)>& Visitor) const; + void IterateRangeAttachments(const std::function<void(CbFieldView)>& Visitor) const; /** Create a view of every field in the range. */ inline MemoryView GetRangeView() const { return MemoryView(FieldType::GetView().GetData(), FieldsEnd); } @@ -892,12 +892,12 @@ private: /** * Serialize a compact binary array to JSON. */ -ZENCORE_API void CompactBinaryToJson(const CbArrayView& Object, StringBuilderBase& Builder); +void CompactBinaryToJson(const CbArrayView& Object, StringBuilderBase& Builder); /** * Serialize a compact binary array to YAML. */ -ZENCORE_API void CompactBinaryToYaml(const CbArrayView& Object, StringBuilderBase& Builder); +void CompactBinaryToYaml(const CbArrayView& Object, StringBuilderBase& Builder); /** * Array of CbField that have no names. @@ -919,16 +919,16 @@ public: using CbFieldView::TryGetSerializedView; /** Construct an array with no fields. */ - ZENCORE_API CbArrayView(); + CbArrayView(); /** Returns the number of items in the array. */ - ZENCORE_API uint64_t Num() const; + uint64_t Num() const; /** Create an iterator for the fields of this array. */ - ZENCORE_API CbFieldViewIterator CreateViewIterator() const; + CbFieldViewIterator CreateViewIterator() const; /** Visit the fields of this array. */ - ZENCORE_API void VisitFields(ICbVisitor& Visitor); + void VisitFields(ICbVisitor& Visitor); /** Access the array as an array field. */ inline CbFieldView AsFieldView() const { return static_cast<const CbFieldView&>(*this); } @@ -940,12 +940,12 @@ public: inline explicit operator bool() const { return Num() > 0; } /** Returns the size of the array in bytes if serialized by itself with no name. */ - ZENCORE_API uint64_t GetSize() const; + uint64_t GetSize() const; /** Calculate the hash of the array if serialized by itself with no name. */ - ZENCORE_API IoHash GetHash() const; + IoHash GetHash() const; - ZENCORE_API void GetHash(IoHashStream& Stream) const; + void GetHash(IoHashStream& Stream) const; /** * Whether this array is identical to the other array. @@ -956,13 +956,13 @@ public: * these assumptions do not hold, this may return false for equivalent inputs. Validation can * be done with the All mode to check these assumptions about the format of the inputs. */ - ZENCORE_API bool Equals(const CbArrayView& Other) const; + bool Equals(const CbArrayView& Other) const; /** Copy the array into a buffer of exactly GetSize() bytes, with no name. */ - ZENCORE_API void CopyTo(MutableMemoryView Buffer) const; + void CopyTo(MutableMemoryView Buffer) const; /** Copy the array into an archive, including its type and name. */ - ZENCORE_API void CopyTo(BinaryWriter& Ar) const; + void CopyTo(BinaryWriter& Ar) const; ///** Invoke the visitor for every attachment in the array. */ inline void IterateAttachments(const std::function<void(CbFieldView)>& Visitor) const @@ -996,11 +996,11 @@ private: /** * Serialize a compact binary object to JSON. */ -ZENCORE_API void CompactBinaryToJson(const CbObjectView& Object, StringBuilderBase& Builder, bool AddTypeComment = false); +void CompactBinaryToJson(const CbObjectView& Object, StringBuilderBase& Builder, bool AddTypeComment = false); /** * Serialize a compact binary object to YAML. */ -ZENCORE_API void CompactBinaryToYaml(const CbObjectView& Object, StringBuilderBase& Builder); +void CompactBinaryToYaml(const CbObjectView& Object, StringBuilderBase& Builder); class CbObjectView : protected CbFieldView { @@ -1013,13 +1013,13 @@ public: using CbFieldView::TryGetSerializedView; /** Construct an object with no fields. */ - ZENCORE_API CbObjectView(); + CbObjectView(); /** Create an iterator for the fields of this object. */ - ZENCORE_API CbFieldViewIterator CreateViewIterator() const; + CbFieldViewIterator CreateViewIterator() const; /** Visit the fields of this object. */ - ZENCORE_API void VisitFields(ICbVisitor& Visitor); + void VisitFields(ICbVisitor& Visitor); /** * Find a field by case-sensitive name comparison. @@ -1030,10 +1030,10 @@ public: * @param Name The name of the field. * @return The matching field if found, otherwise a field with no value. */ - ZENCORE_API CbFieldView FindView(std::string_view Name) const; + CbFieldView FindView(std::string_view Name) const; /** Find a field by case-insensitive name comparison. */ - ZENCORE_API CbFieldView FindViewIgnoreCase(std::string_view Name) const; + CbFieldView FindViewIgnoreCase(std::string_view Name) const; /** Find a field by case-sensitive name comparison. */ inline CbFieldView operator[](std::string_view Name) const { return FindView(Name); } @@ -1045,15 +1045,15 @@ public: static inline CbObjectView FromFieldView(const CbFieldView& Field) { return CbObjectView(Field); } /** Whether the object has any fields. */ - ZENCORE_API explicit operator bool() const; + explicit operator bool() const; /** Returns the size of the object in bytes if serialized by itself with no name. */ - ZENCORE_API uint64_t GetSize() const; + uint64_t GetSize() const; /** Calculate the hash of the object if serialized by itself with no name. */ - ZENCORE_API IoHash GetHash() const; + IoHash GetHash() const; - ZENCORE_API void GetHash(IoHashStream& HashStream) const; + void GetHash(IoHashStream& HashStream) const; /** * Whether this object is identical to the other object. @@ -1064,13 +1064,13 @@ public: * these assumptions do not hold, this may return false for equivalent inputs. Validation can * be done with the All mode to check these assumptions about the format of the inputs. */ - ZENCORE_API bool Equals(const CbObjectView& Other) const; + bool Equals(const CbObjectView& Other) const; /** Copy the object into a buffer of exactly GetSize() bytes, with no name. */ - ZENCORE_API void CopyTo(MutableMemoryView Buffer) const; + void CopyTo(MutableMemoryView Buffer) const; /** Copy the field into an archive, including its type and name. */ - ZENCORE_API void CopyTo(BinaryWriter& Ar) const; + void CopyTo(BinaryWriter& Ar) const; ///** Invoke the visitor for every attachment in the object. */ inline void IterateAttachments(const std::function<void(CbFieldView)>& Visitor) const @@ -1263,7 +1263,7 @@ class CbFieldIterator : public TCbFieldIterator<CbField> { public: /** Construct a field range from an owned clone of a range. */ - ZENCORE_API static CbFieldIterator CloneRange(const CbFieldViewIterator& It); + static CbFieldIterator CloneRange(const CbFieldViewIterator& It); /** Construct a field range from an owned clone of a range. */ static inline CbFieldIterator CloneRange(const CbFieldIterator& It) { return CloneRange(CbFieldViewIterator(It)); } @@ -1306,7 +1306,7 @@ public: } /** Returns a buffer that exactly contains the field range. */ - ZENCORE_API SharedBuffer GetRangeBuffer() const; + SharedBuffer GetRangeBuffer() const; private: using TCbFieldIterator::TCbFieldIterator; @@ -1440,22 +1440,22 @@ CbField::AsBinary(const SharedBuffer& Default) && * @param Allocator Allocator for the buffer that the field is loaded into. * @return A field with a reference to the allocated buffer, or a default field on failure. */ -ZENCORE_API CbField LoadCompactBinary(BinaryReader& Ar, BufferAllocator Allocator); +CbField LoadCompactBinary(BinaryReader& Ar, BufferAllocator Allocator); -ZENCORE_API CbObject LoadCompactBinaryObject(IoBuffer&& Payload); -ZENCORE_API CbObject LoadCompactBinaryObject(const IoBuffer& Payload); -ZENCORE_API CbObject LoadCompactBinaryObject(CompressedBuffer&& Payload); -ZENCORE_API CbObject LoadCompactBinaryObject(const CompressedBuffer& Payload); +CbObject LoadCompactBinaryObject(IoBuffer&& Payload); +CbObject LoadCompactBinaryObject(const IoBuffer& Payload); +CbObject LoadCompactBinaryObject(CompressedBuffer&& Payload); +CbObject LoadCompactBinaryObject(const CompressedBuffer& Payload); /** * Load a compact binary from JSON. */ -ZENCORE_API CbFieldIterator LoadCompactBinaryFromJson(std::string_view Json, std::string& Error); -ZENCORE_API CbFieldIterator LoadCompactBinaryFromJson(std::string_view Json); +CbFieldIterator LoadCompactBinaryFromJson(std::string_view Json, std::string& Error); +CbFieldIterator LoadCompactBinaryFromJson(std::string_view Json); -ZENCORE_API void SaveCompactBinary(BinaryWriter& Ar, const CbFieldView& Field); -ZENCORE_API void SaveCompactBinary(BinaryWriter& Ar, const CbArrayView& Array); -ZENCORE_API void SaveCompactBinary(BinaryWriter& Ar, const CbObjectView& Object); +void SaveCompactBinary(BinaryWriter& Ar, const CbFieldView& Field); +void SaveCompactBinary(BinaryWriter& Ar, const CbArrayView& Array); +void SaveCompactBinary(BinaryWriter& Ar, const CbObjectView& Object); /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -1473,7 +1473,7 @@ ZENCORE_API void SaveCompactBinary(BinaryWriter& Ar, const CbObjectView& Object) * @param View A memory view that may contain the start of a field. * @param Type HasFieldType means that View contains the type. Otherwise, use the given type. */ -ZENCORE_API uint64_t MeasureCompactBinary(MemoryView View, CbFieldType Type = CbFieldType::HasFieldType); +uint64_t MeasureCompactBinary(MemoryView View, CbFieldType Type = CbFieldType::HasFieldType); /** * Try to determine the type and size of the compact binary field at the start of the view. @@ -1491,10 +1491,7 @@ ZENCORE_API uint64_t MeasureCompactBinary(MemoryView View, CbFieldType Type = Cb * @param InType HasFieldType means that InView contains the type. Otherwise, use the given type. * @return true if the size of the field was determined, otherwise false. */ -ZENCORE_API bool TryMeasureCompactBinary(MemoryView InView, - CbFieldType& OutType, - uint64_t& OutSize, - CbFieldType InType = CbFieldType::HasFieldType); +bool TryMeasureCompactBinary(MemoryView InView, CbFieldType& OutType, uint64_t& OutSize, CbFieldType InType = CbFieldType::HasFieldType); inline CbFieldViewIterator begin(CbFieldView& View) @@ -1520,14 +1517,14 @@ end(CbFieldView&) /** * Serialize serialized compact binary blob to JSON. It must be 0 to n fields with including type for each field */ -ZENCORE_API void CompactBinaryToJson(MemoryView Data, StringBuilderBase& InBuilder, bool AddTypeComment = false); +void CompactBinaryToJson(MemoryView Data, StringBuilderBase& InBuilder, bool AddTypeComment = false); /** * Serialize serialized compact binary blob to YAML. It must be 0 to n fields with including type for each field */ -ZENCORE_API void CompactBinaryToYaml(MemoryView Data, StringBuilderBase& InBuilder); +void CompactBinaryToYaml(MemoryView Data, StringBuilderBase& InBuilder); -ZENCORE_API std::vector<CbFieldView> ReadCompactBinaryStream(MemoryView Data); +std::vector<CbFieldView> ReadCompactBinaryStream(MemoryView Data); void uson_forcelink(); // internal void cbjson_forcelink(); // internal diff --git a/src/zencore/include/zencore/compactbinarybuilder.h b/src/zencore/include/zencore/compactbinarybuilder.h index f11717453..3e695c86f 100644 --- a/src/zencore/include/zencore/compactbinarybuilder.h +++ b/src/zencore/include/zencore/compactbinarybuilder.h @@ -67,14 +67,14 @@ class BinaryWriter; class CbWriter { public: - ZENCORE_API CbWriter(); - ZENCORE_API ~CbWriter(); + CbWriter(); + ~CbWriter(); CbWriter(const CbWriter&) = delete; CbWriter& operator=(const CbWriter&) = delete; /** Empty the writer without releasing any allocated memory. */ - ZENCORE_API void Reset(); + void Reset(); /** * Serialize the field(s) to an owned buffer and return it as an iterator. @@ -82,7 +82,7 @@ public: * It is not valid to call this function in the middle of writing an object, array, or field. * The writer remains valid for further use when this function returns. */ - ZENCORE_API CbFieldIterator Save(); + CbFieldIterator Save(); /** * Serialize the field(s) to memory. @@ -93,16 +93,16 @@ public: * @param Buffer A mutable memory view to write to. Must be exactly GetSaveSize() bytes. * @return An iterator for the field(s) written to the buffer. */ - ZENCORE_API CbFieldViewIterator Save(MutableMemoryView Buffer); + CbFieldViewIterator Save(MutableMemoryView Buffer); - ZENCORE_API void Save(BinaryWriter& Writer); + void Save(BinaryWriter& Writer); /** * The size of buffer (in bytes) required to serialize the fields that have been written. * * It is not valid to call this function in the middle of writing an object, array, or field. */ - ZENCORE_API uint64_t GetSaveSize() const; + uint64_t GetSaveSize() const; /** * Sets the name of the next field to be written. @@ -110,7 +110,7 @@ public: * It is not valid to call this function when writing a field inside an array. * Names must be valid UTF-8 and must be unique within an object. */ - ZENCORE_API CbWriter& SetName(std::string_view Name); + CbWriter& SetName(std::string_view Name); /** Copy the value (not the name) of an existing field. */ inline void AddField(std::string_view Name, const CbFieldView& Value) @@ -119,7 +119,7 @@ public: AddField(Value); } - ZENCORE_API void AddField(const CbFieldView& Value); + void AddField(const CbFieldView& Value); /** Copy the value (not the name) of an existing field. Holds a reference if owned. */ inline void AddField(std::string_view Name, const CbField& Value) @@ -127,7 +127,7 @@ public: SetName(Name); AddField(Value); } - ZENCORE_API void AddField(const CbField& Value); + void AddField(const CbField& Value); /** Begin a new object. Must have a matching call to EndObject. */ inline void BeginObject(std::string_view Name) @@ -135,9 +135,9 @@ public: SetName(Name); BeginObject(); } - ZENCORE_API void BeginObject(); + void BeginObject(); /** End an object after its fields have been written. */ - ZENCORE_API void EndObject(); + void EndObject(); /** Copy the value (not the name) of an existing object. */ inline void AddObject(std::string_view Name, const CbObjectView& Value) @@ -145,14 +145,14 @@ public: SetName(Name); AddObject(Value); } - ZENCORE_API void AddObject(const CbObjectView& Value); + void AddObject(const CbObjectView& Value); /** Copy the value (not the name) of an existing object. Holds a reference if owned. */ inline void AddObject(std::string_view Name, const CbObject& Value) { SetName(Name); AddObject(Value); } - ZENCORE_API void AddObject(const CbObject& Value); + void AddObject(const CbObject& Value); /** Begin a new array. Must have a matching call to EndArray. */ inline void BeginArray(std::string_view Name) @@ -160,9 +160,9 @@ public: SetName(Name); BeginArray(); } - ZENCORE_API void BeginArray(); + void BeginArray(); /** End an array after its fields have been written. */ - ZENCORE_API void EndArray(); + void EndArray(); /** Copy the value (not the name) of an existing array. */ inline void AddArray(std::string_view Name, const CbArrayView& Value) @@ -170,14 +170,14 @@ public: SetName(Name); AddArray(Value); } - ZENCORE_API void AddArray(const CbArrayView& Value); + void AddArray(const CbArrayView& Value); /** Copy the value (not the name) of an existing array. Holds a reference if owned. */ inline void AddArray(std::string_view Name, const CbArray& Value) { SetName(Name); AddArray(Value); } - ZENCORE_API void AddArray(const CbArray& Value); + void AddArray(const CbArray& Value); /** Write a null field. */ inline void AddNull(std::string_view Name) @@ -185,7 +185,7 @@ public: SetName(Name); AddNull(); } - ZENCORE_API void AddNull(); + void AddNull(); /** Write a binary field by copying Size bytes from Value. */ inline void AddBinary(std::string_view Name, const void* Value, uint64_t Size) @@ -193,7 +193,7 @@ public: SetName(Name); AddBinary(Value, Size); } - ZENCORE_API void AddBinary(const void* Value, uint64_t Size); + void AddBinary(const void* Value, uint64_t Size); /** Write a binary field by copying the view. */ inline void AddBinary(std::string_view Name, MemoryView Value) { @@ -208,15 +208,15 @@ public: SetName(Name); AddBinary(std::move(Value)); } - ZENCORE_API void AddBinary(IoBuffer Value); - ZENCORE_API void AddBinary(SharedBuffer Value); + void AddBinary(IoBuffer Value); + void AddBinary(SharedBuffer Value); inline void AddBinary(std::string_view Name, const CompositeBuffer& Buffer) { SetName(Name); AddBinary(Buffer); } - ZENCORE_API void AddBinary(const CompositeBuffer& Buffer); + void AddBinary(const CompositeBuffer& Buffer); /** Write a string field by copying the UTF-8 value. */ inline void AddString(std::string_view Name, std::string_view Value) @@ -224,14 +224,14 @@ public: SetName(Name); AddString(Value); } - ZENCORE_API void AddString(std::string_view Value); + void AddString(std::string_view Value); /** Write a string field by converting the UTF-16 value to UTF-8. */ inline void AddString(std::string_view Name, std::wstring_view Value) { SetName(Name); AddString(Value); } - ZENCORE_API void AddString(std::wstring_view Value); + void AddString(std::wstring_view Value); /** Write an integer field. */ inline void AddInteger(std::string_view Name, int32_t Value) @@ -239,28 +239,28 @@ public: SetName(Name); AddInteger(Value); } - ZENCORE_API void AddInteger(int32_t Value); + void AddInteger(int32_t Value); /** Write an integer field. */ inline void AddInteger(std::string_view Name, int64_t Value) { SetName(Name); AddInteger(Value); } - ZENCORE_API void AddInteger(int64_t Value); + void AddInteger(int64_t Value); /** Write an integer field. */ inline void AddInteger(std::string_view Name, uint32_t Value) { SetName(Name); AddInteger(Value); } - ZENCORE_API void AddInteger(uint32_t Value); + void AddInteger(uint32_t Value); /** Write an integer field. */ inline void AddInteger(std::string_view Name, uint64_t Value) { SetName(Name); AddInteger(Value); } - ZENCORE_API void AddInteger(uint64_t Value); + void AddInteger(uint64_t Value); /** Write a float field from a 32-bit float value. */ inline void AddFloat(std::string_view Name, float Value) @@ -268,7 +268,7 @@ public: SetName(Name); AddFloat(Value); } - ZENCORE_API void AddFloat(float Value); + void AddFloat(float Value); /** Write a float field from a 64-bit float value. */ inline void AddFloat(std::string_view Name, double Value) @@ -276,7 +276,7 @@ public: SetName(Name); AddFloat(Value); } - ZENCORE_API void AddFloat(double Value); + void AddFloat(double Value); /** Write a bool field. */ inline void AddBool(std::string_view Name, bool bValue) @@ -284,7 +284,7 @@ public: SetName(Name); AddBool(bValue); } - ZENCORE_API void AddBool(bool bValue); + void AddBool(bool bValue); /** Write a field referencing a compact binary attachment by its hash. */ inline void AddObjectAttachment(std::string_view Name, const IoHash& Value) @@ -292,7 +292,7 @@ public: SetName(Name); AddObjectAttachment(Value); } - ZENCORE_API void AddObjectAttachment(const IoHash& Value); + void AddObjectAttachment(const IoHash& Value); /** Write a field referencing a binary attachment by its hash. */ inline void AddBinaryAttachment(std::string_view Name, const IoHash& Value) @@ -300,7 +300,7 @@ public: SetName(Name); AddBinaryAttachment(Value); } - ZENCORE_API void AddBinaryAttachment(const IoHash& Value); + void AddBinaryAttachment(const IoHash& Value); /** Write a field referencing the attachment by its hash. */ inline void AddAttachment(std::string_view Name, const CbAttachment& Attachment) @@ -308,7 +308,7 @@ public: SetName(Name); AddAttachment(Attachment); } - ZENCORE_API void AddAttachment(const CbAttachment& Attachment); + void AddAttachment(const CbAttachment& Attachment); /** Write a hash field. */ inline void AddHash(std::string_view Name, const IoHash& Value) @@ -316,7 +316,7 @@ public: SetName(Name); AddHash(Value); } - ZENCORE_API void AddHash(const IoHash& Value); + void AddHash(const IoHash& Value); /** Write a UUID field. */ inline void AddUuid(std::string_view Name, const Guid& Value) @@ -324,7 +324,7 @@ public: SetName(Name); AddUuid(Value); } - ZENCORE_API void AddUuid(const Guid& Value); + void AddUuid(const Guid& Value); /** Write an ObjectId field. */ inline void AddObjectId(std::string_view Name, const Oid& Value) @@ -332,7 +332,7 @@ public: SetName(Name); AddObjectId(Value); } - ZENCORE_API void AddObjectId(const Oid& Value); + void AddObjectId(const Oid& Value); /** Write a date/time field with the specified count of 100ns ticks since the epoch. */ inline void AddDateTimeTicks(std::string_view Name, int64_t Ticks) @@ -340,7 +340,7 @@ public: SetName(Name); AddDateTimeTicks(Ticks); } - ZENCORE_API void AddDateTimeTicks(int64_t Ticks); + void AddDateTimeTicks(int64_t Ticks); /** Write a date/time field. */ inline void AddDateTime(std::string_view Name, DateTime Value) @@ -348,7 +348,7 @@ public: SetName(Name); AddDateTime(Value); } - ZENCORE_API void AddDateTime(DateTime Value); + void AddDateTime(DateTime Value); /** Write a time span field with the specified count of 100ns ticks. */ inline void AddTimeSpanTicks(std::string_view Name, int64_t Ticks) @@ -356,7 +356,7 @@ public: SetName(Name); AddTimeSpanTicks(Ticks); } - ZENCORE_API void AddTimeSpanTicks(int64_t Ticks); + void AddTimeSpanTicks(int64_t Ticks); /** Write a time span field. */ inline void AddTimeSpan(std::string_view Name, TimeSpan Value) @@ -364,7 +364,7 @@ public: SetName(Name); AddTimeSpan(Value); } - ZENCORE_API void AddTimeSpan(TimeSpan Value); + void AddTimeSpan(TimeSpan Value); /** Private flags that are public to work with ENUM_CLASS_FLAGS. */ enum class StateFlags : uint8_t; @@ -373,7 +373,7 @@ public: protected: /** Reserve the specified size up front until the format is optimized. */ - ZENCORE_API explicit CbWriter(int64_t InitialSize); + explicit CbWriter(int64_t InitialSize); private: friend CbWriter& operator<<(CbWriter& Writer, std::string_view NameOrValue); @@ -385,7 +385,7 @@ private: void EndField(CbFieldType Type); /** Set the field name if valid in this state, otherwise write add a string field. */ - ZENCORE_API void SetNameOrAddString(std::string_view NameOrValue); + void SetNameOrAddString(std::string_view NameOrValue); /** Returns a view of the name of the active field, if any, otherwise the empty view. */ std::string_view GetActiveName() const; @@ -447,19 +447,19 @@ public: explicit CbObjectWriter(int64_t InitialSize) : CbWriter(InitialSize) { BeginObject(); } CbObjectWriter() { BeginObject(); } - ZENCORE_API CbObject Save() + CbObject Save() { Finalize(); return CbWriter::Save().AsObject(); } - ZENCORE_API void Save(BinaryWriter& Writer) + void Save(BinaryWriter& Writer) { Finalize(); return CbWriter::Save(Writer); } - ZENCORE_API CbFieldViewIterator Save(MutableMemoryView Buffer) + CbFieldViewIterator Save(MutableMemoryView Buffer) { ZEN_ASSERT(m_Finalized); return CbWriter::Save(Buffer); @@ -655,20 +655,20 @@ operator<<(CbWriter& Writer, const Oid& Value) return Writer; } -ZENCORE_API CbWriter& operator<<(CbWriter& Writer, DateTime Value); -ZENCORE_API CbWriter& operator<<(CbWriter& Writer, TimeSpan Value); +CbWriter& operator<<(CbWriter& Writer, DateTime Value); +CbWriter& operator<<(CbWriter& Writer, TimeSpan Value); -ZENCORE_API inline TimeSpan +inline TimeSpan ToTimeSpan(std::chrono::seconds Secs) { return TimeSpan(0, 0, gsl::narrow<int>(Secs.count())); }; -ZENCORE_API inline TimeSpan +inline TimeSpan ToTimeSpan(std::chrono::milliseconds MS) { return TimeSpan(MS.count() * TimeSpan::TicksPerMillisecond); } -ZENCORE_API inline DateTime +inline DateTime ToDateTime(std::chrono::system_clock::time_point TimePoint) { time_t Time = std::chrono::system_clock::to_time_t(TimePoint); diff --git a/src/zencore/include/zencore/compactbinarypackage.h b/src/zencore/include/zencore/compactbinarypackage.h index 9ec12cb0f..64b62e2c0 100644 --- a/src/zencore/include/zencore/compactbinarypackage.h +++ b/src/zencore/include/zencore/compactbinarypackage.h @@ -51,23 +51,23 @@ public: inline CbAttachment(const CbObject& InValue, const IoHash& Hash) : CbAttachment(InValue, &Hash) {} /** Construct a raw binary attachment. Value is cloned if not owned. */ - ZENCORE_API explicit CbAttachment(const SharedBuffer& InValue) : CbAttachment(CompositeBuffer(InValue)) {} + explicit CbAttachment(const SharedBuffer& InValue) : CbAttachment(CompositeBuffer(InValue)) {} /** Construct a raw binary attachment. Value is cloned if not owned. Hash must match Value. */ - ZENCORE_API CbAttachment(const SharedBuffer& InValue, const IoHash& Hash) : CbAttachment(CompositeBuffer(InValue), Hash) {} + CbAttachment(const SharedBuffer& InValue, const IoHash& Hash) : CbAttachment(CompositeBuffer(InValue), Hash) {} /** Construct a raw binary attachment. Value is cloned if not owned. */ - ZENCORE_API explicit CbAttachment(SharedBuffer&& InValue) : CbAttachment(CompositeBuffer(std::move(InValue))) {} + explicit CbAttachment(SharedBuffer&& InValue) : CbAttachment(CompositeBuffer(std::move(InValue))) {} /** Construct a raw binary attachment. Value is cloned if not owned. Hash must match Value. */ - ZENCORE_API CbAttachment(SharedBuffer&& InValue, const IoHash& Hash) : CbAttachment(CompositeBuffer(std::move(InValue)), Hash) {} + CbAttachment(SharedBuffer&& InValue, const IoHash& Hash) : CbAttachment(CompositeBuffer(std::move(InValue)), Hash) {} /** Construct a compressed binary attachment. Value is cloned if not owned. */ - ZENCORE_API CbAttachment(const CompressedBuffer& InValue, const IoHash& Hash); - ZENCORE_API CbAttachment(CompressedBuffer&& InValue, const IoHash& Hash); + CbAttachment(const CompressedBuffer& InValue, const IoHash& Hash); + CbAttachment(CompressedBuffer&& InValue, const IoHash& Hash); /** Construct a binary attachment. Value is cloned if not owned. */ - ZENCORE_API CbAttachment(CompositeBuffer&& InValue, const IoHash& Hash); + CbAttachment(CompositeBuffer&& InValue, const IoHash& Hash); /** Reset this to a null attachment. */ inline void Reset() { *this = CbAttachment(); } @@ -76,31 +76,31 @@ public: inline explicit operator bool() const { return !IsNull(); } /** Whether the attachment has a value. */ - ZENCORE_API [[nodiscard]] bool IsNull() const; + [[nodiscard]] bool IsNull() const; /** Access the attachment as binary. Defaults to a null buffer on error. */ - ZENCORE_API [[nodiscard]] SharedBuffer AsBinary() const; + [[nodiscard]] SharedBuffer AsBinary() const; /** Access the attachment as raw binary. Defaults to a null buffer on error. */ - ZENCORE_API [[nodiscard]] const CompositeBuffer& AsCompositeBinary() const; + [[nodiscard]] const CompositeBuffer& AsCompositeBinary() const; /** Access the attachment as compressed binary. Defaults to a null buffer if the attachment is null. */ - ZENCORE_API [[nodiscard]] const CompressedBuffer& AsCompressedBinary() const; + [[nodiscard]] const CompressedBuffer& AsCompressedBinary() const; /** Access the attachment as compact binary. Defaults to a field iterator with no value on error. */ - ZENCORE_API [[nodiscard]] CbObject AsObject() const; + [[nodiscard]] CbObject AsObject() const; /** Returns true if the attachment is binary */ - ZENCORE_API [[nodiscard]] bool IsBinary() const; + [[nodiscard]] bool IsBinary() const; /** Returns true if the attachment is compressed binary */ - ZENCORE_API [[nodiscard]] bool IsCompressedBinary() const; + [[nodiscard]] bool IsCompressedBinary() const; /** Returns whether the attachment is an object. */ - ZENCORE_API [[nodiscard]] bool IsObject() const; + [[nodiscard]] bool IsObject() const; /** Returns the hash of the attachment value. */ - ZENCORE_API [[nodiscard]] IoHash GetHash() const; + [[nodiscard]] IoHash GetHash() const; /** Compares attachments by their hash. Any discrepancy in type must be handled externally. */ inline bool operator==(const CbAttachment& Attachment) const { return GetHash() == Attachment.GetHash(); } @@ -114,27 +114,27 @@ public: * * The iterator is advanced as attachment fields are consumed from it. */ - ZENCORE_API bool TryLoad(CbFieldIterator& Fields); + bool TryLoad(CbFieldIterator& Fields); /** * Load the attachment from compact binary as written by Save. */ - ZENCORE_API bool TryLoad(BinaryReader& Reader, BufferAllocator Allocator = UniqueBuffer::Alloc); + bool TryLoad(BinaryReader& Reader, BufferAllocator Allocator = UniqueBuffer::Alloc); /** * Load the attachment from compact binary as written by Save. */ - ZENCORE_API bool TryLoad(IoBuffer& Buffer, BufferAllocator Allocator = UniqueBuffer::Alloc); + bool TryLoad(IoBuffer& Buffer, BufferAllocator Allocator = UniqueBuffer::Alloc); /** Save the attachment into the writer as a stream of compact binary fields. */ - ZENCORE_API void Save(CbWriter& Writer) const; + void Save(CbWriter& Writer) const; /** Save the attachment into the writer as a stream of compact binary fields. */ - ZENCORE_API void Save(BinaryWriter& Writer) const; + void Save(BinaryWriter& Writer) const; private: - ZENCORE_API CbAttachment(const CbObject& Value, const IoHash* Hash); - ZENCORE_API explicit CbAttachment(CompositeBuffer&& InValue); + CbAttachment(const CbObject& Value, const IoHash* Hash); + explicit CbAttachment(CompositeBuffer&& InValue); IoHash Hash; std::variant<std::nullptr_t, CbObject, CompositeBuffer, CompressedBuffer> Value; @@ -278,7 +278,7 @@ public: * @return The attachment, or null if the attachment is not found. * @note The returned pointer is only valid until the attachments on this package are modified. */ - ZENCORE_API const CbAttachment* FindAttachment(const IoHash& Hash) const; + const CbAttachment* FindAttachment(const IoHash& Hash) const; /** Find an attachment if it exists in the package. */ inline const CbAttachment* FindAttachment(const CbAttachment& Attachment) const { return FindAttachment(Attachment.GetHash()); } @@ -298,13 +298,13 @@ public: * * @return Number of attachments removed, which will be either 0 or 1. */ - ZENCORE_API int32_t RemoveAttachment(const IoHash& Hash); - inline int32_t RemoveAttachment(const CbAttachment& Attachment) { return RemoveAttachment(Attachment.GetHash()); } + int32_t RemoveAttachment(const IoHash& Hash); + inline int32_t RemoveAttachment(const CbAttachment& Attachment) { return RemoveAttachment(Attachment.GetHash()); } /** Compares packages by their object and attachment hashes. */ - ZENCORE_API bool Equals(const CbPackage& Package) const; - inline bool operator==(const CbPackage& Package) const { return Equals(Package); } - inline bool operator!=(const CbPackage& Package) const { return !Equals(Package); } + bool Equals(const CbPackage& Package) const; + inline bool operator==(const CbPackage& Package) const { return Equals(Package); } + inline bool operator!=(const CbPackage& Package) const { return !Equals(Package); } /** * Load the object and attachments from compact binary as written by Save. @@ -314,19 +314,19 @@ public: * * The iterator is advanced as object and attachment fields are consumed from it. */ - ZENCORE_API bool TryLoad(CbFieldIterator& Fields); - ZENCORE_API bool TryLoad(IoBuffer Buffer, BufferAllocator Allocator = UniqueBuffer::Alloc, AttachmentResolver* Mapper = nullptr); - ZENCORE_API bool TryLoad(BinaryReader& Reader, BufferAllocator Allocator = UniqueBuffer::Alloc, AttachmentResolver* Mapper = nullptr); + bool TryLoad(CbFieldIterator& Fields); + bool TryLoad(IoBuffer Buffer, BufferAllocator Allocator = UniqueBuffer::Alloc, AttachmentResolver* Mapper = nullptr); + bool TryLoad(BinaryReader& Reader, BufferAllocator Allocator = UniqueBuffer::Alloc, AttachmentResolver* Mapper = nullptr); /** Save the object and attachments into the writer as a stream of compact binary fields. */ - ZENCORE_API void Save(CbWriter& Writer) const; + void Save(CbWriter& Writer) const; /** Save the object and attachments into the writer as a stream of compact binary fields. */ - ZENCORE_API void Save(BinaryWriter& Writer) const; + void Save(BinaryWriter& Writer) const; private: - ZENCORE_API void SetObject(CbObject Object, const IoHash* Hash, AttachmentResolver* Resolver); - ZENCORE_API void AddAttachment(const CbAttachment& Attachment, AttachmentResolver* Resolver); + void SetObject(CbObject Object, const IoHash* Hash, AttachmentResolver* Resolver); + void AddAttachment(const CbAttachment& Attachment, AttachmentResolver* Resolver); void GatherAttachments(const CbObject& Object, AttachmentResolver Resolver); diff --git a/src/zencore/include/zencore/compactbinaryvalidation.h b/src/zencore/include/zencore/compactbinaryvalidation.h index ddecc8a38..1fade1bc4 100644 --- a/src/zencore/include/zencore/compactbinaryvalidation.h +++ b/src/zencore/include/zencore/compactbinaryvalidation.h @@ -150,7 +150,7 @@ std::string ToString(const CbValidateError Error); * @param Type HasFieldType means that View contains the type. Otherwise, use the given type. * @return None on success, otherwise the flags for the types of errors that were detected. */ -ZENCORE_API CbValidateError ValidateCompactBinary(MemoryView View, CbValidateMode Mode, CbFieldType Type = CbFieldType::HasFieldType); +CbValidateError ValidateCompactBinary(MemoryView View, CbValidateMode Mode, CbFieldType Type = CbFieldType::HasFieldType); /** * Validate the compact binary data for every field in the view as specified by the mode flags. @@ -161,7 +161,7 @@ ZENCORE_API CbValidateError ValidateCompactBinary(MemoryView View, CbValidateMod * * @see ValidateCompactBinary */ -ZENCORE_API CbValidateError ValidateCompactBinaryRange(MemoryView View, CbValidateMode Mode); +CbValidateError ValidateCompactBinaryRange(MemoryView View, CbValidateMode Mode); /** * Validate the compact binary attachment pointed to by the view as specified by the mode flags. @@ -175,7 +175,7 @@ ZENCORE_API CbValidateError ValidateCompactBinaryRange(MemoryView View, CbValida * @param Mode A combination of the flags for the types of validation to perform. * @return None on success, otherwise the flags for the types of errors that were detected. */ -ZENCORE_API CbValidateError ValidateObjectAttachment(MemoryView View, CbValidateMode Mode); +CbValidateError ValidateObjectAttachment(MemoryView View, CbValidateMode Mode); /** * Validate the compact binary package pointed to by the view as specified by the mode flags. @@ -189,7 +189,7 @@ ZENCORE_API CbValidateError ValidateObjectAttachment(MemoryView View, CbValidate * @param Mode A combination of the flags for the types of validation to perform. * @return None on success, otherwise the flags for the types of errors that were detected. */ -ZENCORE_API CbValidateError ValidateCompactBinaryPackage(MemoryView View, CbValidateMode Mode); +CbValidateError ValidateCompactBinaryPackage(MemoryView View, CbValidateMode Mode); /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/src/zencore/include/zencore/compositebuffer.h b/src/zencore/include/zencore/compositebuffer.h index 1e1611de9..095ba3803 100644 --- a/src/zencore/include/zencore/compositebuffer.h +++ b/src/zencore/include/zencore/compositebuffer.h @@ -43,10 +43,10 @@ public: } /** Reset this to null. */ - ZENCORE_API void Reset(); + void Reset(); /** Returns the total size of the composite buffer in bytes. */ - [[nodiscard]] ZENCORE_API uint64_t GetSize() const; + [[nodiscard]] uint64_t GetSize() const; /** Returns the segments that the buffer is composed from. */ [[nodiscard]] inline std::span<const SharedBuffer> GetSegments() const @@ -61,22 +61,22 @@ public: [[nodiscard]] inline bool IsNull() const { return m_Segments.empty(); } /** Returns true if every segment in the composite buffer is owned. */ - [[nodiscard]] ZENCORE_API bool IsOwned() const; + [[nodiscard]] bool IsOwned() const; /** Returns a copy of the buffer where every segment is owned. */ - [[nodiscard]] ZENCORE_API CompositeBuffer MakeOwned() const&; - [[nodiscard]] ZENCORE_API CompositeBuffer MakeOwned() &&; + [[nodiscard]] CompositeBuffer MakeOwned() const&; + [[nodiscard]] CompositeBuffer MakeOwned() &&; /** Returns the concatenation of the segments into a contiguous buffer. */ [[nodiscard]] inline SharedBuffer Flatten() const& { return ToShared(); } [[nodiscard]] inline SharedBuffer Flatten() && { return ToShared(); } /** Returns the concatenation of the segments into a contiguous buffer. */ - [[nodiscard]] ZENCORE_API SharedBuffer ToShared() const&; - [[nodiscard]] ZENCORE_API SharedBuffer ToShared() &&; + [[nodiscard]] SharedBuffer ToShared() const&; + [[nodiscard]] SharedBuffer ToShared() &&; /** Returns the middle part of the buffer by taking the size starting at the offset. */ - [[nodiscard]] ZENCORE_API CompositeBuffer Mid(uint64_t Offset, uint64_t Size = ~uint64_t(0)) const; + [[nodiscard]] CompositeBuffer Mid(uint64_t Offset, uint64_t Size = ~uint64_t(0)) const; /** * Returns a view of the range if contained by one segment, otherwise a view of a copy of the range. @@ -88,10 +88,10 @@ public: * @param CopyBuffer The buffer to write the copy into if a copy is required. * @param Allocator The optional allocator to use when the copy buffer is required. */ - [[nodiscard]] ZENCORE_API MemoryView ViewOrCopyRange(uint64_t Offset, - uint64_t Size, - UniqueBuffer& CopyBuffer, - std::function<UniqueBuffer(uint64_t Size)> Allocator = UniqueBuffer::Alloc) const; + [[nodiscard]] MemoryView ViewOrCopyRange(uint64_t Offset, + uint64_t Size, + UniqueBuffer& CopyBuffer, + std::function<UniqueBuffer(uint64_t Size)> Allocator = UniqueBuffer::Alloc) const; /** * Copies a range of the buffer to a contiguous region of memory. @@ -99,7 +99,7 @@ public: * @param Target The view to copy to. Must be no larger than the data available at the offset. * @param Offset The byte offset in this buffer to start copying from. */ - ZENCORE_API void CopyTo(MutableMemoryView Target, uint64_t Offset = 0) const; + void CopyTo(MutableMemoryView Target, uint64_t Offset = 0) const; /** * Invokes a visitor with a view of each segment that intersects with a range. @@ -108,19 +108,17 @@ public: * @param Size The number of bytes in the range to visit. * @param Visitor The visitor to invoke from zero to GetSegments().Num() times. */ - ZENCORE_API void IterateRange(uint64_t Offset, uint64_t Size, std::function<void(MemoryView View)> Visitor) const; - ZENCORE_API void IterateRange(uint64_t Offset, - uint64_t Size, - std::function<void(MemoryView View, const SharedBuffer& ViewOuter)> Visitor) const; + void IterateRange(uint64_t Offset, uint64_t Size, std::function<void(MemoryView View)> Visitor) const; + void IterateRange(uint64_t Offset, uint64_t Size, std::function<void(MemoryView View, const SharedBuffer& ViewOuter)> Visitor) const; struct Iterator { size_t SegmentIndex = 0; uint64_t OffsetInSegment = 0; }; - ZENCORE_API Iterator GetIterator(uint64_t Offset) const; - ZENCORE_API MemoryView ViewOrCopyRange(Iterator& It, uint64_t Size, UniqueBuffer& CopyBuffer) const; - ZENCORE_API void CopyTo(MutableMemoryView Target, Iterator& It) const; + Iterator GetIterator(uint64_t Offset) const; + MemoryView ViewOrCopyRange(Iterator& It, uint64_t Size, UniqueBuffer& CopyBuffer) const; + void CopyTo(MutableMemoryView Target, Iterator& It) const; /** A null composite buffer. */ static const CompositeBuffer Null; diff --git a/src/zencore/include/zencore/compress.h b/src/zencore/include/zencore/compress.h index 3802a8c31..ed21296c2 100644 --- a/src/zencore/include/zencore/compress.h +++ b/src/zencore/include/zencore/compress.h @@ -66,15 +66,15 @@ public: * @param BlockSize The power-of-two block size to encode raw data in. 0 is default. * @return An owned compressed buffer, or null on error. */ - [[nodiscard]] ZENCORE_API static CompressedBuffer Compress(const CompositeBuffer& RawData, - OodleCompressor Compressor = OodleCompressor::Mermaid, - OodleCompressionLevel CompressionLevel = OodleCompressionLevel::VeryFast, - uint64_t BlockSize = 0); - [[nodiscard]] ZENCORE_API static CompressedBuffer Compress(const SharedBuffer& RawData, - OodleCompressor Compressor = OodleCompressor::Mermaid, - OodleCompressionLevel CompressionLevel = OodleCompressionLevel::VeryFast, - uint64_t BlockSize = 0); - [[nodiscard]] ZENCORE_API static bool CompressToStream( + [[nodiscard]] static CompressedBuffer Compress(const CompositeBuffer& RawData, + OodleCompressor Compressor = OodleCompressor::Mermaid, + OodleCompressionLevel CompressionLevel = OodleCompressionLevel::VeryFast, + uint64_t BlockSize = 0); + [[nodiscard]] static CompressedBuffer Compress(const SharedBuffer& RawData, + OodleCompressor Compressor = OodleCompressor::Mermaid, + OodleCompressionLevel CompressionLevel = OodleCompressionLevel::VeryFast, + uint64_t BlockSize = 0); + [[nodiscard]] static bool CompressToStream( const CompositeBuffer& RawData, std::function<void(uint64_t SourceOffset, uint64_t SourceSize, uint64_t Offset, const CompositeBuffer& Range)>&& Callback, OodleCompressor Compressor = OodleCompressor::Mermaid, @@ -86,34 +86,26 @@ public: * * @return A compressed buffer, or null on error, such as an invalid format or corrupt header. */ - [[nodiscard]] ZENCORE_API static CompressedBuffer FromCompressed(const CompositeBuffer& CompressedData, - IoHash& OutRawHash, - uint64_t& OutRawSize); - [[nodiscard]] ZENCORE_API static CompressedBuffer FromCompressed(CompositeBuffer&& CompressedData, - IoHash& OutRawHash, - uint64_t& OutRawSize); - [[nodiscard]] ZENCORE_API static CompressedBuffer FromCompressed(const SharedBuffer& CompressedData, - IoHash& OutRawHash, - uint64_t& OutRawSize); - [[nodiscard]] ZENCORE_API static CompressedBuffer FromCompressed(SharedBuffer&& CompressedData, - IoHash& OutRawHash, - uint64_t& OutRawSize); - [[nodiscard]] ZENCORE_API static CompressedBuffer FromCompressedNoValidate(IoBuffer&& CompressedData); - [[nodiscard]] ZENCORE_API static CompressedBuffer FromCompressedNoValidate(CompositeBuffer&& CompressedData); - [[nodiscard]] ZENCORE_API static bool ValidateCompressedHeader(IoBuffer&& CompressedData, - IoHash& OutRawHash, - uint64_t& OutRawSize, - uint64_t* OutOptionalTotalCompressedSize); - [[nodiscard]] ZENCORE_API static bool ValidateCompressedHeader(const IoBuffer& CompressedData, - IoHash& OutRawHash, - uint64_t& OutRawSize, - uint64_t* OutOptionalTotalCompressedSize); - [[nodiscard]] ZENCORE_API static bool ValidateCompressedHeader(const CompositeBuffer& CompressedData, - IoHash& OutRawHash, - uint64_t& OutRawSize, - uint64_t* OutOptionalTotalCompressedSize); - [[nodiscard]] ZENCORE_API static size_t GetHeaderSizeForNoneEncoder(); - [[nodiscard]] ZENCORE_API static UniqueBuffer CreateHeaderForNoneEncoder(uint64_t RawSize, const BLAKE3& RawHash); + [[nodiscard]] static CompressedBuffer FromCompressed(const CompositeBuffer& CompressedData, IoHash& OutRawHash, uint64_t& OutRawSize); + [[nodiscard]] static CompressedBuffer FromCompressed(CompositeBuffer&& CompressedData, IoHash& OutRawHash, uint64_t& OutRawSize); + [[nodiscard]] static CompressedBuffer FromCompressed(const SharedBuffer& CompressedData, IoHash& OutRawHash, uint64_t& OutRawSize); + [[nodiscard]] static CompressedBuffer FromCompressed(SharedBuffer&& CompressedData, IoHash& OutRawHash, uint64_t& OutRawSize); + [[nodiscard]] static CompressedBuffer FromCompressedNoValidate(IoBuffer&& CompressedData); + [[nodiscard]] static CompressedBuffer FromCompressedNoValidate(CompositeBuffer&& CompressedData); + [[nodiscard]] static bool ValidateCompressedHeader(IoBuffer&& CompressedData, + IoHash& OutRawHash, + uint64_t& OutRawSize, + uint64_t* OutOptionalTotalCompressedSize); + [[nodiscard]] static bool ValidateCompressedHeader(const IoBuffer& CompressedData, + IoHash& OutRawHash, + uint64_t& OutRawSize, + uint64_t* OutOptionalTotalCompressedSize); + [[nodiscard]] static bool ValidateCompressedHeader(const CompositeBuffer& CompressedData, + IoHash& OutRawHash, + uint64_t& OutRawSize, + uint64_t* OutOptionalTotalCompressedSize); + [[nodiscard]] static size_t GetHeaderSizeForNoneEncoder(); + [[nodiscard]] static UniqueBuffer CreateHeaderForNoneEncoder(uint64_t RawSize, const BLAKE3& RawHash); /** Reset this to null. */ inline void Reset() { CompressedData.Reset(); } @@ -139,10 +131,10 @@ public: [[nodiscard]] inline uint64_t GetCompressedSize() const { return CompressedData.GetSize(); } /** Returns the size of the raw data. Zero on error or if this is empty or null. */ - [[nodiscard]] ZENCORE_API uint64_t DecodeRawSize() const; + [[nodiscard]] uint64_t DecodeRawSize() const; /** Returns the hash of the raw data. Zero on error or if this is null. */ - [[nodiscard]] ZENCORE_API IoHash DecodeRawHash() const; + [[nodiscard]] IoHash DecodeRawHash() const; /** * Returns a block aligned range of a compressed buffer. @@ -159,7 +151,7 @@ public: * * @return A sub-range from the compressed buffer that encompasses RawOffset and RawSize */ - [[nodiscard]] ZENCORE_API CompressedBuffer CopyRange(uint64_t RawOffset, uint64_t RawSize = ~uint64_t(0)) const; + [[nodiscard]] CompressedBuffer CopyRange(uint64_t RawOffset, uint64_t RawSize = ~uint64_t(0)) const; /** * Returns a block aligned range of a compressed buffer. @@ -176,7 +168,7 @@ public: * * @return A sub-range from the compressed buffer that encompasses RawOffset and RawSize */ - [[nodiscard]] ZENCORE_API CompressedBuffer GetRange(uint64_t RawOffset, uint64_t RawSize = ~uint64_t(0)) const; + [[nodiscard]] CompressedBuffer GetRange(uint64_t RawOffset, uint64_t RawSize = ~uint64_t(0)) const; /** * Returns the compressor and compression level used by this buffer. @@ -187,28 +179,28 @@ public: * * @return True if parameters were written, otherwise false. */ - [[nodiscard]] ZENCORE_API bool TryGetCompressParameters(OodleCompressor& OutCompressor, - OodleCompressionLevel& OutCompressionLevel, - uint64_t& OutBlockSize) const; + [[nodiscard]] bool TryGetCompressParameters(OodleCompressor& OutCompressor, + OodleCompressionLevel& OutCompressionLevel, + uint64_t& OutBlockSize) const; /** * Decompress into a memory view that is less or equal GetRawSize() bytes. */ - [[nodiscard]] ZENCORE_API bool TryDecompressTo(MutableMemoryView RawView, uint64_t RawOffset = 0) const; + [[nodiscard]] bool TryDecompressTo(MutableMemoryView RawView, uint64_t RawOffset = 0) const; /** * Decompress into an owned buffer. * * @return An owned buffer containing the raw data, or null on error. */ - [[nodiscard]] ZENCORE_API SharedBuffer Decompress(uint64_t RawOffset = 0, uint64_t RawSize = ~uint64_t(0)) const; + [[nodiscard]] SharedBuffer Decompress(uint64_t RawOffset = 0, uint64_t RawSize = ~uint64_t(0)) const; /** * Decompress into an owned composite buffer. * * @return An owned buffer containing the raw data, or null on error. */ - [[nodiscard]] ZENCORE_API CompositeBuffer DecompressToComposite() const; + [[nodiscard]] CompositeBuffer DecompressToComposite() const; /** * Decompress into and call callback for ranges of decompressed data. @@ -216,7 +208,7 @@ public: * * @return True if the buffer is valid and can be decompressed. */ - [[nodiscard]] ZENCORE_API bool DecompressToStream( + [[nodiscard]] bool DecompressToStream( uint64_t RawOffset, uint64_t RawSize, std::function<bool(uint64_t SourceOffset, uint64_t SourceSize, uint64_t Offset, const CompositeBuffer& Range)>&& Callback) const; diff --git a/src/zencore/include/zencore/except.h b/src/zencore/include/zencore/except.h index c933adfd8..4689c480f 100644 --- a/src/zencore/include/zencore/except.h +++ b/src/zencore/include/zencore/except.h @@ -18,23 +18,23 @@ namespace zen { #if ZEN_PLATFORM_WINDOWS -ZENCORE_API void ThrowSystemException [[noreturn]] (HRESULT hRes, std::string_view Message); +void ThrowSystemException [[noreturn]] (HRESULT hRes, std::string_view Message); #endif // ZEN_PLATFORM_WINDOWS #if defined(__cpp_lib_source_location) -ZENCORE_API void ThrowLastErrorImpl [[noreturn]] (std::string_view Message, const std::source_location& Location); -ZENCORE_API void ThrowOutOfMemoryImpl [[noreturn]] (std::string_view Message, const std::source_location& Location); +void ThrowLastErrorImpl [[noreturn]] (std::string_view Message, const std::source_location& Location); +void ThrowOutOfMemoryImpl [[noreturn]] (std::string_view Message, const std::source_location& Location); # define ThrowLastError(Message) ThrowLastErrorImpl(Message, std::source_location::current()) # define ThrowOutOfMemory(Message) ThrowOutOfMemoryImpl(Message, std::source_location::current()) #else -ZENCORE_API void ThrowLastError [[noreturn]] (std::string_view Message); -ZENCORE_API void ThrowOutOfMemory [[noreturn]] (std::string_view Message); +void ThrowLastError [[noreturn]] (std::string_view Message); +void ThrowOutOfMemory [[noreturn]] (std::string_view Message); #endif -ZENCORE_API void ThrowSystemError [[noreturn]] (uint32_t ErrorCode, std::string_view Message); +void ThrowSystemError [[noreturn]] (uint32_t ErrorCode, std::string_view Message); -ZENCORE_API std::string GetLastErrorAsString(); -ZENCORE_API std::string GetSystemErrorAsString(uint32_t Win32ErrorCode); +std::string GetLastErrorAsString(); +std::string GetSystemErrorAsString(uint32_t Win32ErrorCode); inline int32_t GetLastError() diff --git a/src/zencore/include/zencore/filesystem.h b/src/zencore/include/zencore/filesystem.h index 53cb550c1..e3eafb875 100644 --- a/src/zencore/include/zencore/filesystem.h +++ b/src/zencore/include/zencore/filesystem.h @@ -20,128 +20,128 @@ class WorkerThreadPool; /** Delete directory (after deleting any contents) */ -ZENCORE_API bool DeleteDirectories(const std::filesystem::path& Path); +bool DeleteDirectories(const std::filesystem::path& Path); /** Delete directory (after deleting any contents) */ -ZENCORE_API bool DeleteDirectories(const std::filesystem::path& Path, std::error_code& Ec); +bool DeleteDirectories(const std::filesystem::path& Path, std::error_code& Ec); /** Ensure directory exists. Will also create any required parent direCleanDirectoryctories */ -ZENCORE_API bool CreateDirectories(const std::filesystem::path& Path); +bool CreateDirectories(const std::filesystem::path& Path); /** Ensure directory exists. Will also create any required parent directories */ -ZENCORE_API bool CreateDirectories(const std::filesystem::path& Path, std::error_code& Ec); +bool CreateDirectories(const std::filesystem::path& Path, std::error_code& Ec); /** Ensure directory exists and delete contents (if any) before returning */ -ZENCORE_API bool CleanDirectory(const std::filesystem::path& Path, bool ForceRemoveReadOnlyFiles); +bool CleanDirectory(const std::filesystem::path& Path, bool ForceRemoveReadOnlyFiles); /** Ensure directory exists and delete contents (if any) before returning */ -ZENCORE_API bool CleanDirectory(const std::filesystem::path& Path, bool ForceRemoveReadOnlyFiles, std::error_code& Ec); +bool CleanDirectory(const std::filesystem::path& Path, bool ForceRemoveReadOnlyFiles, std::error_code& Ec); /** Ensure directory exists and delete contents (if any) before returning */ -ZENCORE_API bool CleanDirectoryExceptDotFiles(const std::filesystem::path& Path); +bool CleanDirectoryExceptDotFiles(const std::filesystem::path& Path); /** Map native file handle to a path */ -ZENCORE_API std::filesystem::path PathFromHandle(void* NativeHandle, std::error_code& Ec); +std::filesystem::path PathFromHandle(void* NativeHandle, std::error_code& Ec); /** Get canonical path name from a generic path */ -ZENCORE_API std::filesystem::path CanonicalPath(std::filesystem::path InPath, std::error_code& Ec); +std::filesystem::path CanonicalPath(std::filesystem::path InPath, std::error_code& Ec); /** Query file size */ -ZENCORE_API bool IsFile(const std::filesystem::path& Path); +bool IsFile(const std::filesystem::path& Path); /** Query file size */ -ZENCORE_API bool IsFile(const std::filesystem::path& Path, std::error_code& Ec); +bool IsFile(const std::filesystem::path& Path, std::error_code& Ec); /** Query file size */ -ZENCORE_API bool IsDir(const std::filesystem::path& Path); +bool IsDir(const std::filesystem::path& Path); /** Query file size */ -ZENCORE_API bool IsDir(const std::filesystem::path& Path, std::error_code& Ec); +bool IsDir(const std::filesystem::path& Path, std::error_code& Ec); /** Query file size */ -ZENCORE_API bool RemoveFile(const std::filesystem::path& Path); +bool RemoveFile(const std::filesystem::path& Path); /** Query file size */ -ZENCORE_API bool RemoveFile(const std::filesystem::path& Path, std::error_code& Ec); +bool RemoveFile(const std::filesystem::path& Path, std::error_code& Ec); /** Query file size */ -ZENCORE_API bool RemoveDir(const std::filesystem::path& Path); +bool RemoveDir(const std::filesystem::path& Path); /** Query file size */ -ZENCORE_API bool RemoveDir(const std::filesystem::path& Path, std::error_code& Ec); +bool RemoveDir(const std::filesystem::path& Path, std::error_code& Ec); /** Query file size */ -ZENCORE_API uint64_t FileSizeFromPath(const std::filesystem::path& Path); +uint64_t FileSizeFromPath(const std::filesystem::path& Path); /** Query file size */ -ZENCORE_API uint64_t FileSizeFromPath(const std::filesystem::path& Path, std::error_code& Ec); +uint64_t FileSizeFromPath(const std::filesystem::path& Path, std::error_code& Ec); /** Query file size from native file handle */ -ZENCORE_API uint64_t FileSizeFromHandle(void* NativeHandle); +uint64_t FileSizeFromHandle(void* NativeHandle); /** Query file size from native file handle */ -ZENCORE_API uint64_t FileSizeFromHandle(void* NativeHandle, std::error_code& Ec); +uint64_t FileSizeFromHandle(void* NativeHandle, std::error_code& Ec); /** Get a native time tick of last modification time */ -ZENCORE_API uint64_t GetModificationTickFromHandle(void* NativeHandle, std::error_code& Ec); +uint64_t GetModificationTickFromHandle(void* NativeHandle, std::error_code& Ec); /** Get a native time tick of last modification time */ -ZENCORE_API uint64_t GetModificationTickFromPath(const std::filesystem::path& Filename); +uint64_t GetModificationTickFromPath(const std::filesystem::path& Filename); -ZENCORE_API bool TryGetFileProperties(const std::filesystem::path& Path, - uint64_t& OutSize, - uint64_t& OutModificationTick, - uint32_t& OutNativeModeOrAttributes); +bool TryGetFileProperties(const std::filesystem::path& Path, + uint64_t& OutSize, + uint64_t& OutModificationTick, + uint32_t& OutNativeModeOrAttributes); /** Move a file, if the files are not on the same drive the function will fail */ -ZENCORE_API void RenameFile(const std::filesystem::path& SourcePath, const std::filesystem::path& TargetPath); +void RenameFile(const std::filesystem::path& SourcePath, const std::filesystem::path& TargetPath); /** Move a file, if the files are not on the same drive the function will fail */ -ZENCORE_API void RenameFile(const std::filesystem::path& SourcePath, const std::filesystem::path& TargetPath, std::error_code& Ec); +void RenameFile(const std::filesystem::path& SourcePath, const std::filesystem::path& TargetPath, std::error_code& Ec); /** Move a directory, if the files are not on the same drive the function will fail */ -ZENCORE_API void RenameDirectory(const std::filesystem::path& SourcePath, const std::filesystem::path& TargetPath); +void RenameDirectory(const std::filesystem::path& SourcePath, const std::filesystem::path& TargetPath); /** Move a directory, if the files are not on the same drive the function will fail */ -ZENCORE_API void RenameDirectory(const std::filesystem::path& SourcePath, const std::filesystem::path& TargetPath, std::error_code& Ec); +void RenameDirectory(const std::filesystem::path& SourcePath, const std::filesystem::path& TargetPath, std::error_code& Ec); -ZENCORE_API std::filesystem::path GetRunningExecutablePath(); +std::filesystem::path GetRunningExecutablePath(); /** Set the max open file handle count to max allowed for the current process on Linux and MacOS */ -ZENCORE_API void MaximizeOpenFileCount(); +void MaximizeOpenFileCount(); -ZENCORE_API bool PrepareFileForScatteredWrite(void* FileHandle, uint64_t FinalSize); +bool PrepareFileForScatteredWrite(void* FileHandle, uint64_t FinalSize); struct FileContents { @@ -151,7 +151,7 @@ struct FileContents IoBuffer Flatten(); }; -ZENCORE_API FileContents ReadStdIn(); +FileContents ReadStdIn(); /** Prepare file for reading @@ -159,25 +159,20 @@ ZENCORE_API FileContents ReadStdIn(); IoBuffer referencing the file contents so that it may be read at a later time. This is leveraged to allow sending of data straight from disk cache and other optimizations. */ -ZENCORE_API FileContents ReadFile(const std::filesystem::path& Path); - -ZENCORE_API bool ScanFile(std::filesystem::path Path, uint64_t ChunkSize, std::function<void(const void* Data, size_t Size)>&& ProcessFunc); -ZENCORE_API void WriteFile(std::filesystem::path Path, const IoBuffer* const* Data, size_t BufferCount); -ZENCORE_API void WriteFile(std::filesystem::path Path, IoBuffer Data); -ZENCORE_API void WriteFile(std::filesystem::path Path, CompositeBuffer Data); -ZENCORE_API bool MoveToFile(std::filesystem::path Path, IoBuffer Data); -ZENCORE_API void ScanFile(void* NativeHandle, - uint64_t Offset, - uint64_t Size, - uint64_t ChunkSize, - std::function<void(const void* Data, size_t Size)>&& ProcessFunc); -ZENCORE_API void WriteFile(void* NativeHandle, - const void* Data, - uint64_t Size, - uint64_t FileOffset, - uint64_t ChunkSize, - std::error_code& Ec); -ZENCORE_API void ReadFile(void* NativeHandle, void* Data, uint64_t Size, uint64_t FileOffset, uint64_t ChunkSize, std::error_code& Ec); +FileContents ReadFile(const std::filesystem::path& Path); + +bool ScanFile(std::filesystem::path Path, uint64_t ChunkSize, std::function<void(const void* Data, size_t Size)>&& ProcessFunc); +void WriteFile(std::filesystem::path Path, const IoBuffer* const* Data, size_t BufferCount); +void WriteFile(std::filesystem::path Path, IoBuffer Data); +void WriteFile(std::filesystem::path Path, CompositeBuffer Data); +bool MoveToFile(std::filesystem::path Path, IoBuffer Data); +void ScanFile(void* NativeHandle, + uint64_t Offset, + uint64_t Size, + uint64_t ChunkSize, + std::function<void(const void* Data, size_t Size)>&& ProcessFunc); +void WriteFile(void* NativeHandle, const void* Data, uint64_t Size, uint64_t FileOffset, uint64_t ChunkSize, std::error_code& Ec); +void ReadFile(void* NativeHandle, void* Data, uint64_t Size, uint64_t FileOffset, uint64_t ChunkSize, std::error_code& Ec); class CloneQueryInterface { @@ -198,9 +193,9 @@ public: uint64_t TargetFinalSize) = 0; }; -ZENCORE_API std::unique_ptr<CloneQueryInterface> GetCloneQueryInterface(const std::filesystem::path& TargetDirectory); +std::unique_ptr<CloneQueryInterface> GetCloneQueryInterface(const std::filesystem::path& TargetDirectory); -ZENCORE_API bool TryCloneFile(const std::filesystem::path& FromPath, const std::filesystem::path& ToPath); +bool TryCloneFile(const std::filesystem::path& FromPath, const std::filesystem::path& ToPath); struct CopyFileOptions { @@ -208,16 +203,16 @@ struct CopyFileOptions bool MustClone = false; }; -ZENCORE_API bool CopyFile(const std::filesystem::path& FromPath, const std::filesystem::path& ToPath, const CopyFileOptions& Options); -ZENCORE_API void CopyFile(const std::filesystem::path& FromPath, - const std::filesystem::path& ToPath, - const CopyFileOptions& Options, - std::error_code& OutError); -ZENCORE_API void CopyTree(std::filesystem::path FromPath, std::filesystem::path ToPath, const CopyFileOptions& Options); -ZENCORE_API bool SupportsBlockRefCounting(std::filesystem::path Path); +bool CopyFile(const std::filesystem::path& FromPath, const std::filesystem::path& ToPath, const CopyFileOptions& Options); +void CopyFile(const std::filesystem::path& FromPath, + const std::filesystem::path& ToPath, + const CopyFileOptions& Options, + std::error_code& OutError); +void CopyTree(std::filesystem::path FromPath, std::filesystem::path ToPath, const CopyFileOptions& Options); +bool SupportsBlockRefCounting(std::filesystem::path Path); -ZENCORE_API void PathToUtf8(const std::filesystem::path& Path, StringBuilderBase& Out); -ZENCORE_API std::string PathToUtf8(const std::filesystem::path& Path); +void PathToUtf8(const std::filesystem::path& Path, StringBuilderBase& Out); +std::string PathToUtf8(const std::filesystem::path& Path); extern template class StringBuilderImpl<std::filesystem::path::value_type>; @@ -291,7 +286,7 @@ struct DiskSpace uint64_t Total{}; }; -ZENCORE_API DiskSpace DiskSpaceInfo(std::filesystem::path Directory, std::error_code& Error); +DiskSpace DiskSpaceInfo(std::filesystem::path Directory, std::error_code& Error); inline bool DiskSpaceInfo(std::filesystem::path Directory, DiskSpace& Space) diff --git a/src/zencore/include/zencore/iobuffer.h b/src/zencore/include/zencore/iobuffer.h index 1b2d382ee..182768ff6 100644 --- a/src/zencore/include/zencore/iobuffer.h +++ b/src/zencore/include/zencore/iobuffer.h @@ -98,9 +98,9 @@ public: { } - ZENCORE_API explicit IoBufferCore(size_t SizeBytes); - ZENCORE_API IoBufferCore(size_t SizeBytes, size_t Alignment); - ZENCORE_API ~IoBufferCore(); + explicit IoBufferCore(size_t SizeBytes); + IoBufferCore(size_t SizeBytes, size_t Alignment); + ~IoBufferCore(); void* operator new(size_t Size); void operator delete(void* Ptr); @@ -129,9 +129,9 @@ public: // - ZENCORE_API void Materialize() const; - ZENCORE_API void DeleteThis() const; - ZENCORE_API void MakeOwned(bool Immutable = true); + void Materialize() const; + void DeleteThis() const; + void MakeOwned(bool Immutable = true); inline void EnsureDataValid() const { @@ -172,7 +172,7 @@ public: inline IoBufferExtendedCore* ExtendedCore(); inline const IoBufferExtendedCore* ExtendedCore() const; - ZENCORE_API void* MutableDataPointer() const; + void* MutableDataPointer() const; inline const void* DataPointer() const { @@ -356,15 +356,15 @@ public: /** Create an uninitialized buffer of the given size */ - ZENCORE_API explicit IoBuffer(size_t InSize); + explicit IoBuffer(size_t InSize); /** Create an uninitialized buffer of the given size with the specified alignment */ - ZENCORE_API explicit IoBuffer(size_t InSize, uint64_t InAlignment); + explicit IoBuffer(size_t InSize, uint64_t InAlignment); /** Create a buffer which references a sequence of bytes inside another buffer */ - ZENCORE_API IoBuffer(const IoBuffer& OuterBuffer, size_t Offset, size_t SizeBytes = ~0ull); + IoBuffer(const IoBuffer& OuterBuffer, size_t Offset, size_t SizeBytes = ~0ull); /** Create a buffer which references a range of bytes which we assume will live * for the entire life time. @@ -376,8 +376,8 @@ public: memcpy(const_cast<void*>(m_Core->DataPointer()), DataPtr, SizeBytes); } - ZENCORE_API IoBuffer(EFileTag, void* FileHandle, uint64_t ChunkFileOffset, uint64_t ChunkSize, bool IsWholeFile); - ZENCORE_API IoBuffer(EBorrowedFileTag, void* FileHandle, uint64_t ChunkFileOffset, uint64_t ChunkSize); + IoBuffer(EFileTag, void* FileHandle, uint64_t ChunkFileOffset, uint64_t ChunkSize, bool IsWholeFile); + IoBuffer(EBorrowedFileTag, void* FileHandle, uint64_t ChunkFileOffset, uint64_t ChunkSize); inline explicit operator bool() const { return !m_Core->IsNull(); } inline operator MemoryView() const& { return MemoryView(m_Core->DataPointer(), m_Core->DataBytes()); } @@ -392,7 +392,7 @@ public: [[nodiscard]] size_t GetSize() const { return m_Core->DataBytes(); } inline void SetContentType(ZenContentType ContentType) { m_Core->SetContentType(ContentType); } [[nodiscard]] inline ZenContentType GetContentType() const { return m_Core->GetContentType(); } - [[nodiscard]] ZENCORE_API bool GetFileReference(IoBufferFileReference& OutRef) const; + [[nodiscard]] bool GetFileReference(IoBufferFileReference& OutRef) const; void SetDeleteOnClose(bool DeleteOnClose); inline MemoryView GetView() const { return MemoryView(m_Core->DataPointer(), m_Core->DataBytes()); } @@ -426,14 +426,14 @@ private: class IoBufferBuilder { public: - ZENCORE_API static IoBuffer MakeFromFile(const std::filesystem::path& FileName, uint64_t Offset = 0, uint64_t Size = ~0ull); - ZENCORE_API static IoBuffer MakeFromTemporaryFile(const std::filesystem::path& FileName); - ZENCORE_API static IoBuffer MakeFromFileHandle(void* FileHandle, uint64_t Offset = 0, uint64_t Size = ~0ull); + static IoBuffer MakeFromFile(const std::filesystem::path& FileName, uint64_t Offset = 0, uint64_t Size = ~0ull); + static IoBuffer MakeFromTemporaryFile(const std::filesystem::path& FileName); + static IoBuffer MakeFromFileHandle(void* FileHandle, uint64_t Offset = 0, uint64_t Size = ~0ull); /** Make sure buffer data is memory resident, but avoid memory mapping data from files */ - ZENCORE_API static IoBuffer ReadFromFileMaybe(const IoBuffer& InBuffer); - inline static IoBuffer MakeFromMemory(MemoryView Memory) { return IoBuffer(IoBuffer::Wrap, Memory.GetData(), Memory.GetSize()); } - inline static IoBuffer MakeCloneFromMemory(const void* Ptr, size_t Sz) + static IoBuffer ReadFromFileMaybe(const IoBuffer& InBuffer); + inline static IoBuffer MakeFromMemory(MemoryView Memory) { return IoBuffer(IoBuffer::Wrap, Memory.GetData(), Memory.GetSize()); } + inline static IoBuffer MakeCloneFromMemory(const void* Ptr, size_t Sz) { if (Sz) { diff --git a/src/zencore/include/zencore/process.h b/src/zencore/include/zencore/process.h index d8d2a2b6b..e3b7a70d7 100644 --- a/src/zencore/include/zencore/process.h +++ b/src/zencore/include/zencore/process.h @@ -71,9 +71,9 @@ using CreateProcResult = void*; // handle to the process using CreateProcResult = int32_t; // pid #endif -ZENCORE_API CreateProcResult CreateProc(const std::filesystem::path& Executable, - std::string_view CommandLine, // should also include arg[0] (executable name) - const CreateProcOptions& Options = {}); +CreateProcResult CreateProc(const std::filesystem::path& Executable, + std::string_view CommandLine, // should also include arg[0] (executable name) + const CreateProcOptions& Options = {}); /** Process monitor - monitors a list of running processes via polling @@ -88,9 +88,9 @@ public: ProcessMonitor(); ~ProcessMonitor(); - ZENCORE_API bool IsRunning(); - ZENCORE_API void AddPid(int Pid); - ZENCORE_API bool IsActive() const; + bool IsRunning(); + void AddPid(int Pid); + bool IsActive() const; private: using HandleType = void*; @@ -99,10 +99,10 @@ private: std::vector<HandleType> m_ProcessHandles; }; -ZENCORE_API bool IsProcessRunning(int pid); -ZENCORE_API bool IsProcessRunning(int pid, std::error_code& OutEc); -ZENCORE_API int GetCurrentProcessId(); -int GetProcessId(CreateProcResult ProcId); +bool IsProcessRunning(int pid); +bool IsProcessRunning(int pid, std::error_code& OutEc); +int GetCurrentProcessId(); +int GetProcessId(CreateProcResult ProcId); std::filesystem::path GetProcessExecutablePath(int Pid, std::error_code& OutEc); std::error_code FindProcess(const std::filesystem::path& ExecutableImage, ProcessHandle& OutHandle, bool IncludeSelf = true); diff --git a/src/zencore/include/zencore/session.h b/src/zencore/include/zencore/session.h index 52289b7ef..10c33da24 100644 --- a/src/zencore/include/zencore/session.h +++ b/src/zencore/include/zencore/session.h @@ -9,7 +9,7 @@ namespace zen { struct Oid; -ZENCORE_API [[nodiscard]] Oid GetSessionId(); -ZENCORE_API [[nodiscard]] std::string_view GetSessionIdString(); +[[nodiscard]] Oid GetSessionId(); +[[nodiscard]] std::string_view GetSessionIdString(); } // namespace zen diff --git a/src/zencore/include/zencore/sharedbuffer.h b/src/zencore/include/zencore/sharedbuffer.h index 7df5109cb..c57e9f568 100644 --- a/src/zencore/include/zencore/sharedbuffer.h +++ b/src/zencore/include/zencore/sharedbuffer.h @@ -28,7 +28,7 @@ public: UniqueBuffer(const UniqueBuffer&) = delete; UniqueBuffer& operator=(const UniqueBuffer&) = delete; - ZENCORE_API explicit UniqueBuffer(IoBufferCore* Owner); + explicit UniqueBuffer(IoBufferCore* Owner); [[nodiscard]] void* GetData() { return m_Buffer ? m_Buffer->MutableDataPointer() : nullptr; } [[nodiscard]] const void* GetData() const { return m_Buffer ? m_Buffer->DataPointer() : nullptr; } @@ -45,23 +45,23 @@ public: [[nodiscard]] inline bool IsNull() const { return m_Buffer.IsNull(); } /** Reset this to null. */ - ZENCORE_API void Reset(); + void Reset(); [[nodiscard]] inline MutableMemoryView GetMutableView() { return MutableMemoryView(GetData(), GetSize()); } [[nodiscard]] inline MemoryView GetView() const { return MemoryView(GetData(), GetSize()); } /** Make an uninitialized owned buffer of the specified size. */ - [[nodiscard]] ZENCORE_API static UniqueBuffer Alloc(uint64_t Size); + [[nodiscard]] static UniqueBuffer Alloc(uint64_t Size); /** Make a non-owned view of the input. */ - [[nodiscard]] ZENCORE_API static UniqueBuffer MakeMutableView(void* DataPtr, uint64_t Size); + [[nodiscard]] static UniqueBuffer MakeMutableView(void* DataPtr, uint64_t Size); /** * Convert this to an immutable shared buffer, leaving this null. * * Steals the buffer owner from the unique buffer. */ - [[nodiscard]] ZENCORE_API SharedBuffer MoveToShared(); + [[nodiscard]] SharedBuffer MoveToShared(); private: // This may be null, for a default constructed UniqueBuffer only @@ -77,11 +77,11 @@ class SharedBuffer { public: SharedBuffer() = default; - ZENCORE_API explicit SharedBuffer(UniqueBuffer&&); + explicit SharedBuffer(UniqueBuffer&&); inline explicit SharedBuffer(IoBufferCore* Owner) : m_Buffer(Owner) {} - ZENCORE_API explicit SharedBuffer(IoBuffer&& Buffer) : m_Buffer(std::move(Buffer.m_Core)) {} - ZENCORE_API explicit SharedBuffer(const IoBuffer& Buffer) : m_Buffer(Buffer.m_Core) {} - ZENCORE_API explicit SharedBuffer(RefPtr<IoBufferCore>&& Owner) : m_Buffer(std::move(Owner)) {} + explicit SharedBuffer(IoBuffer&& Buffer) : m_Buffer(std::move(Buffer.m_Core)) {} + explicit SharedBuffer(const IoBuffer& Buffer) : m_Buffer(Buffer.m_Core) {} + explicit SharedBuffer(RefPtr<IoBufferCore>&& Owner) : m_Buffer(std::move(Owner)) {} [[nodiscard]] const void* GetData() const { @@ -108,8 +108,8 @@ public: } /** Returns a buffer that is owned, by cloning if not owned. */ - [[nodiscard]] ZENCORE_API SharedBuffer MakeOwned() const&; - [[nodiscard]] ZENCORE_API SharedBuffer MakeOwned() &&; + [[nodiscard]] SharedBuffer MakeOwned() const&; + [[nodiscard]] SharedBuffer MakeOwned() &&; [[nodiscard]] bool IsOwned() const { return !m_Buffer || m_Buffer->IsOwned(); } [[nodiscard]] inline bool IsNull() const { return !m_Buffer; } @@ -161,13 +161,13 @@ public: return MakeView(Span.data(), Span.size() * sizeof(typename decltype(Span)::element_type)); } /** Make a non-owned view of the input */ - [[nodiscard]] ZENCORE_API static SharedBuffer MakeView(const void* Data, uint64_t Size); + [[nodiscard]] static SharedBuffer MakeView(const void* Data, uint64_t Size); /** Make a non-owned view of the input */ - [[nodiscard]] ZENCORE_API static SharedBuffer MakeView(MemoryView View, SharedBuffer OuterBuffer); + [[nodiscard]] static SharedBuffer MakeView(MemoryView View, SharedBuffer OuterBuffer); /** Make an owned clone of the buffer */ - [[nodiscard]] ZENCORE_API SharedBuffer Clone(); + [[nodiscard]] SharedBuffer Clone(); /** Make an owned clone of the memory in the input view */ - [[nodiscard]] ZENCORE_API static SharedBuffer Clone(MemoryView View); + [[nodiscard]] static SharedBuffer Clone(MemoryView View); private: RefPtr<IoBufferCore> m_Buffer; diff --git a/src/zencore/include/zencore/string.h b/src/zencore/include/zencore/string.h index 5abdaf413..cbff6454f 100644 --- a/src/zencore/include/zencore/string.h +++ b/src/zencore/include/zencore/string.h @@ -85,14 +85,14 @@ StringLength(const char16_t* str) // File name helpers // -ZENCORE_API const char* FilepathFindExtension(const std::string_view& path, const char* extensionToMatch = nullptr); +const char* FilepathFindExtension(const std::string_view& path, const char* extensionToMatch = nullptr); ////////////////////////////////////////////////////////////////////////// // Text formatting of numbers // -ZENCORE_API bool ToString(std::span<char> Buffer, uint64_t Num); -ZENCORE_API bool ToString(std::span<char> Buffer, int64_t Num); +bool ToString(std::span<char> Buffer, uint64_t Num); +bool ToString(std::span<char> Buffer, int64_t Num); struct TextNumBase { @@ -120,7 +120,7 @@ class StringBuilderImpl { public: StringBuilderImpl() = default; - ZENCORE_API ~StringBuilderImpl(); + ~StringBuilderImpl(); StringBuilderImpl(const StringBuilderImpl&) = delete; StringBuilderImpl(const StringBuilderImpl&&) = delete; @@ -368,11 +368,11 @@ protected: Extend(ExtraRequired); } - ZENCORE_API void Extend(size_t ExtraCapacity); - ZENCORE_API void* AllocBuffer(size_t ByteCount); - ZENCORE_API void FreeBuffer(void* Buffer, size_t ByteCount); + void Extend(size_t ExtraCapacity); + void* AllocBuffer(size_t ByteCount); + void FreeBuffer(void* Buffer, size_t ByteCount); - ZENCORE_API [[noreturn]] void Fail(const char* FailReason); // note: throws exception + [[noreturn]] void Fail(const char* FailReason); // note: throws exception C* m_Base; C* m_CurPos; @@ -702,11 +702,11 @@ std::string UrlDecode(std::string_view InUrl); // Format numbers for humans // -ZENCORE_API size_t NiceNumToBuffer(uint64_t Num, std::span<char> Buffer); -ZENCORE_API size_t NiceBytesToBuffer(uint64_t Num, std::span<char> Buffer); -ZENCORE_API size_t NiceByteRateToBuffer(uint64_t Num, uint64_t ms, std::span<char> Buffer); -ZENCORE_API size_t NiceLatencyNsToBuffer(uint64_t NanoSeconds, std::span<char> Buffer); -ZENCORE_API size_t NiceTimeSpanMsToBuffer(uint64_t Milliseconds, std::span<char> Buffer); +size_t NiceNumToBuffer(uint64_t Num, std::span<char> Buffer); +size_t NiceBytesToBuffer(uint64_t Num, std::span<char> Buffer); +size_t NiceByteRateToBuffer(uint64_t Num, uint64_t ms, std::span<char> Buffer); +size_t NiceLatencyNsToBuffer(uint64_t NanoSeconds, std::span<char> Buffer); +size_t NiceTimeSpanMsToBuffer(uint64_t Milliseconds, std::span<char> Buffer); struct NiceBase { diff --git a/src/zencore/include/zencore/thread.h b/src/zencore/include/zencore/thread.h index 9fe6dfb9b..de8f9399c 100644 --- a/src/zencore/include/zencore/thread.h +++ b/src/zencore/include/zencore/thread.h @@ -27,11 +27,11 @@ void SetCurrentThreadName(std::string_view ThreadName); class RwLock { public: - ZENCORE_API void AcquireShared() noexcept; - ZENCORE_API void ReleaseShared() noexcept; + void AcquireShared() noexcept; + void ReleaseShared() noexcept; - ZENCORE_API void AcquireExclusive() noexcept; - ZENCORE_API void ReleaseExclusive() noexcept; + void AcquireExclusive() noexcept; + void ReleaseExclusive() noexcept; struct SharedLockScope { @@ -100,8 +100,8 @@ private: class Event { public: - ZENCORE_API Event(); - ZENCORE_API ~Event(); + Event(); + ~Event(); Event(Event&& Rhs) noexcept : m_EventHandle(Rhs.m_EventHandle.load()) { Rhs.m_EventHandle = nullptr; } @@ -110,10 +110,10 @@ public: Event& operator=(Event&& Rhs) = delete; - ZENCORE_API void Set(); - ZENCORE_API void Reset(); - ZENCORE_API bool Wait(int TimeoutMs = -1); - ZENCORE_API void Close(); + void Set(); + void Reset(); + bool Wait(int TimeoutMs = -1); + void Close(); #if ZEN_USE_WINDOWS_EVENTS inline void* GetWindowsHandle() { return m_EventHandle; } @@ -131,11 +131,11 @@ class NamedEvent { public: NamedEvent() = default; - ZENCORE_API explicit NamedEvent(std::string_view EventName); - ZENCORE_API ~NamedEvent(); - ZENCORE_API void Close(); - ZENCORE_API std::error_code Set(); - ZENCORE_API bool Wait(int TimeoutMs = -1); + explicit NamedEvent(std::string_view EventName); + ~NamedEvent(); + void Close(); + std::error_code Set(); + bool Wait(int TimeoutMs = -1); NamedEvent(NamedEvent&& Rhs) noexcept : m_EventHandle(Rhs.m_EventHandle.load()) { Rhs.m_EventHandle = nullptr; } @@ -162,9 +162,9 @@ class NamedMutex public: ~NamedMutex(); - ZENCORE_API [[nodiscard]] bool Create(std::string_view MutexName); + [[nodiscard]] bool Create(std::string_view MutexName); - ZENCORE_API static bool Exists(std::string_view MutexName); + static bool Exists(std::string_view MutexName); private: void* m_MutexHandle = nullptr; diff --git a/src/zencore/include/zencore/timer.h b/src/zencore/include/zencore/timer.h index 767dc4314..1df2b0bc5 100644 --- a/src/zencore/include/zencore/timer.h +++ b/src/zencore/include/zencore/timer.h @@ -16,10 +16,10 @@ namespace zen { // High frequency timers -ZENCORE_API uint64_t GetHifreqTimerValue(); -ZENCORE_API uint64_t GetHifreqTimerFrequency(); -ZENCORE_API double GetHifreqTimerToSeconds(); -ZENCORE_API uint64_t GetHifreqTimerFrequencySafe(); // May be used during static init +uint64_t GetHifreqTimerValue(); +uint64_t GetHifreqTimerFrequency(); +double GetHifreqTimerToSeconds(); +uint64_t GetHifreqTimerFrequencySafe(); // May be used during static init // Query time since process was spawned (returns time in ms) @@ -45,7 +45,7 @@ private: // Low frequency timers namespace detail { - extern ZENCORE_API uint64_t g_LofreqTimerValue; + extern uint64_t g_LofreqTimerValue; } // namespace detail inline uint64_t @@ -54,8 +54,8 @@ GetLofreqTimerValue() return detail::g_LofreqTimerValue; } -ZENCORE_API void UpdateLofreqTimerValue(); -ZENCORE_API uint64_t GetLofreqTimerFrequency(); +void UpdateLofreqTimerValue(); +uint64_t GetLofreqTimerFrequency(); void timer_forcelink(); // internal diff --git a/src/zencore/include/zencore/zencore.h b/src/zencore/include/zencore/zencore.h index b5eb3e3e8..177a19fff 100644 --- a/src/zencore/include/zencore/zencore.h +++ b/src/zencore/include/zencore/zencore.h @@ -93,18 +93,17 @@ protected: ////////////////////////////////////////////////////////////////////////// #define ZEN_NOT_IMPLEMENTED(...) ZEN_ASSERT(false, __VA_ARGS__) -#define ZENCORE_API // Placeholder to allow DLL configs in the future (maybe) namespace zen { -ZENCORE_API bool IsApplicationExitRequested(); -ZENCORE_API bool RequestApplicationExit(int ExitCode); -ZENCORE_API int ApplicationExitCode(); -ZENCORE_API bool IsDebuggerPresent(); -ZENCORE_API void SetIsInteractiveSession(bool Value); -ZENCORE_API bool IsInteractiveSession(); +bool IsApplicationExitRequested(); +bool RequestApplicationExit(int ExitCode); +int ApplicationExitCode(); +bool IsDebuggerPresent(); +void SetIsInteractiveSession(bool Value); +bool IsInteractiveSession(); -ZENCORE_API void zencore_forcelinktests(); +void zencore_forcelinktests(); } // namespace zen diff --git a/src/zenhttp/include/zenhttp/httpserver.h b/src/zenhttp/include/zenhttp/httpserver.h index 074e40734..3438a1471 100644 --- a/src/zenhttp/include/zenhttp/httpserver.h +++ b/src/zenhttp/include/zenhttp/httpserver.h @@ -84,8 +84,8 @@ public: */ virtual IoBuffer ReadPayload() = 0; - ZENCORE_API CbObject ReadPayloadObject(); - ZENCORE_API CbPackage ReadPayloadPackage(); + CbObject ReadPayloadObject(); + CbPackage ReadPayloadPackage(); /** Respond with payload diff --git a/src/zenstore/cas.h b/src/zenstore/cas.h index 0f6e2ba9d..47b6e63cc 100644 --- a/src/zenstore/cas.h +++ b/src/zenstore/cas.h @@ -59,7 +59,7 @@ protected: CidStoreConfiguration m_Config; }; -ZENCORE_API std::unique_ptr<CasStore> CreateCasStore(GcManager& Gc); +std::unique_ptr<CasStore> CreateCasStore(GcManager& Gc); void CAS_forcelink(); diff --git a/src/zenstore/include/zenstore/caslog.h b/src/zenstore/include/zenstore/caslog.h index 3d95c9c90..f3dd32fb1 100644 --- a/src/zenstore/include/zenstore/caslog.h +++ b/src/zenstore/include/zenstore/caslog.h @@ -41,8 +41,8 @@ private: static const inline uint8_t MagicSequence[16] = {'.', '-', '=', ' ', 'C', 'A', 'S', 'L', 'O', 'G', 'v', '1', ' ', '=', '-', '.'}; - ZENCORE_API uint32_t ComputeChecksum(); - void Finalize() { Checksum = ComputeChecksum(); } + uint32_t ComputeChecksum(); + void Finalize() { Checksum = ComputeChecksum(); } }; static_assert(sizeof(FileHeader) == 64); |