This commit is contained in:
akzi 2016-10-13 15:13:26 +08:00
parent 2fe39cdca3
commit 140e74364f

View File

@ -94,6 +94,7 @@ gsoner::gsoner()
gen_header_ = NULL;
gen_source_ = NULL;
default_ = true;
required_ = default_;
gen_header_filename_ = "gson.h";
gen_source_filename_ = "gson.cpp";
default_delimiters_ = "\\\r\n\t ";
@ -272,13 +273,13 @@ std::string gsoner::get_unpack_code(const std::string &obj_name,
return tab_ +
"if(" + field.name_ + ")\n" + tab_ + tab_ +
"gson(*" + field.name_ + ",&obj." + field.name_ + ");\n";
"gson(*" + field.name_ + ",&obj." + field.name_ + ");";
else if(field.required_ == false)
return tab_
+ "if(" + field.name_ + "&& " + field.name_
+ "->get_obj())\n" + tab_ + tab_ + " gson(*" + field.name_
+ "->get_obj(), &obj." + field.name_ + ");\n";
+ "->get_obj(), &obj." + field.name_ + ");";
return "unknown_type";
}