Merge branch 'develop' into feature/uiwebview

This commit is contained in:
Martín Lucas Golini
2026-06-12 23:41:12 -03:00
19 changed files with 897 additions and 151 deletions

View File

@@ -49,20 +49,31 @@ class EE_API String {
public:
typedef std::vector<size_t> OccTable;
static const OccTable createOccTable( const unsigned char* needle, size_t needleLength );
static const OccTable createOccTable( const unsigned char* needle, size_t needleLength,
bool caseInsensitive = false );
/** @returns haystackLength if not found, otherwise the position */
static size_t search( const unsigned char* haystack, size_t haystackLength,
const unsigned char* needle, const size_t needleLength,
const OccTable& occ );
const OccTable& occ, bool caseInsensitive = false );
/** @returns -1 if not found otherwise the position */
static Int64 find( const std::string& haystack, const std::string& needle,
const size_t& haystackOffset, const OccTable& occ );
const size_t& haystackOffset, const OccTable& occ,
bool caseInsensitive = false );
/** @returns -1 if not found otherwise the position */
static Int64 find( const std::string& haystack, const std::string& needle,
const size_t& haystackOffset = 0 );
const size_t& haystackOffset = 0, bool caseInsensitive = false );
/** @returns -1 if not found otherwise the position */
static Int64 find( std::string_view haystack, std::string_view needle,
const size_t& haystackOffset, const OccTable& occ,
bool caseInsensitive = false );
/** @returns -1 if not found otherwise the position */
static Int64 find( std::string_view haystack, std::string_view needle,
const size_t& haystackOffset = 0, bool caseInsensitive = false );
};
/** @return string hash */
@@ -148,6 +159,10 @@ class EE_API String {
static bool isWholeWord( const std::string& haystack, const std::string& needle,
const Int64& startPos );
/** @return If the needle substring, found starting at startPos is a whole-word. */
static bool isWholeWord( std::string_view haystack, std::string_view needle,
const Int64& startPos );
/** @return If the needle substring, found starting at startPos is a whole-word. */
static bool isWholeWord( const String& haystack, const String& needle, const Int64& startPos );

View File

@@ -0,0 +1,71 @@
#ifndef EE_SYSTEM_FILEMAPPED_HPP
#define EE_SYSTEM_FILEMAPPED_HPP
#include <eepp/config.hpp>
#include <string>
#include <string_view>
namespace EE { namespace System {
class EE_API FileMapped {
public:
enum class Mode { Read, ReadWrite };
FileMapped();
explicit FileMapped( const std::string& path, Mode mode = Mode::Read );
~FileMapped();
FileMapped( const FileMapped& ) = delete;
FileMapped& operator=( const FileMapped& ) = delete;
FileMapped( FileMapped&& other ) noexcept;
FileMapped& operator=( FileMapped&& other ) noexcept;
bool open( const std::string& path, Mode mode = Mode::Read );
void close();
bool flush();
bool isOpen() const { return mOpen; }
bool isMapped() const { return mAddress != nullptr; }
bool isReadWrite() const { return mMode == Mode::ReadWrite; }
const Uint8* data() const { return static_cast<const Uint8*>( mAddress ); }
Uint8* data() { return static_cast<Uint8*>( mAddress ); }
const char* cdata() const { return static_cast<const char*>( mAddress ); }
char* cdata() { return static_cast<char*>( mAddress ); }
std::string_view view() const {
return mAddress ? std::string_view{ cdata(), mSize } : std::string_view{};
}
size_t size() const { return mSize; }
bool empty() const { return mSize == 0; }
const std::string& getLastError() const { return mLastError; }
protected:
void moveFrom( FileMapped&& other ) noexcept;
void clearLastError() { mLastError.clear(); }
void setLastError( const std::string& error ) { mLastError = error; }
void* mAddress{ nullptr };
size_t mSize{ 0 };
Mode mMode{ Mode::Read };
bool mOpen{ false };
std::string mLastError;
#if EE_PLATFORM == EE_PLATFORM_WIN
void* mFileHandle{ nullptr };
void* mMapHandle{ nullptr };
#else
int mFd{ -1 };
#endif
};
}} // namespace EE::System
#endif

View File

@@ -0,0 +1,53 @@
#ifndef EE_SYSTEM_IOSTREAMFILEMAPPED_HPP
#define EE_SYSTEM_IOSTREAMFILEMAPPED_HPP
#include <eepp/system/filemapped.hpp>
#include <eepp/system/iostream.hpp>
namespace EE { namespace System {
class EE_API IOStreamFileMapped : public IOStream {
public:
IOStreamFileMapped();
explicit IOStreamFileMapped( const std::string& path );
explicit IOStreamFileMapped( FileMapped&& file );
~IOStreamFileMapped() override = default;
IOStreamFileMapped( const IOStreamFileMapped& ) = delete;
IOStreamFileMapped& operator=( const IOStreamFileMapped& ) = delete;
IOStreamFileMapped( IOStreamFileMapped&& ) noexcept = default;
IOStreamFileMapped& operator=( IOStreamFileMapped&& ) noexcept = default;
bool open( const std::string& path );
void close();
ios_size read( char* data, ios_size size ) override;
ios_size write( const char* data, ios_size size ) override;
ios_size seek( ios_size position ) override;
ios_size tell() override;
ios_size getSize() override;
bool isOpen() override;
const FileMapped& getMappedFile() const { return mFile; }
FileMapped& getMappedFile() { return mFile; }
const std::string& getLastError() const { return mFile.getLastError(); }
private:
FileMapped mFile;
ios_size mPosition{ 0 };
};
}} // namespace EE::System
#endif

View File

@@ -215,7 +215,7 @@ class EE_API UIRichText : public UIHTMLWidget {
virtual void onFontChanged();
virtual void onFontStyleChanged();
virtual void onSelectionChange();
virtual void onLayoutUpdate() override;
virtual void onLayoutUpdate();
void selCurInit( const Int64& init );
void selCurEnd( const Int64& end );
@@ -229,9 +229,9 @@ class EE_API UIRichText : public UIHTMLWidget {
class EE_API UIHTMLHtml : public UIRichText {
public:
static UIHTMLHtml* New( const std::string& tag );
virtual Uint32 getType() const override;
bool isType( const Uint32& type ) const override;
bool applyProperty( const StyleSheetProperty& attribute ) override;
virtual Uint32 getType() const;
bool isType( const Uint32& type ) const;
bool applyProperty( const StyleSheetProperty& attribute );
protected:
UIHTMLHtml( const std::string& tag = "html" );
@@ -240,10 +240,10 @@ class EE_API UIHTMLHtml : public UIRichText {
class EE_API UIHTMLBody : public UIRichText {
public:
static UIHTMLBody* New( const std::string& tag );
virtual Uint32 getType() const override;
bool isType( const Uint32& type ) const override;
bool applyProperty( const StyleSheetProperty& attribute ) override;
virtual void updateLayout() override;
virtual Uint32 getType() const;
bool isType( const Uint32& type ) const;
bool applyProperty( const StyleSheetProperty& attribute );
virtual void updateLayout();
void setDocumentViewportMinHeight( const Float& height );
protected:
@@ -259,14 +259,14 @@ class EE_API UIHTMLBody : public UIRichText {
void setDocumentContentMinHeight( const Float& height );
void updateDocumentMinHeight();
void updateDocumentContentMinHeightFromChildren();
virtual Uint32 onMessage( const NodeMessage* Msg ) override;
virtual Uint32 onMessage( const NodeMessage* Msg );
};
class EE_API UIHTMLHead : public UIWidget {
public:
static UIHTMLHead* New();
virtual Uint32 getType() const override;
bool isType( const Uint32& type ) const override;
virtual Uint32 getType() const;
bool isType( const Uint32& type ) const;
protected:
UIHTMLHead();