mirror of
https://github.com/elasota/Aerofoil.git
synced 2025-09-23 06:53:43 +00:00
Lots of stuff
This commit is contained in:
40
PortabilityLayer/PascalStrLiteral.h
Normal file
40
PortabilityLayer/PascalStrLiteral.h
Normal file
@@ -0,0 +1,40 @@
|
||||
#pragma once
|
||||
#ifndef __PL_PASCAL_STR_LITERAL_H__
|
||||
#define __PL_PASCAL_STR_LITERAL_H__
|
||||
|
||||
#include "DataTypes.h"
|
||||
|
||||
namespace PortabilityLayer
|
||||
{
|
||||
template<size_t TSize>
|
||||
class PascalStrLiteral
|
||||
{
|
||||
public:
|
||||
PascalStrLiteral(const char (&literalStr)[TSize]);
|
||||
const char *GetStr() const;
|
||||
|
||||
static const uint8_t kLength = TSize - 1;
|
||||
|
||||
private:
|
||||
const char *m_literal;
|
||||
};
|
||||
}
|
||||
|
||||
namespace PortabilityLayer
|
||||
{
|
||||
template<size_t TSize>
|
||||
inline PascalStrLiteral<TSize>::PascalStrLiteral(const char(&literalStr)[TSize])
|
||||
: m_literal(literalStr)
|
||||
{
|
||||
}
|
||||
|
||||
template<size_t TSize>
|
||||
inline const char *PascalStrLiteral<TSize>::GetStr() const
|
||||
{
|
||||
return m_literal;
|
||||
}
|
||||
}
|
||||
|
||||
#define PSTR(n) (::PortabilityLayer::PascalStrLiteral<sizeof(n)>(n))
|
||||
|
||||
#endif
|
Reference in New Issue
Block a user