diff --git a/xml_converter/generators/cpp_templates/multiflagvalue.cpp b/xml_converter/generators/cpp_templates/multiflagvalue.cpp index 7f8593d4..5dd088e9 100644 --- a/xml_converter/generators/cpp_templates/multiflagvalue.cpp +++ b/xml_converter/generators/cpp_templates/multiflagvalue.cpp @@ -49,12 +49,13 @@ void xml_attribute_to_{{attribute_name}}( } string {{attribute_name}}_to_xml_attribute(const std::string& attribute_name, const {{class_name}}* value) { - string output = ""; + vector flag_values; {% for n, attribute_variable in enumerate(attribute_variables)%} if (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 = join(flag_values, ","); return " " + attribute_name + "=\"" + output + "\""; } diff --git a/xml_converter/intigration_tests/expected_outputs/xml_mount_filter_invalid/xml_file.xml b/xml_converter/intigration_tests/expected_outputs/xml_mount_filter_invalid/xml_file.xml new file mode 100644 index 00000000..3276bdf2 --- /dev/null +++ b/xml_converter/intigration_tests/expected_outputs/xml_mount_filter_invalid/xml_file.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/xml_converter/intigration_tests/expected_outputs/xml_mount_filter_valid/xml_file.xml b/xml_converter/intigration_tests/expected_outputs/xml_mount_filter_valid/xml_file.xml new file mode 100644 index 00000000..6b80f183 --- /dev/null +++ b/xml_converter/intigration_tests/expected_outputs/xml_mount_filter_valid/xml_file.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/xml_converter/intigration_tests/inputs/xml_mount_filter_invalid/xml_file.xml b/xml_converter/intigration_tests/inputs/xml_mount_filter_invalid/xml_file.xml new file mode 100644 index 00000000..3ee980aa --- /dev/null +++ b/xml_converter/intigration_tests/inputs/xml_mount_filter_invalid/xml_file.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/xml_converter/intigration_tests/inputs/xml_mount_filter_valid/xml_file.xml b/xml_converter/intigration_tests/inputs/xml_mount_filter_valid/xml_file.xml new file mode 100644 index 00000000..b3e44ac7 --- /dev/null +++ b/xml_converter/intigration_tests/inputs/xml_mount_filter_valid/xml_file.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/xml_converter/intigration_tests/testcases.py b/xml_converter/intigration_tests/testcases.py index 4ab5b7b0..01c8e01f 100644 --- a/xml_converter/intigration_tests/testcases.py +++ b/xml_converter/intigration_tests/testcases.py @@ -33,4 +33,32 @@ class Testcase: " | ^^^" ] ), + Testcase( + name="mountfilter_valid", + xml_input_paths=["./inputs/xml_mount_filter_valid"], + expected_output_xml_path="./expected_outputs/xml_mount_filter_valid", + ), + Testcase( + name="mountfilter_invalid", + xml_input_paths=["./inputs/xml_mount_filter_invalid"], + expected_output_xml_path="./expected_outputs/xml_mount_filter_invalid", + expected_stdout=[ + 'Error: Invalid Filter for MountFilter. Found ', + './inputs/xml_mount_filter_invalid/xml_file.xml', + '6 |', + ' | ', + 'Error: Invalid Filter for MountFilter. Found NotAMount', + './inputs/xml_mount_filter_invalid/xml_file.xml', + '7 |', + ' | ^^^^^^^^^', + 'Error: Invalid Filter for MountFilter. Found ', + './inputs/xml_mount_filter_invalid/xml_file.xml', + '8 |', + ' | ^^^^^^^^^^^^^^^^', + 'Error: Invalid Filter for MountFilter. Found NotAMount', + './inputs/xml_mount_filter_invalid/xml_file.xml', + '9 |', + ' | ^^^^^^^^^^^^^^^^^^^^^^^^^', + ] + ), ] diff --git a/xml_converter/src/attribute/festival_filter_gen.cpp b/xml_converter/src/attribute/festival_filter_gen.cpp index 747ade9e..035e8a3b 100644 --- a/xml_converter/src/attribute/festival_filter_gen.cpp +++ b/xml_converter/src/attribute/festival_filter_gen.cpp @@ -64,28 +64,29 @@ void xml_attribute_to_festival_filter( } string festival_filter_to_xml_attribute(const std::string& attribute_name, const FestivalFilter* value) { - string output = ""; + vector flag_values; if (value->dragonbash == true) { - output = output + "dragonbash"; + flag_values.push_back("dragonbash"); } if (value->festival_of_the_four_winds == true) { - output = output + "festivalofthefourwinds"; + flag_values.push_back("festivalofthefourwinds"); } if (value->halloween == true) { - output = output + "halloween"; + flag_values.push_back("halloween"); } if (value->lunar_new_year == true) { - output = output + "lunarnewyear"; + flag_values.push_back("lunarnewyear"); } if (value->super_adventure_festival == true) { - output = output + "superadventurefestival"; + flag_values.push_back("superadventurefestival"); } if (value->wintersday == true) { - output = output + "wintersday"; + flag_values.push_back("wintersday"); } if (value->none == true) { - output = output + "none"; + flag_values.push_back("none"); } + string output = join(flag_values, ","); return " " + attribute_name + "=\"" + output + "\""; } diff --git a/xml_converter/src/attribute/map_type_filter_gen.cpp b/xml_converter/src/attribute/map_type_filter_gen.cpp index fee22ef1..9ef0273b 100644 --- a/xml_converter/src/attribute/map_type_filter_gen.cpp +++ b/xml_converter/src/attribute/map_type_filter_gen.cpp @@ -129,79 +129,80 @@ void xml_attribute_to_map_type_filter( } string map_type_filter_to_xml_attribute(const std::string& attribute_name, const MapTypeFilter* value) { - string output = ""; + vector flag_values; if (value->unknown_map == true) { - output = output + "unknown"; + flag_values.push_back("unknown"); } if (value->redirect_map == true) { - output = output + "redirect"; + flag_values.push_back("redirect"); } if (value->character_create_map == true) { - output = output + "charactercreate"; + flag_values.push_back("charactercreate"); } if (value->pvp_map == true) { - output = output + "pvp"; + flag_values.push_back("pvp"); } if (value->gvg_map == true) { - output = output + "gvg"; + flag_values.push_back("gvg"); } if (value->instance_map == true) { - output = output + "instance"; + flag_values.push_back("instance"); } if (value->public_map == true) { - output = output + "public"; + flag_values.push_back("public"); } if (value->tournament_map == true) { - output = output + "tournament"; + flag_values.push_back("tournament"); } if (value->tutorial_map == true) { - output = output + "tutorial"; + flag_values.push_back("tutorial"); } if (value->user_tournament_map == true) { - output = output + "usertournament"; + flag_values.push_back("usertournament"); } if (value->center_map == true) { - output = output + "center"; + flag_values.push_back("center"); } if (value->eternal_battlegrounds_map == true) { - output = output + "eternalbattlegrounds"; + flag_values.push_back("eternalbattlegrounds"); } if (value->bluehome_map == true) { - output = output + "bluehome"; + flag_values.push_back("bluehome"); } if (value->blue_borderlands_map == true) { - output = output + "blueborderlands"; + flag_values.push_back("blueborderlands"); } if (value->green_home_map == true) { - output = output + "greenhome"; + flag_values.push_back("greenhome"); } if (value->green_borderlands_map == true) { - output = output + "greenborderlands"; + flag_values.push_back("greenborderlands"); } if (value->red_home_map == true) { - output = output + "redhome"; + flag_values.push_back("redhome"); } if (value->red_borderlands_map == true) { - output = output + "redborderlands"; + flag_values.push_back("redborderlands"); } if (value->fortunes_vale_map == true) { - output = output + "fortunesvale"; + flag_values.push_back("fortunesvale"); } if (value->jump_puzzle_map == true) { - output = output + "jumppuzzle"; + flag_values.push_back("jumppuzzle"); } if (value->obsidian_sanctum_map == true) { - output = output + "obsidiansanctum"; + flag_values.push_back("obsidiansanctum"); } if (value->edge_of_the_mists_map == true) { - output = output + "edgeofthemists"; + flag_values.push_back("edgeofthemists"); } if (value->public_mini_map == true) { - output = output + "publicmini"; + flag_values.push_back("publicmini"); } if (value->wvw_lounge_map == true) { - output = output + "wvwlounge"; + flag_values.push_back("wvwlounge"); } + string output = join(flag_values, ","); return " " + attribute_name + "=\"" + output + "\""; } diff --git a/xml_converter/src/attribute/mount_filter_gen.cpp b/xml_converter/src/attribute/mount_filter_gen.cpp index 4a0e4a5d..bdd8930c 100644 --- a/xml_converter/src/attribute/mount_filter_gen.cpp +++ b/xml_converter/src/attribute/mount_filter_gen.cpp @@ -73,37 +73,38 @@ void xml_attribute_to_mount_filter( } string mount_filter_to_xml_attribute(const std::string& attribute_name, const MountFilter* value) { - string output = ""; + vector flag_values; if (value->raptor == true) { - output = output + "raptor"; + flag_values.push_back("raptor"); } if (value->springer == true) { - output = output + "springer"; + flag_values.push_back("springer"); } if (value->skimmer == true) { - output = output + "skimmer"; + flag_values.push_back("skimmer"); } if (value->jackal == true) { - output = output + "jackal"; + flag_values.push_back("jackal"); } if (value->griffon == true) { - output = output + "griffon"; + flag_values.push_back("griffon"); } if (value->roller_beetle == true) { - output = output + "rollerbeetle"; + flag_values.push_back("rollerbeetle"); } if (value->warclaw == true) { - output = output + "warclaw"; + flag_values.push_back("warclaw"); } if (value->skyscale == true) { - output = output + "skyscale"; + flag_values.push_back("skyscale"); } if (value->skiff == true) { - output = output + "skiff"; + flag_values.push_back("skiff"); } if (value->seige_turtle == true) { - output = output + "seigeturtle"; + flag_values.push_back("seigeturtle"); } + string output = join(flag_values, ","); return " " + attribute_name + "=\"" + output + "\""; } diff --git a/xml_converter/src/attribute/profession_filter_gen.cpp b/xml_converter/src/attribute/profession_filter_gen.cpp index 7eeb9ae2..039eaaf3 100644 --- a/xml_converter/src/attribute/profession_filter_gen.cpp +++ b/xml_converter/src/attribute/profession_filter_gen.cpp @@ -69,34 +69,35 @@ void xml_attribute_to_profession_filter( } string profession_filter_to_xml_attribute(const std::string& attribute_name, const ProfessionFilter* value) { - string output = ""; + vector flag_values; if (value->guardian == true) { - output = output + "guardian"; + flag_values.push_back("guardian"); } if (value->warrior == true) { - output = output + "warrior"; + flag_values.push_back("warrior"); } if (value->engineer == true) { - output = output + "engineer"; + flag_values.push_back("engineer"); } if (value->ranger == true) { - output = output + "ranger"; + flag_values.push_back("ranger"); } if (value->thief == true) { - output = output + "thief"; + flag_values.push_back("thief"); } if (value->elementalist == true) { - output = output + "elementalist"; + flag_values.push_back("elementalist"); } if (value->mesmer == true) { - output = output + "mesmer"; + flag_values.push_back("mesmer"); } if (value->necromancer == true) { - output = output + "necromancer"; + flag_values.push_back("necromancer"); } if (value->revenant == true) { - output = output + "revenant"; + flag_values.push_back("revenant"); } + string output = join(flag_values, ","); return " " + attribute_name + "=\"" + output + "\""; } diff --git a/xml_converter/src/attribute/specialization_filter_gen.cpp b/xml_converter/src/attribute/specialization_filter_gen.cpp index a6435619..4d7e2c46 100644 --- a/xml_converter/src/attribute/specialization_filter_gen.cpp +++ b/xml_converter/src/attribute/specialization_filter_gen.cpp @@ -402,223 +402,224 @@ void xml_attribute_to_specialization_filter( } string specialization_filter_to_xml_attribute(const std::string& attribute_name, const SpecializationFilter* value) { - string output = ""; + vector flag_values; if (value->elementalist_tempest == true) { - output = output + "48"; + flag_values.push_back("48"); } if (value->engineer_scrapper == true) { - output = output + "43"; + flag_values.push_back("43"); } if (value->guardian_dragonhunter == true) { - output = output + "27"; + flag_values.push_back("27"); } if (value->mesmer_chronomancer == true) { - output = output + "40"; + flag_values.push_back("40"); } if (value->necromancer_reaper == true) { - output = output + "34"; + flag_values.push_back("34"); } if (value->ranger_druid == true) { - output = output + "5"; + flag_values.push_back("5"); } if (value->revenant_herald == true) { - output = output + "52"; + flag_values.push_back("52"); } if (value->thief_daredevil == true) { - output = output + "7"; + flag_values.push_back("7"); } if (value->warrior_berserker == true) { - output = output + "18"; + flag_values.push_back("18"); } if (value->elementalist_weaver == true) { - output = output + "56"; + flag_values.push_back("56"); } if (value->engineer_holosmith == true) { - output = output + "57"; + flag_values.push_back("57"); } if (value->guardian_firebrand == true) { - output = output + "62"; + flag_values.push_back("62"); } if (value->mesmer_mirage == true) { - output = output + "59"; + flag_values.push_back("59"); } if (value->necromancer_scourge == true) { - output = output + "60"; + flag_values.push_back("60"); } if (value->ranger_soulbeast == true) { - output = output + "55"; + flag_values.push_back("55"); } if (value->revenant_renegade == true) { - output = output + "63"; + flag_values.push_back("63"); } if (value->thief_deadeye == true) { - output = output + "58"; + flag_values.push_back("58"); } if (value->warrior_spellbreaker == true) { - output = output + "61"; + flag_values.push_back("61"); } if (value->elementalist_catalyst == true) { - output = output + "67"; + flag_values.push_back("67"); } if (value->engineer_mechanist == true) { - output = output + "70"; + flag_values.push_back("70"); } if (value->guardian_willbender == true) { - output = output + "65"; + flag_values.push_back("65"); } if (value->mesmer_virtuoso == true) { - output = output + "66"; + flag_values.push_back("66"); } if (value->necromancer_harbinger == true) { - output = output + "64"; + flag_values.push_back("64"); } if (value->ranger_untamed == true) { - output = output + "72"; + flag_values.push_back("72"); } if (value->revenant_vindicator == true) { - output = output + "69"; + flag_values.push_back("69"); } if (value->thief_specter == true) { - output = output + "71"; + flag_values.push_back("71"); } if (value->warrior_bladesworn == true) { - output = output + "68"; + flag_values.push_back("68"); } if (value->elementalist_air == true) { - output = output + "41"; + flag_values.push_back("41"); } if (value->elementalist_arcane == true) { - output = output + "37"; + flag_values.push_back("37"); } if (value->elementalist_earth == true) { - output = output + "26"; + flag_values.push_back("26"); } if (value->elementalist_fire == true) { - output = output + "31"; + flag_values.push_back("31"); } if (value->elementalist_water == true) { - output = output + "17"; + flag_values.push_back("17"); } if (value->engineer_alchemy == true) { - output = output + "29"; + flag_values.push_back("29"); } if (value->engineer_explosives == true) { - output = output + "6"; + flag_values.push_back("6"); } if (value->engineer_firearms == true) { - output = output + "38"; + flag_values.push_back("38"); } if (value->engineer_inventions == true) { - output = output + "47"; + flag_values.push_back("47"); } if (value->engineer_tools == true) { - output = output + "21"; + flag_values.push_back("21"); } if (value->guardian_honor == true) { - output = output + "49"; + flag_values.push_back("49"); } if (value->guardian_radiance == true) { - output = output + "16"; + flag_values.push_back("16"); } if (value->guardian_valor == true) { - output = output + "13"; + flag_values.push_back("13"); } if (value->guardian_virtues == true) { - output = output + "46"; + flag_values.push_back("46"); } if (value->guardian_zeal == true) { - output = output + "42"; + flag_values.push_back("42"); } if (value->mesmer_chaos == true) { - output = output + "45"; + flag_values.push_back("45"); } if (value->mesmer_domination == true) { - output = output + "10"; + flag_values.push_back("10"); } if (value->mesmer_dueling == true) { - output = output + "1"; + flag_values.push_back("1"); } if (value->mesmer_illusions == true) { - output = output + "24"; + flag_values.push_back("24"); } if (value->mesmer_inspiration == true) { - output = output + "23"; + flag_values.push_back("23"); } if (value->necromancer_blood_magic == true) { - output = output + "19"; + flag_values.push_back("19"); } if (value->necromancer_curses == true) { - output = output + "39"; + flag_values.push_back("39"); } if (value->necromancer_death_magic == true) { - output = output + "2"; + flag_values.push_back("2"); } if (value->necromancer_soul_reaping == true) { - output = output + "50"; + flag_values.push_back("50"); } if (value->necromancer_spite == true) { - output = output + "53"; + flag_values.push_back("53"); } if (value->ranger_beastmastery == true) { - output = output + "32"; + flag_values.push_back("32"); } if (value->ranger_marksmanship == true) { - output = output + "8"; + flag_values.push_back("8"); } if (value->ranger_nature_magic == true) { - output = output + "25"; + flag_values.push_back("25"); } if (value->ranger_skirmishing == true) { - output = output + "30"; + flag_values.push_back("30"); } if (value->ranger_wilderness_survival == true) { - output = output + "33"; + flag_values.push_back("33"); } if (value->revenant_corruption == true) { - output = output + "14"; + flag_values.push_back("14"); } if (value->revenant_devastation == true) { - output = output + "15"; + flag_values.push_back("15"); } if (value->revenant_invocation == true) { - output = output + "3"; + flag_values.push_back("3"); } if (value->revenant_retribution == true) { - output = output + "9"; + flag_values.push_back("9"); } if (value->revenant_salvation == true) { - output = output + "12"; + flag_values.push_back("12"); } if (value->thief_acrobatics == true) { - output = output + "54"; + flag_values.push_back("54"); } if (value->thief_critical_strikes == true) { - output = output + "35"; + flag_values.push_back("35"); } if (value->thief_deadly_arts == true) { - output = output + "28"; + flag_values.push_back("28"); } if (value->thief_shadow_arts == true) { - output = output + "20"; + flag_values.push_back("20"); } if (value->thief_trickery == true) { - output = output + "44"; + flag_values.push_back("44"); } if (value->warrior_arms == true) { - output = output + "36"; + flag_values.push_back("36"); } if (value->warrior_defense == true) { - output = output + "22"; + flag_values.push_back("22"); } if (value->warrior_discipline == true) { - output = output + "51"; + flag_values.push_back("51"); } if (value->warrior_strength == true) { - output = output + "4"; + flag_values.push_back("4"); } if (value->warrior_tactics == true) { - output = output + "11"; + flag_values.push_back("11"); } + string output = join(flag_values, ","); return " " + attribute_name + "=\"" + output + "\""; } diff --git a/xml_converter/src/attribute/species_filter_gen.cpp b/xml_converter/src/attribute/species_filter_gen.cpp index af68e1f2..42151c76 100644 --- a/xml_converter/src/attribute/species_filter_gen.cpp +++ b/xml_converter/src/attribute/species_filter_gen.cpp @@ -53,22 +53,23 @@ void xml_attribute_to_species_filter( } string species_filter_to_xml_attribute(const std::string& attribute_name, const SpeciesFilter* value) { - string output = ""; + vector flag_values; if (value->asura == true) { - output = output + "asura"; + flag_values.push_back("asura"); } if (value->charr == true) { - output = output + "charr"; + flag_values.push_back("charr"); } if (value->human == true) { - output = output + "human"; + flag_values.push_back("human"); } if (value->norn == true) { - output = output + "norn"; + flag_values.push_back("norn"); } if (value->sylvari == true) { - output = output + "sylvari"; + flag_values.push_back("sylvari"); } + string output = join(flag_values, ","); return " " + attribute_name + "=\"" + output + "\""; }