Skip to content

Commit

Permalink
Adds a comma inbetween the flags when writing to xml
Browse files Browse the repository at this point in the history
  • Loading branch information
klingbolt committed Oct 31, 2023
1 parent cb266c5 commit 91ed437
Show file tree
Hide file tree
Showing 7 changed files with 184 additions and 135 deletions.
11 changes: 9 additions & 2 deletions xml_converter/generators/cpp_templates/multiflagvalue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,19 @@ using namespace std;
}

string stringify_{{attribute_name}}({{class_name}} attribute_value) {
string output = "";
vector<string> flag_values;
{% for n, attribute_variable in enumerate(attribute_variables)%}
if (attribute_value.{{attribute_variable.attribute_name}} == true) {
output = output + "{{attribute_variable.xml_fields[0]}}";
flag_values.push_back("{{attribute_variable.xml_fields[0]}}");
}
{% endfor %}
string output = "";
for (size_t i = 0; i < flag_values.size(); ++i) {
output += flag_values[i];
if (i < flag_values.size() - 1){
output += ",";
}
}
return output;
}

Expand Down
23 changes: 15 additions & 8 deletions xml_converter/src/attribute/festival_filter_gen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,27 +59,34 @@ FestivalFilter parse_festival_filter(rapidxml::xml_attribute<>* input, vector<XM
}

string stringify_festival_filter(FestivalFilter attribute_value) {
string output = "";
vector<string> flag_values;
if (attribute_value.dragonbash == true) {
output = output + "dragonbash";
flag_values.push_back("dragonbash");
}
if (attribute_value.festival_of_the_four_winds == true) {
output = output + "festivalofthefourwinds";
flag_values.push_back("festivalofthefourwinds");
}
if (attribute_value.halloween == true) {
output = output + "halloween";
flag_values.push_back("halloween");
}
if (attribute_value.lunar_new_year == true) {
output = output + "lunarnewyear";
flag_values.push_back("lunarnewyear");
}
if (attribute_value.super_adventure_festival == true) {
output = output + "superadventurefestival";
flag_values.push_back("superadventurefestival");
}
if (attribute_value.wintersday == true) {
output = output + "wintersday";
flag_values.push_back("wintersday");
}
if (attribute_value.none == true) {
output = output + "none";
flag_values.push_back("none");
}
string output = "";
for (size_t i = 0; i < flag_values.size(); ++i) {
output += flag_values[i];
if (i < flag_values.size() - 1){
output += ",";
}
}
return output;
}
Expand Down
57 changes: 32 additions & 25 deletions xml_converter/src/attribute/map_type_filter_gen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -124,78 +124,85 @@ MapTypeFilter parse_map_type_filter(rapidxml::xml_attribute<>* input, vector<XML
}

string stringify_map_type_filter(MapTypeFilter attribute_value) {
string output = "";
vector<string> flag_values;
if (attribute_value.unknown_map == true) {
output = output + "unknown";
flag_values.push_back("unknown");
}
if (attribute_value.redirect_map == true) {
output = output + "redirect";
flag_values.push_back("redirect");
}
if (attribute_value.character_create_map == true) {
output = output + "charactercreate";
flag_values.push_back("charactercreate");
}
if (attribute_value.pvp_map == true) {
output = output + "pvp";
flag_values.push_back("pvp");
}
if (attribute_value.gvg_map == true) {
output = output + "gvg";
flag_values.push_back("gvg");
}
if (attribute_value.instance_map == true) {
output = output + "instance";
flag_values.push_back("instance");
}
if (attribute_value.public_map == true) {
output = output + "public";
flag_values.push_back("public");
}
if (attribute_value.tournament_map == true) {
output = output + "tournament";
flag_values.push_back("tournament");
}
if (attribute_value.tutorial_map == true) {
output = output + "tutorial";
flag_values.push_back("tutorial");
}
if (attribute_value.user_tournament_map == true) {
output = output + "usertournament";
flag_values.push_back("usertournament");
}
if (attribute_value.center_map == true) {
output = output + "center";
flag_values.push_back("center");
}
if (attribute_value.eternal_battlegrounds_map == true) {
output = output + "eternalbattlegrounds";
flag_values.push_back("eternalbattlegrounds");
}
if (attribute_value.bluehome_map == true) {
output = output + "bluehome";
flag_values.push_back("bluehome");
}
if (attribute_value.blue_borderlands_map == true) {
output = output + "blueborderlands";
flag_values.push_back("blueborderlands");
}
if (attribute_value.green_home_map == true) {
output = output + "greenhome";
flag_values.push_back("greenhome");
}
if (attribute_value.green_borderlands_map == true) {
output = output + "greenborderlands";
flag_values.push_back("greenborderlands");
}
if (attribute_value.red_home_map == true) {
output = output + "redhome";
flag_values.push_back("redhome");
}
if (attribute_value.red_borderlands_map == true) {
output = output + "redborderlands";
flag_values.push_back("redborderlands");
}
if (attribute_value.fortunes_vale_map == true) {
output = output + "fortunesvale";
flag_values.push_back("fortunesvale");
}
if (attribute_value.jump_puzzle_map == true) {
output = output + "jumppuzzle";
flag_values.push_back("jumppuzzle");
}
if (attribute_value.obsidian_sanctum_map == true) {
output = output + "obsidiansanctum";
flag_values.push_back("obsidiansanctum");
}
if (attribute_value.edge_of_the_mists_map == true) {
output = output + "edgeofthemists";
flag_values.push_back("edgeofthemists");
}
if (attribute_value.public_mini_map == true) {
output = output + "publicmini";
flag_values.push_back("publicmini");
}
if (attribute_value.wvw_lounge_map == true) {
output = output + "wvwlounge";
flag_values.push_back("wvwlounge");
}
string output = "";
for (size_t i = 0; i < flag_values.size(); ++i) {
output += flag_values[i];
if (i < flag_values.size() - 1){
output += ",";
}
}
return output;
}
Expand Down
29 changes: 18 additions & 11 deletions xml_converter/src/attribute/mount_filter_gen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,36 +68,43 @@ MountFilter parse_mount_filter(rapidxml::xml_attribute<>* input, vector<XMLError
}

string stringify_mount_filter(MountFilter attribute_value) {
string output = "";
vector<string> flag_values;
if (attribute_value.raptor == true) {
output = output + "raptor";
flag_values.push_back("raptor");
}
if (attribute_value.springer == true) {
output = output + "springer";
flag_values.push_back("springer");
}
if (attribute_value.skimmer == true) {
output = output + "skimmer";
flag_values.push_back("skimmer");
}
if (attribute_value.jackal == true) {
output = output + "jackal";
flag_values.push_back("jackal");
}
if (attribute_value.griffon == true) {
output = output + "griffon";
flag_values.push_back("griffon");
}
if (attribute_value.roller_beetle == true) {
output = output + "rollerbeetle";
flag_values.push_back("rollerbeetle");
}
if (attribute_value.warclaw == true) {
output = output + "warclaw";
flag_values.push_back("warclaw");
}
if (attribute_value.skyscale == true) {
output = output + "skyscale";
flag_values.push_back("skyscale");
}
if (attribute_value.skiff == true) {
output = output + "skiff";
flag_values.push_back("skiff");
}
if (attribute_value.seige_turtle == true) {
output = output + "seigeturtle";
flag_values.push_back("seigeturtle");
}
string output = "";
for (size_t i = 0; i < flag_values.size(); ++i) {
output += flag_values[i];
if (i < flag_values.size() - 1){
output += ",";
}
}
return output;
}
Expand Down
27 changes: 17 additions & 10 deletions xml_converter/src/attribute/profession_filter_gen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,33 +64,40 @@ ProfessionFilter parse_profession_filter(rapidxml::xml_attribute<>* input, vecto
}

string stringify_profession_filter(ProfessionFilter attribute_value) {
string output = "";
vector<string> flag_values;
if (attribute_value.guardian == true) {
output = output + "guardian";
flag_values.push_back("guardian");
}
if (attribute_value.warrior == true) {
output = output + "warrior";
flag_values.push_back("warrior");
}
if (attribute_value.engineer == true) {
output = output + "engineer";
flag_values.push_back("engineer");
}
if (attribute_value.ranger == true) {
output = output + "ranger";
flag_values.push_back("ranger");
}
if (attribute_value.thief == true) {
output = output + "thief";
flag_values.push_back("thief");
}
if (attribute_value.elementalist == true) {
output = output + "elementalist";
flag_values.push_back("elementalist");
}
if (attribute_value.mesmer == true) {
output = output + "mesmer";
flag_values.push_back("mesmer");
}
if (attribute_value.necromancer == true) {
output = output + "necromancer";
flag_values.push_back("necromancer");
}
if (attribute_value.revenant == true) {
output = output + "revenant";
flag_values.push_back("revenant");
}
string output = "";
for (size_t i = 0; i < flag_values.size(); ++i) {
output += flag_values[i];
if (i < flag_values.size() - 1){
output += ",";
}
}
return output;
}
Expand Down
Loading

0 comments on commit 91ed437

Please sign in to comment.