Files
minecraft-pe-0.6.1/src/nbt/IntTag.h
2026-03-02 22:04:18 +03:00

59 lines
1.1 KiB
C++
Executable File

#ifndef COM_MOJANG_NBT__IntTag_H__
#define COM_MOJANG_NBT__IntTag_H__
//package com.mojang.nbt;
#include "Tag.h"
#include <sstream>
/* import java.io.* */
class IntTag: public Tag {
typedef Tag super;
public:
int data;
IntTag(const std::string& name)
: super(name)
{
}
IntTag(const std::string& name, int data)
: super(name),
data(data)
{
}
void write(IDataOutput* dos) /*throws IOException*/ {
dos->writeInt(data);
}
void load(IDataInput* dis) /*throws IOException*/ {
data = dis->readInt();
}
char getId() const {
return TAG_Int;
}
std::string toString() const {
std::stringstream ss;
ss << data;
return ss.str();
}
//@Override
Tag* copy() const {
return new IntTag(getName(), data);
}
//@Override
bool equals(const Tag& rhs) const {
if (super::equals(rhs)) {
return data == ((IntTag&)rhs).data;
}
return false;
}
};
#endif /*COM_MOJANG_NBT__IntTag_H__*/