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:
68
PortabilityLayer/ResTypeID.h
Normal file
68
PortabilityLayer/ResTypeID.h
Normal 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
|
Reference in New Issue
Block a user