From f345a63c047c7760cb5c5fe70f72a075b4f3a7df Mon Sep 17 00:00:00 2001 From: Egor Yusov Date: Tue, 19 Jun 2018 08:52:15 -0700 Subject: Implemented resource names string pool for D3D backends --- Common/interface/StringPool.h | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'Common/interface') diff --git a/Common/interface/StringPool.h b/Common/interface/StringPool.h index b1040989..3844c146 100644 --- a/Common/interface/StringPool.h +++ b/Common/interface/StringPool.h @@ -91,6 +91,21 @@ public: return str; } + Char* CopyString(const char* Str) + { + auto* Ptr = m_pCurrPtr; + while(*Str != 0 && m_pCurrPtr < m_pBuffer + m_ReservedSize) + { + *(m_pCurrPtr++) = *(Str++); + } + if(m_pCurrPtr < m_pBuffer + m_ReservedSize) + *(m_pCurrPtr++) = 0; + else + UNEXPECTED("Not enough space reserved in the string pool"); + return Ptr; + } + + size_t GetRemainingSize()const { VERIFY(m_pCurrPtr <= m_pBuffer + m_ReservedSize, "Buffer overflow"); @@ -103,7 +118,7 @@ public: } private: - Char* m_pBuffer = nullptr; + Char* m_pBuffer = nullptr; Char* m_pCurrPtr = nullptr; size_t m_ReservedSize = 0; IMemoryAllocator* m_pAllocator = nullptr; -- cgit v1.2.3