Add some initial widget functionality (prefs partly working)

This commit is contained in:
elasota
2020-01-01 20:24:46 -05:00
parent d9b5dd20d6
commit 5fe6218c28
85 changed files with 2131 additions and 1074 deletions

View File

@@ -5,6 +5,8 @@
#include "DataTypes.h"
#include "SmallestInt.h"
class PLPasStr;
namespace PortabilityLayer
{
@@ -19,7 +21,10 @@ namespace PortabilityLayer
const char &operator[](size_t index) const;
void Set(size_t size, const char *str);
void SetLength(size_t size);
size_t Length() const;
size_t Length() const;
const char *UnsafeCharPtr() const;
PLPasStr ToShortStr() const;
private:
char m_chars[TSize + (TCStr ? 1 : 0)];
@@ -28,7 +33,9 @@ namespace PortabilityLayer
}
#include <string.h>
#include <assert.h>
#include <assert.h>
#include "PLPasStr.h"
namespace PortabilityLayer
{
@@ -84,7 +91,22 @@ namespace PortabilityLayer
inline size_t UnsafePascalStr<TSize, TCStr>::Length() const
{
return m_size;
}
template<size_t TSize, bool TCStr>
inline const char *UnsafePascalStr<TSize, TCStr>::UnsafeCharPtr() const
{
return m_chars;
}
template<size_t TSize, bool TCStr>
PLPasStr UnsafePascalStr<TSize, TCStr>::ToShortStr() const
{
if (m_size > 255)
return PLPasStr(255, m_chars);
else
return PLPasStr(static_cast<uint8_t>(m_size), m_chars);
}
}
#endif