Lots of stuff

This commit is contained in:
elasota
2019-11-11 00:11:59 -05:00
parent 49a35bb15b
commit c8472f7295
406 changed files with 58313 additions and 88 deletions

View File

@@ -0,0 +1,68 @@
#pragma once
#ifndef __PL_RES_TYPE_ID_H__
#define __PL_RES_TYPE_ID_H__
#include <stdint.h>
namespace PortabilityLayer
{
class ResTypeID
{
public:
ResTypeID();
ResTypeID(int32_t i);
ResTypeID(const ResTypeID &other);
explicit ResTypeID(const char *chars);
ResTypeID &operator=(const ResTypeID &other);
bool operator==(const ResTypeID &other) const;
bool operator!=(const ResTypeID &other) const;
private:
char m_id[4];
};
}
#include "ResTypeIDCodec.h"
#include <string.h>
namespace PortabilityLayer
{
inline ResTypeID::ResTypeID()
{
m_id[0] = m_id[1] = m_id[2] = m_id[3] = 0;
}
inline ResTypeID::ResTypeID(int32_t i)
{
ResTypeIDCodec::Encode(i, m_id);
}
inline ResTypeID::ResTypeID(const ResTypeID &other)
{
memcpy(m_id, other.m_id, 4);
}
inline ResTypeID::ResTypeID(const char *chars)
{
memcpy(m_id, chars, 4);
}
inline ResTypeID &ResTypeID::operator=(const ResTypeID &other)
{
memcpy(m_id, other.m_id, 4);
return *this;
}
inline bool ResTypeID::operator==(const ResTypeID &other) const
{
return memcmp(m_id, other.m_id, 4) == 0;
}
inline bool ResTypeID::operator!=(const ResTypeID &other) const
{
return memcmp(m_id, other.m_id, 4) != 0;
}
}
#endif