2017-07-06 03:30:27 +00:00
|
|
|
#pragma once
|
|
|
|
#include <string>
|
|
|
|
#include <fnd/types.h>
|
|
|
|
#include <fnd/memory_blob.h>
|
|
|
|
#include <nx/ISerialiseableBinary.h>
|
|
|
|
|
2017-07-06 11:17:21 +00:00
|
|
|
namespace nx
|
2017-07-06 03:30:27 +00:00
|
|
|
{
|
2017-07-06 11:17:21 +00:00
|
|
|
class SacEntry : public ISerialiseableBinary
|
2017-07-06 03:30:27 +00:00
|
|
|
{
|
2017-07-06 11:17:21 +00:00
|
|
|
public:
|
|
|
|
SacEntry();
|
|
|
|
SacEntry(const std::string& name, bool isServer);
|
|
|
|
SacEntry(const SacEntry& other);
|
|
|
|
|
|
|
|
bool operator==(const SacEntry& other) const;
|
|
|
|
bool operator!=(const SacEntry& other) const;
|
|
|
|
void operator=(const SacEntry& other);
|
|
|
|
|
|
|
|
// to be used after export
|
|
|
|
const u8* getBytes() const;
|
|
|
|
size_t getSize() const;
|
|
|
|
|
|
|
|
// export/import binary
|
|
|
|
void exportBinary();
|
|
|
|
void importBinary(const u8* bytes, size_t len);
|
|
|
|
|
|
|
|
// variables
|
2017-07-15 08:28:01 +00:00
|
|
|
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
|
|
|
|
{
|
|
|
|
SAC_IS_SERVER = BIT(7),
|
|
|
|
SAC_NAME_LEN_MASK = BIT(7) - 1
|
|
|
|
};
|
|
|
|
|
|
|
|
// raw binary
|
|
|
|
fnd::MemoryBlob mBinaryBlob;
|
|
|
|
|
|
|
|
// variables
|
|
|
|
bool mIsServer;
|
|
|
|
std::string mName;
|
|
|
|
|
|
|
|
bool isEqual(const SacEntry& other) const;
|
|
|
|
void copyFrom(const SacEntry& other);
|
2017-07-06 03:30:27 +00:00
|
|
|
};
|
2017-07-06 11:17:21 +00:00
|
|
|
}
|