mirror of
https://github.com/elasota/Aerofoil.git
synced 2025-09-23 06:53:43 +00:00
Add some initial widget functionality (prefs partly working)
This commit is contained in:
@@ -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
|
||||
|
Reference in New Issue
Block a user