nstool/lib/libnx/include/nx/SacEntry.h

51 lines
1.1 KiB
C
Raw Normal View History

#pragma once
#include <string>
#include <fnd/types.h>
2018-06-24 08:18:54 +00:00
#include <fnd/ISerialisable.h>
2017-07-06 11:17:21 +00:00
namespace nx
{
class SacEntry :
2018-06-24 08:18:54 +00:00
public fnd::ISerialisable
{
2017-07-06 11:17:21 +00:00
public:
SacEntry();
SacEntry(const std::string& name, bool isServer);
SacEntry(const SacEntry& other);
2018-06-24 08:18:54 +00:00
void operator=(const SacEntry& other);
2017-07-06 11:17:21 +00:00
bool operator==(const SacEntry& other) const;
bool operator!=(const SacEntry& other) const;
// export/import binary
2018-06-24 08:18:54 +00:00
void toBytes();
void fromBytes(const byte_t* bytes, size_t len);
const fnd::Vec<byte_t>& getBytes() const;
2017-07-06 11:17:21 +00:00
// variables
void clear();
2017-07-06 11:17:21 +00:00
bool isServer() const;
void setIsServer(bool isServer);
const std::string& getName() const;
void setName(const std::string& name);
private:
const std::string kModuleName = "SAC_ENTRY";
static const size_t kMaxServiceNameLen = 8;
enum SacEntryFlag
{
2018-06-24 08:18:54 +00:00
SAC_IS_SERVER = _BIT(7),
SAC_NAME_LEN_MASK = _BIT(7) - 1
2017-07-06 11:17:21 +00:00
};
// raw binary
2018-06-24 08:18:54 +00:00
fnd::Vec<byte_t> mRawBinary;
2017-07-06 11:17:21 +00:00
// variables
bool mIsServer;
std::string mName;
bool isEqual(const SacEntry& other) const;
void copyFrom(const SacEntry& other);
};
2017-07-06 11:17:21 +00:00
}