V1 #2
@@ -9,9 +9,9 @@ int main(int argc, char** argv)
|
|||||||
argv = app.ensure_utf8(argv);
|
argv = app.ensure_utf8(argv);
|
||||||
|
|
||||||
std::string input;
|
std::string input;
|
||||||
app.add_option("-f,--input", input, "The input file");
|
app.add_option("-f,--input", input, "The input file")->required();
|
||||||
std::string output;
|
std::string output;
|
||||||
app.add_option("-o,--output", output, "The output file");
|
app.add_option("-o,--output", output, "The output file")->required();
|
||||||
std::optional<std::string> arrayType;
|
std::optional<std::string> arrayType;
|
||||||
app.add_option("--arrayType", arrayType, "The type of the array");
|
app.add_option("--arrayType", arrayType, "The type of the array");
|
||||||
std::optional<std::string> arrayInclude;
|
std::optional<std::string> arrayInclude;
|
||||||
@@ -46,19 +46,22 @@ int main(int argc, char** argv)
|
|||||||
generator.SetMapping(Bin2CPP::MappingKey::NAMESPACE, customNamespace.value());
|
generator.SetMapping(Bin2CPP::MappingKey::NAMESPACE, customNamespace.value());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (generator.Generate())
|
if (!generator.Generate())
|
||||||
{
|
{
|
||||||
std::ofstream out(output);
|
BIN2CPP_LOG_ERROR("Failed to generate '{}'", input);
|
||||||
if (!out)
|
return 1;
|
||||||
{
|
|
||||||
BIN2CPP_LOG_ERROR("Failed to open '{}'", output);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
out << generator.Get();
|
|
||||||
out.close();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::ofstream out(output);
|
||||||
|
if (!out)
|
||||||
|
{
|
||||||
|
BIN2CPP_LOG_ERROR("Failed to open '{}'", output);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
out << generator.Get();
|
||||||
|
out.close();
|
||||||
|
|
||||||
BIN2CPP_LOG_INFO("'{}' Generated !", output);
|
BIN2CPP_LOG_INFO("'{}' Generated !", output);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@@ -240,7 +240,7 @@ bool Generator::ComputeData(const std::span<std::byte> p_data)
|
|||||||
std::string& value = m_mappingTable[magic_enum::enum_index(MappingKey::DATA).value()];
|
std::string& value = m_mappingTable[magic_enum::enum_index(MappingKey::DATA).value()];
|
||||||
value.clear();
|
value.clear();
|
||||||
|
|
||||||
constexpr std::size_t bytesPerLine = 5;
|
constexpr std::size_t bytesPerLine = 16;
|
||||||
constexpr std::string_view linePrefix = "\n ";
|
constexpr std::string_view linePrefix = "\n ";
|
||||||
|
|
||||||
for (std::size_t i = 0; i < p_data.size(); ++i)
|
for (std::size_t i = 0; i < p_data.size(); ++i)
|
||||||
|
|||||||
Reference in New Issue
Block a user