Lcf support int8_t
MODIFY
generator/generate.py
generator/generate.py
@@ -30,6 +30,7 @@ cpp_types = {
'UInt8': 'uint8_t',
'UInt16': 'uint16_t',
'UInt32': 'uint32_t',
+ 'Int8': 'int8_t',
'Int16': 'int16_t',
'Int32': 'int32_t',
'String': 'std::string',

MODIFY
src/reader_lcf.cpp
src/reader_lcf.cpp
@@ -56,6 +56,11 @@ void LcfReader::Read<bool>(bool& ref) {
ref = ReadInt() > 0;
}
+template <>
+void LcfReader::Read<int8_t>(int8_t& ref) {
+ Read(&ref, 1, 1);
+}
+
template <>
void LcfReader::Read<uint8_t>(uint8_t& ref) {
Read(&ref, 1, 1);

MODIFY
src/reader_struct.h
src/reader_struct.h
@@ -68,6 +68,7 @@ template <> struct TypeCategory<RPG::Parameters> { static const Category::In
template <> struct TypeCategory<RPG::TreeMap> { static const Category::Index value = Category::RawStruct; };
template <> struct TypeCategory<RPG::Rect> { static const Category::Index value = Category::RawStruct; };
+template <> struct TypeCategory<int8_t> { static const Category::Index value = Category::Primitive; };
template <> struct TypeCategory<uint8_t> { static const Category::Index value = Category::Primitive; };
template <> struct TypeCategory<int16_t> { static const Category::Index value = Category::Primitive; };
template <> struct TypeCategory<uint32_t> { static const Category::Index value = Category::Primitive; };

MODIFY
src/reader_xml.cpp
src/reader_xml.cpp
@@ -117,6 +117,14 @@ void XmlReader::Read<int32_t>(int32_t& val, const std::string& data) {
s >> val;
}
+template <>
+void XmlReader::Read<int8_t>(int8_t& val, const std::string& data) {
+ std::istringstream s(data);
+ int x;
+ s >> x;
+ val = x;
+}
+
template <>
void XmlReader::Read<uint8_t>(uint8_t& val, const std::string& data) {
std::istringstream s(data);

MODIFY
src/writer_lcf.cpp
src/writer_lcf.cpp
@@ -29,6 +29,11 @@ void LcfWriter::Write(const void *ptr, size_t size, size_t nmemb) {
#endif
}
+template <>
+void LcfWriter::Write<int8_t>(int8_t val) {
+ Write(&val, 1, 1);
+}
+
template <>
void LcfWriter::Write<uint8_t>(uint8_t val) {
Write(&val, 1, 1);

MODIFY
src/writer_xml.cpp
src/writer_xml.cpp
@@ -39,6 +39,11 @@ void XmlWriter::Write<int32_t>(const int32_t& val) {
stream << val;
}
+template <>
+void XmlWriter::Write<int8_t>(const int8_t& val) {
+ WriteInt((int) val);
+}
+
template <>
void XmlWriter::Write<uint8_t>(const uint8_t& val) {
WriteInt((int) val);

Lcf support int8_t