diff --git a/xml_converter/generators/cpp_templates/attribute_template.hpp b/xml_converter/generators/cpp_templates/attribute_template.hpp index f6bf31cd..78c32ad1 100644 --- a/xml_converter/generators/cpp_templates/attribute_template.hpp +++ b/xml_converter/generators/cpp_templates/attribute_template.hpp @@ -32,7 +32,7 @@ }; {% endif %} {{class_name}} parse_{{attribute_name}}(rapidxml::xml_attribute<>* input, std::vector* errors); -std::string stringify_{{attribute_name}}({{class_name}} attribute_value); +std::string {{attribute_name}}_to_xml_attribute(const std::string& attribute_name, const {{class_name}}* value); {% if type == "Enum":%} waypoint::{{class_name}} to_proto_{{attribute_name}}({{class_name}} attribute_value); {% else: %} diff --git a/xml_converter/generators/cpp_templates/class_template.cpp b/xml_converter/generators/cpp_templates/class_template.cpp index c2081d8a..bef2821a 100644 --- a/xml_converter/generators/cpp_templates/class_template.cpp +++ b/xml_converter/generators/cpp_templates/class_template.cpp @@ -70,7 +70,7 @@ vector {{cpp_class}}::as_xml() const { {% for attribute_variable in attribute_variables %} {% if attribute_variable.write_to_xml == true %} if (this->{{attribute_variable.attribute_flag_name}}) { - xml_node_contents.push_back(" {{attribute_variable.default_xml_field}}=\"" + stringify_{{attribute_variable.class_name}}(this->{{attribute_variable.attribute_name}}) + "\""); + xml_node_contents.push_back({{attribute_variable.class_name}}_to_xml_attribute("{{attribute_variable.default_xml_field}}", &this->{{attribute_variable.attribute_name}})); } {% endif %} {% endfor %} diff --git a/xml_converter/generators/cpp_templates/compoundvalue.cpp b/xml_converter/generators/cpp_templates/compoundvalue.cpp index 3480fe65..e69c54dd 100644 --- a/xml_converter/generators/cpp_templates/compoundvalue.cpp +++ b/xml_converter/generators/cpp_templates/compoundvalue.cpp @@ -28,19 +28,18 @@ using namespace std; return {{attribute_name}}; } {% if xml_bundled_components != [] %} - - string stringify_{{attribute_name}}({{class_name}} attribute_value) { + string {{attribute_name}}_to_xml_attribute(const std::string& attribute_name, const {{class_name}}* value) { string output; {% for n, attribute_variable in enumerate(attribute_variables) %} {% if attribute_variable.attribute_name in xml_bundled_components %} {% if n == 0: %} - output = to_string(attribute_value.{{attribute_variable.attribute_name}}); + output = to_string(value->{{attribute_variable.attribute_name}}); {% else %} - output = output + "," + to_string(attribute_value.{{attribute_variable.attribute_name}}); + output = output + "," + to_string(value->{{attribute_variable.attribute_name}}); {% endif %} {% endif %} {% endfor %} - return output; + return " " + attribute_name + "=\"" + output + "\""; } {% endif %} diff --git a/xml_converter/generators/cpp_templates/enum.cpp b/xml_converter/generators/cpp_templates/enum.cpp index b97dc242..83de9dd0 100644 --- a/xml_converter/generators/cpp_templates/enum.cpp +++ b/xml_converter/generators/cpp_templates/enum.cpp @@ -35,22 +35,20 @@ using namespace std; return {{attribute_name}}; } -string stringify_{{attribute_name}}({{class_name}} attribute_value) { +string {{attribute_name}}_to_xml_attribute(const std::string& attribute_name, const {{class_name}}* value) { {% for n, attribute_variable in enumerate(attribute_variables) %} {% for i, value in enumerate(attribute_variable.xml_fields) %} {%-if i == 0 and n == 0:%} - if (attribute_value == {{class_name}}::{{attribute_variable.attribute_name}}) { - return "{{value}}"; - } - {% else: %} - else if (attribute_value == {{class_name}}::{{attribute_variable.attribute_name}}) { - return "{{value}}"; - } + if (*value == {{class_name}}::{{attribute_variable.attribute_name}}) { + {% else %} + else if (*value == {{class_name}}::{{attribute_variable.attribute_name}}) { {% endif %} + return " " + attribute_name + "=\"" + "{{value}}" + "\""; + } {% endfor %} {% endfor %} else { - return "{{class_name}}::{{attribute_variables[0].xml_fields[0]}}"; + return " " + attribute_name + "=\"" + "{{class_name}}::{{attribute_variables[0].xml_fields[0]}}" + "\""; } } diff --git a/xml_converter/generators/cpp_templates/multiflagvalue.cpp b/xml_converter/generators/cpp_templates/multiflagvalue.cpp index 11fe543a..ad2303b1 100644 --- a/xml_converter/generators/cpp_templates/multiflagvalue.cpp +++ b/xml_converter/generators/cpp_templates/multiflagvalue.cpp @@ -43,14 +43,14 @@ using namespace std; return {{attribute_name}}; } -string stringify_{{attribute_name}}({{class_name}} attribute_value) { +string {{attribute_name}}_to_xml_attribute(const std::string& attribute_name, const {{class_name}}* value) { string output = ""; {% for n, attribute_variable in enumerate(attribute_variables)%} - if (attribute_value.{{attribute_variable.attribute_name}} == true) { + if (value->{{attribute_variable.attribute_name}} == true) { output = output + "{{attribute_variable.xml_fields[0]}}"; } {% endfor %} - return output; + return " " + attribute_name + "=\"" + output + "\""; } waypoint::{{class_name}}* to_proto_{{attribute_name}}({{class_name}} attribute_value) { diff --git a/xml_converter/src/attribute/bool.cpp b/xml_converter/src/attribute/bool.cpp index cc7409d0..ea9a4a7c 100644 --- a/xml_converter/src/attribute/bool.cpp +++ b/xml_converter/src/attribute/bool.cpp @@ -30,15 +30,15 @@ bool parse_bool(rapidxml::xml_attribute<>* input, vector* errors) { } //////////////////////////////////////////////////////////////////////////////// -// stringify_bool +// bool_to_xml_attribute // -// Converts a bool into a stringy value so that it can be saved to xml. +// Converts a bool into a fully qualified xml attribute string. //////////////////////////////////////////////////////////////////////////////// -string stringify_bool(bool attribute_value) { - if (attribute_value) { - return "true"; +string bool_to_xml_attribute(const string& attribute_name, const bool* value) { + if (value) { + return " " + attribute_name + "=\"true\""; } else { - return "false"; + return " " + attribute_name + "=\"false\""; } } diff --git a/xml_converter/src/attribute/bool.hpp b/xml_converter/src/attribute/bool.hpp index f0d8d582..701316d9 100644 --- a/xml_converter/src/attribute/bool.hpp +++ b/xml_converter/src/attribute/bool.hpp @@ -9,7 +9,7 @@ class XMLError; bool parse_bool(rapidxml::xml_attribute<>* input, std::vector* errors); -std::string stringify_bool(bool attribute_value); +std::string bool_to_xml_attribute(const std::string& attribute_name, const bool* value); // Zero Cost Abstraction identity functions to make parsing and writing protobufs more uniform inline bool const& from_proto_bool(const bool& x) { diff --git a/xml_converter/src/attribute/color.cpp b/xml_converter/src/attribute/color.cpp index 24636522..18d7be57 100644 --- a/xml_converter/src/attribute/color.cpp +++ b/xml_converter/src/attribute/color.cpp @@ -86,25 +86,26 @@ Color parse_color(rapidxml::xml_attribute<>* input, vector* errors) { } //////////////////////////////////////////////////////////////////////////////// -// stringify_color +// color_to_xml_attribute // -// Converts a Color into a stringy value so it can be saved to xml. +// Converts a color into a fully qualified xml attribute string. //////////////////////////////////////////////////////////////////////////////// -string stringify_color(Color attribute_value) { +string color_to_xml_attribute(const string& attribute_name, const Color* value) { std::stringstream stream; std::string hex_string = "#"; - stream << std::hex << convert_color_channel_float_to_int(attribute_value.red); + stream << std::hex << convert_color_channel_float_to_int((*value).red); hex_string += stream.str(); - stream << std::hex << convert_color_channel_float_to_int(attribute_value.green); + stream << std::hex << convert_color_channel_float_to_int((*value).green); hex_string += stream.str(); - stream << std::hex << convert_color_channel_float_to_int(attribute_value.blue); + stream << std::hex << convert_color_channel_float_to_int((*value).blue); hex_string += stream.str(); std::string rgb = hex_string; - return rgb; + + return " " + attribute_name + "=\"" + rgb + "\""; } //////////////////////////////////////////////////////////////////////////////// diff --git a/xml_converter/src/attribute/color.hpp b/xml_converter/src/attribute/color.hpp index 564e7307..b92ff3c4 100644 --- a/xml_converter/src/attribute/color.hpp +++ b/xml_converter/src/attribute/color.hpp @@ -20,7 +20,7 @@ class Color { Color parse_color(rapidxml::xml_attribute<>* input, std::vector* errors); -std::string stringify_color(Color attribute_value); +std::string color_to_xml_attribute(const std::string& attribute_name, const Color* value); waypoint::RGBAColor* to_proto_color(Color attribute_value); diff --git a/xml_converter/src/attribute/cull_chirality_gen.cpp b/xml_converter/src/attribute/cull_chirality_gen.cpp index faed5616..1cbc5538 100644 --- a/xml_converter/src/attribute/cull_chirality_gen.cpp +++ b/xml_converter/src/attribute/cull_chirality_gen.cpp @@ -31,18 +31,18 @@ CullChirality parse_cull_chirality(rapidxml::xml_attribute<>* input, vector* input, std::vector* errors); -std::string stringify_cull_chirality(CullChirality attribute_value); +std::string cull_chirality_to_xml_attribute(const std::string& attribute_name, const CullChirality* value); waypoint::CullChirality to_proto_cull_chirality(CullChirality attribute_value); CullChirality from_proto_cull_chirality(waypoint::CullChirality proto_cull_chirality); diff --git a/xml_converter/src/attribute/euler_rotation_gen.cpp b/xml_converter/src/attribute/euler_rotation_gen.cpp index fcc17686..8b9a353d 100644 --- a/xml_converter/src/attribute/euler_rotation_gen.cpp +++ b/xml_converter/src/attribute/euler_rotation_gen.cpp @@ -27,13 +27,12 @@ EulerRotation parse_euler_rotation(rapidxml::xml_attribute<>* input, vectorx_rotation); + output = output + "," + to_string(value->y_rotation); + output = output + "," + to_string(value->z_rotation); + return " " + attribute_name + "=\"" + output + "\""; } waypoint::EulerRotation* to_proto_euler_rotation(EulerRotation attribute_value) { diff --git a/xml_converter/src/attribute/euler_rotation_gen.hpp b/xml_converter/src/attribute/euler_rotation_gen.hpp index 85004e59..203f27ad 100644 --- a/xml_converter/src/attribute/euler_rotation_gen.hpp +++ b/xml_converter/src/attribute/euler_rotation_gen.hpp @@ -20,6 +20,6 @@ class EulerRotation { } }; EulerRotation parse_euler_rotation(rapidxml::xml_attribute<>* input, std::vector* errors); -std::string stringify_euler_rotation(EulerRotation attribute_value); +std::string euler_rotation_to_xml_attribute(const std::string& attribute_name, const EulerRotation* value); waypoint::EulerRotation* to_proto_euler_rotation(EulerRotation attribute_value); EulerRotation from_proto_euler_rotation(waypoint::EulerRotation proto_euler_rotation); diff --git a/xml_converter/src/attribute/festival_filter_gen.cpp b/xml_converter/src/attribute/festival_filter_gen.cpp index c7f86ea8..29b15014 100644 --- a/xml_converter/src/attribute/festival_filter_gen.cpp +++ b/xml_converter/src/attribute/festival_filter_gen.cpp @@ -58,30 +58,30 @@ FestivalFilter parse_festival_filter(rapidxml::xml_attribute<>* input, vectordragonbash == true) { output = output + "dragonbash"; } - if (attribute_value.festival_of_the_four_winds == true) { + if (value->festival_of_the_four_winds == true) { output = output + "festivalofthefourwinds"; } - if (attribute_value.halloween == true) { + if (value->halloween == true) { output = output + "halloween"; } - if (attribute_value.lunar_new_year == true) { + if (value->lunar_new_year == true) { output = output + "lunarnewyear"; } - if (attribute_value.super_adventure_festival == true) { + if (value->super_adventure_festival == true) { output = output + "superadventurefestival"; } - if (attribute_value.wintersday == true) { + if (value->wintersday == true) { output = output + "wintersday"; } - if (attribute_value.none == true) { + if (value->none == true) { output = output + "none"; } - return output; + return " " + attribute_name + "=\"" + output + "\""; } waypoint::FestivalFilter* to_proto_festival_filter(FestivalFilter attribute_value) { diff --git a/xml_converter/src/attribute/festival_filter_gen.hpp b/xml_converter/src/attribute/festival_filter_gen.hpp index a5f8f85e..04dce886 100644 --- a/xml_converter/src/attribute/festival_filter_gen.hpp +++ b/xml_converter/src/attribute/festival_filter_gen.hpp @@ -24,6 +24,6 @@ class FestivalFilter { } }; FestivalFilter parse_festival_filter(rapidxml::xml_attribute<>* input, std::vector* errors); -std::string stringify_festival_filter(FestivalFilter attribute_value); +std::string festival_filter_to_xml_attribute(const std::string& attribute_name, const FestivalFilter* value); waypoint::FestivalFilter* to_proto_festival_filter(FestivalFilter attribute_value); FestivalFilter from_proto_festival_filter(waypoint::FestivalFilter proto_festival_filter); diff --git a/xml_converter/src/attribute/float.cpp b/xml_converter/src/attribute/float.cpp index 7a3a91cd..f15be56c 100644 --- a/xml_converter/src/attribute/float.cpp +++ b/xml_converter/src/attribute/float.cpp @@ -6,6 +6,7 @@ #include "../rapid_helpers.hpp" #include "../rapidxml-1.13/rapidxml.hpp" +using namespace std; //////////////////////////////////////////////////////////////////////////////// // parse_float // @@ -16,10 +17,10 @@ float parse_float(rapidxml::xml_attribute<>* input, std::vector*) { } //////////////////////////////////////////////////////////////////////////////// -// stringify_float +// float_to_xml_attribute // -// Converts a float into a stringy value so that it can be saved to xml. +// Converts a float into a fully qualified xml attribute string. //////////////////////////////////////////////////////////////////////////////// -std::string stringify_float(float attribute_value) { - return std::to_string(attribute_value); +string float_to_xml_attribute(const string& attribute_name, const float* value) { + return " " + attribute_name + "=\"" + to_string(*value) + "\""; } diff --git a/xml_converter/src/attribute/float.hpp b/xml_converter/src/attribute/float.hpp index 003dfba0..d4fec324 100644 --- a/xml_converter/src/attribute/float.hpp +++ b/xml_converter/src/attribute/float.hpp @@ -9,7 +9,7 @@ class XMLError; float parse_float(rapidxml::xml_attribute<>* input, std::vector* errors); -std::string stringify_float(float attribute_value); +std::string float_to_xml_attribute(const std::string& attribute_name, const float* value); // Zero Cost Abstraction identity functions to make parsing and writing protobufs more uniform inline float const& from_proto_float(const float& x) { diff --git a/xml_converter/src/attribute/image.cpp b/xml_converter/src/attribute/image.cpp index b85b1eaa..31055d7f 100644 --- a/xml_converter/src/attribute/image.cpp +++ b/xml_converter/src/attribute/image.cpp @@ -22,12 +22,12 @@ Image parse_image(rapidxml::xml_attribute<>* input, vector*) { } //////////////////////////////////////////////////////////////////////////////// -// stringify_image +// image_to_xml_attribute // -// Converts an Image into a stringy value representing the path to the image. +// Converts an image into a fully qualified xml attribute string. //////////////////////////////////////////////////////////////////////////////// -string stringify_image(Image attribute_value) { - return attribute_value.path; +string image_to_xml_attribute(const string& attribute_name, const Image* value) { + return " " + attribute_name + "=\"" + value->path + "\""; } //////////////////////////////////////////////////////////////////////////////// diff --git a/xml_converter/src/attribute/image.hpp b/xml_converter/src/attribute/image.hpp index c9a83e54..e71ba15e 100644 --- a/xml_converter/src/attribute/image.hpp +++ b/xml_converter/src/attribute/image.hpp @@ -17,7 +17,7 @@ class Image { Image parse_image(rapidxml::xml_attribute<>* input, std::vector* errors); -std::string stringify_image(Image attribute_value); +std::string image_to_xml_attribute(const std::string& attribute_name, const Image* value); waypoint::TexturePath* to_proto_image(Image attribute_value); diff --git a/xml_converter/src/attribute/int.cpp b/xml_converter/src/attribute/int.cpp index cb605abb..b5923bad 100644 --- a/xml_converter/src/attribute/int.cpp +++ b/xml_converter/src/attribute/int.cpp @@ -33,10 +33,10 @@ int parse_int(rapidxml::xml_attribute<>* input, vector* errors) { } //////////////////////////////////////////////////////////////////////////////// -// stringify_int +// int_to_xml_attribute // -// Converts an int into a stringy value so that it can be saved to xml. +// Converts an int a fully qualified xml attribute string. //////////////////////////////////////////////////////////////////////////////// -string stringify_int(int attribute_value) { - return to_string(attribute_value); +string int_to_xml_attribute(const string& attribute_name, const int* value) { + return " " + attribute_name + "=\"" + to_string(*value) + "\""; } diff --git a/xml_converter/src/attribute/int.hpp b/xml_converter/src/attribute/int.hpp index 4c3446be..4d0d8b41 100644 --- a/xml_converter/src/attribute/int.hpp +++ b/xml_converter/src/attribute/int.hpp @@ -9,7 +9,7 @@ class XMLError; int parse_int(rapidxml::xml_attribute<>* input, std::vector* errors); -std::string stringify_int(int attribute_value); +std::string int_to_xml_attribute(const std::string& attribute_name, const int* value); // Zero Cost Abstraction identity functions to make parsing and writing protobufs more uniform inline int const& from_proto_int(const int& x) { diff --git a/xml_converter/src/attribute/map_type_filter_gen.cpp b/xml_converter/src/attribute/map_type_filter_gen.cpp index 6a847d8a..bd4a36f8 100644 --- a/xml_converter/src/attribute/map_type_filter_gen.cpp +++ b/xml_converter/src/attribute/map_type_filter_gen.cpp @@ -123,81 +123,81 @@ MapTypeFilter parse_map_type_filter(rapidxml::xml_attribute<>* input, vectorunknown_map == true) { output = output + "unknown"; } - if (attribute_value.redirect_map == true) { + if (value->redirect_map == true) { output = output + "redirect"; } - if (attribute_value.character_create_map == true) { + if (value->character_create_map == true) { output = output + "charactercreate"; } - if (attribute_value.pvp_map == true) { + if (value->pvp_map == true) { output = output + "pvp"; } - if (attribute_value.gvg_map == true) { + if (value->gvg_map == true) { output = output + "gvg"; } - if (attribute_value.instance_map == true) { + if (value->instance_map == true) { output = output + "instance"; } - if (attribute_value.public_map == true) { + if (value->public_map == true) { output = output + "public"; } - if (attribute_value.tournament_map == true) { + if (value->tournament_map == true) { output = output + "tournament"; } - if (attribute_value.tutorial_map == true) { + if (value->tutorial_map == true) { output = output + "tutorial"; } - if (attribute_value.user_tournament_map == true) { + if (value->user_tournament_map == true) { output = output + "usertournament"; } - if (attribute_value.center_map == true) { + if (value->center_map == true) { output = output + "center"; } - if (attribute_value.eternal_battlegrounds_map == true) { + if (value->eternal_battlegrounds_map == true) { output = output + "eternalbattlegrounds"; } - if (attribute_value.bluehome_map == true) { + if (value->bluehome_map == true) { output = output + "bluehome"; } - if (attribute_value.blue_borderlands_map == true) { + if (value->blue_borderlands_map == true) { output = output + "blueborderlands"; } - if (attribute_value.green_home_map == true) { + if (value->green_home_map == true) { output = output + "greenhome"; } - if (attribute_value.green_borderlands_map == true) { + if (value->green_borderlands_map == true) { output = output + "greenborderlands"; } - if (attribute_value.red_home_map == true) { + if (value->red_home_map == true) { output = output + "redhome"; } - if (attribute_value.red_borderlands_map == true) { + if (value->red_borderlands_map == true) { output = output + "redborderlands"; } - if (attribute_value.fortunes_vale_map == true) { + if (value->fortunes_vale_map == true) { output = output + "fortunesvale"; } - if (attribute_value.jump_puzzle_map == true) { + if (value->jump_puzzle_map == true) { output = output + "jumppuzzle"; } - if (attribute_value.obsidian_sanctum_map == true) { + if (value->obsidian_sanctum_map == true) { output = output + "obsidiansanctum"; } - if (attribute_value.edge_of_the_mists_map == true) { + if (value->edge_of_the_mists_map == true) { output = output + "edgeofthemists"; } - if (attribute_value.public_mini_map == true) { + if (value->public_mini_map == true) { output = output + "publicmini"; } - if (attribute_value.wvw_lounge_map == true) { + if (value->wvw_lounge_map == true) { output = output + "wvwlounge"; } - return output; + return " " + attribute_name + "=\"" + output + "\""; } waypoint::MapTypeFilter* to_proto_map_type_filter(MapTypeFilter attribute_value) { diff --git a/xml_converter/src/attribute/map_type_filter_gen.hpp b/xml_converter/src/attribute/map_type_filter_gen.hpp index 644bca64..20706b5f 100644 --- a/xml_converter/src/attribute/map_type_filter_gen.hpp +++ b/xml_converter/src/attribute/map_type_filter_gen.hpp @@ -41,6 +41,6 @@ class MapTypeFilter { } }; MapTypeFilter parse_map_type_filter(rapidxml::xml_attribute<>* input, std::vector* errors); -std::string stringify_map_type_filter(MapTypeFilter attribute_value); +std::string map_type_filter_to_xml_attribute(const std::string& attribute_name, const MapTypeFilter* value); waypoint::MapTypeFilter* to_proto_map_type_filter(MapTypeFilter attribute_value); MapTypeFilter from_proto_map_type_filter(waypoint::MapTypeFilter proto_map_type_filter); diff --git a/xml_converter/src/attribute/marker_category.cpp b/xml_converter/src/attribute/marker_category.cpp index caa4f42c..32e73c1c 100644 --- a/xml_converter/src/attribute/marker_category.cpp +++ b/xml_converter/src/attribute/marker_category.cpp @@ -19,13 +19,12 @@ MarkerCategory parse_marker_category(rapidxml::xml_attribute<>* input, std::vect } //////////////////////////////////////////////////////////////////////////////// -// stringify_marker_category +// marker_category_to_xml_attribute // -// Converts a MarkerCategory into a stringy value so that it can be saved to -// xml. The stringy value is a full hierarchical path to the MarkerCategory. +// Converts a marker category a fully qualified xml attribute string. //////////////////////////////////////////////////////////////////////////////// -std::string stringify_marker_category(MarkerCategory attribute_value) { - return attribute_value.category; +std::string marker_category_to_xml_attribute(const std::string& attribute_name, const MarkerCategory* value) { + return " " + attribute_name + "=\"" + value->category + "\""; } //////////////////////////////////////////////////////////////////////////////// diff --git a/xml_converter/src/attribute/marker_category.hpp b/xml_converter/src/attribute/marker_category.hpp index 06b6bf53..018f06db 100644 --- a/xml_converter/src/attribute/marker_category.hpp +++ b/xml_converter/src/attribute/marker_category.hpp @@ -17,7 +17,7 @@ class MarkerCategory { MarkerCategory parse_marker_category(rapidxml::xml_attribute<>* input, std::vector* errors); -std::string stringify_marker_category(MarkerCategory attribute_value); +std::string marker_category_to_xml_attribute(const std::string& attribute_name, const MarkerCategory* value); waypoint::Category* to_proto_marker_category(MarkerCategory attribute_value); diff --git a/xml_converter/src/attribute/mount_filter_gen.cpp b/xml_converter/src/attribute/mount_filter_gen.cpp index bd40f601..3907c15d 100644 --- a/xml_converter/src/attribute/mount_filter_gen.cpp +++ b/xml_converter/src/attribute/mount_filter_gen.cpp @@ -67,39 +67,39 @@ MountFilter parse_mount_filter(rapidxml::xml_attribute<>* input, vectorraptor == true) { output = output + "raptor"; } - if (attribute_value.springer == true) { + if (value->springer == true) { output = output + "springer"; } - if (attribute_value.skimmer == true) { + if (value->skimmer == true) { output = output + "skimmer"; } - if (attribute_value.jackal == true) { + if (value->jackal == true) { output = output + "jackal"; } - if (attribute_value.griffon == true) { + if (value->griffon == true) { output = output + "griffon"; } - if (attribute_value.roller_beetle == true) { + if (value->roller_beetle == true) { output = output + "rollerbeetle"; } - if (attribute_value.warclaw == true) { + if (value->warclaw == true) { output = output + "warclaw"; } - if (attribute_value.skyscale == true) { + if (value->skyscale == true) { output = output + "skyscale"; } - if (attribute_value.skiff == true) { + if (value->skiff == true) { output = output + "skiff"; } - if (attribute_value.seige_turtle == true) { + if (value->seige_turtle == true) { output = output + "seigeturtle"; } - return output; + return " " + attribute_name + "=\"" + output + "\""; } waypoint::MountFilter* to_proto_mount_filter(MountFilter attribute_value) { diff --git a/xml_converter/src/attribute/mount_filter_gen.hpp b/xml_converter/src/attribute/mount_filter_gen.hpp index d680c5ea..5f35d9ba 100644 --- a/xml_converter/src/attribute/mount_filter_gen.hpp +++ b/xml_converter/src/attribute/mount_filter_gen.hpp @@ -27,6 +27,6 @@ class MountFilter { } }; MountFilter parse_mount_filter(rapidxml::xml_attribute<>* input, std::vector* errors); -std::string stringify_mount_filter(MountFilter attribute_value); +std::string mount_filter_to_xml_attribute(const std::string& attribute_name, const MountFilter* value); waypoint::MountFilter* to_proto_mount_filter(MountFilter attribute_value); MountFilter from_proto_mount_filter(waypoint::MountFilter proto_mount_filter); diff --git a/xml_converter/src/attribute/position_gen.hpp b/xml_converter/src/attribute/position_gen.hpp index b5823c57..2525e1de 100644 --- a/xml_converter/src/attribute/position_gen.hpp +++ b/xml_converter/src/attribute/position_gen.hpp @@ -20,6 +20,6 @@ class Position { } }; Position parse_position(rapidxml::xml_attribute<>* input, std::vector* errors); -std::string stringify_position(Position attribute_value); +std::string position_to_xml_attribute(const std::string& attribute_name, const Position* value); waypoint::Position* to_proto_position(Position attribute_value); Position from_proto_position(waypoint::Position proto_position); diff --git a/xml_converter/src/attribute/profession_filter_gen.cpp b/xml_converter/src/attribute/profession_filter_gen.cpp index 61e13e2a..9f9d989d 100644 --- a/xml_converter/src/attribute/profession_filter_gen.cpp +++ b/xml_converter/src/attribute/profession_filter_gen.cpp @@ -63,36 +63,36 @@ ProfessionFilter parse_profession_filter(rapidxml::xml_attribute<>* input, vecto return profession_filter; } -string stringify_profession_filter(ProfessionFilter attribute_value) { +string profession_filter_to_xml_attribute(const std::string& attribute_name, const ProfessionFilter* value) { string output = ""; - if (attribute_value.guardian == true) { + if (value->guardian == true) { output = output + "guardian"; } - if (attribute_value.warrior == true) { + if (value->warrior == true) { output = output + "warrior"; } - if (attribute_value.engineer == true) { + if (value->engineer == true) { output = output + "engineer"; } - if (attribute_value.ranger == true) { + if (value->ranger == true) { output = output + "ranger"; } - if (attribute_value.thief == true) { + if (value->thief == true) { output = output + "thief"; } - if (attribute_value.elementalist == true) { + if (value->elementalist == true) { output = output + "elementalist"; } - if (attribute_value.mesmer == true) { + if (value->mesmer == true) { output = output + "mesmer"; } - if (attribute_value.necromancer == true) { + if (value->necromancer == true) { output = output + "necromancer"; } - if (attribute_value.revenant == true) { + if (value->revenant == true) { output = output + "revenant"; } - return output; + return " " + attribute_name + "=\"" + output + "\""; } waypoint::ProfessionFilter* to_proto_profession_filter(ProfessionFilter attribute_value) { diff --git a/xml_converter/src/attribute/profession_filter_gen.hpp b/xml_converter/src/attribute/profession_filter_gen.hpp index 1dda32b8..4baff30e 100644 --- a/xml_converter/src/attribute/profession_filter_gen.hpp +++ b/xml_converter/src/attribute/profession_filter_gen.hpp @@ -26,6 +26,6 @@ class ProfessionFilter { } }; ProfessionFilter parse_profession_filter(rapidxml::xml_attribute<>* input, std::vector* errors); -std::string stringify_profession_filter(ProfessionFilter attribute_value); +std::string profession_filter_to_xml_attribute(const std::string& attribute_name, const ProfessionFilter* value); waypoint::ProfessionFilter* to_proto_profession_filter(ProfessionFilter attribute_value); ProfessionFilter from_proto_profession_filter(waypoint::ProfessionFilter proto_profession_filter); diff --git a/xml_converter/src/attribute/reset_behavior_gen.cpp b/xml_converter/src/attribute/reset_behavior_gen.cpp index 8d830ad1..819c34ea 100644 --- a/xml_converter/src/attribute/reset_behavior_gen.cpp +++ b/xml_converter/src/attribute/reset_behavior_gen.cpp @@ -76,63 +76,63 @@ ResetBehavior parse_reset_behavior(rapidxml::xml_attribute<>* input, vector* input, std::vector* errors); -std::string stringify_reset_behavior(ResetBehavior attribute_value); +std::string reset_behavior_to_xml_attribute(const std::string& attribute_name, const ResetBehavior* value); waypoint::ResetBehavior to_proto_reset_behavior(ResetBehavior attribute_value); ResetBehavior from_proto_reset_behavior(waypoint::ResetBehavior proto_reset_behavior); diff --git a/xml_converter/src/attribute/specialization_filter_gen.cpp b/xml_converter/src/attribute/specialization_filter_gen.cpp index 4292fd6b..584acb24 100644 --- a/xml_converter/src/attribute/specialization_filter_gen.cpp +++ b/xml_converter/src/attribute/specialization_filter_gen.cpp @@ -396,225 +396,225 @@ SpecializationFilter parse_specialization_filter(rapidxml::xml_attribute<>* inpu return specialization_filter; } -string stringify_specialization_filter(SpecializationFilter attribute_value) { +string specialization_filter_to_xml_attribute(const std::string& attribute_name, const SpecializationFilter* value) { string output = ""; - if (attribute_value.elementalist_tempest == true) { + if (value->elementalist_tempest == true) { output = output + "48"; } - if (attribute_value.engineer_scrapper == true) { + if (value->engineer_scrapper == true) { output = output + "43"; } - if (attribute_value.guardian_dragonhunter == true) { + if (value->guardian_dragonhunter == true) { output = output + "27"; } - if (attribute_value.mesmer_chronomancer == true) { + if (value->mesmer_chronomancer == true) { output = output + "40"; } - if (attribute_value.necromancer_reaper == true) { + if (value->necromancer_reaper == true) { output = output + "34"; } - if (attribute_value.ranger_druid == true) { + if (value->ranger_druid == true) { output = output + "5"; } - if (attribute_value.revenant_herald == true) { + if (value->revenant_herald == true) { output = output + "52"; } - if (attribute_value.thief_daredevil == true) { + if (value->thief_daredevil == true) { output = output + "7"; } - if (attribute_value.warrior_berserker == true) { + if (value->warrior_berserker == true) { output = output + "18"; } - if (attribute_value.elementalist_weaver == true) { + if (value->elementalist_weaver == true) { output = output + "56"; } - if (attribute_value.engineer_holosmith == true) { + if (value->engineer_holosmith == true) { output = output + "57"; } - if (attribute_value.guardian_firebrand == true) { + if (value->guardian_firebrand == true) { output = output + "62"; } - if (attribute_value.mesmer_mirage == true) { + if (value->mesmer_mirage == true) { output = output + "59"; } - if (attribute_value.necromancer_scourge == true) { + if (value->necromancer_scourge == true) { output = output + "60"; } - if (attribute_value.ranger_soulbeast == true) { + if (value->ranger_soulbeast == true) { output = output + "55"; } - if (attribute_value.revenant_renegade == true) { + if (value->revenant_renegade == true) { output = output + "63"; } - if (attribute_value.thief_deadeye == true) { + if (value->thief_deadeye == true) { output = output + "58"; } - if (attribute_value.warrior_spellbreaker == true) { + if (value->warrior_spellbreaker == true) { output = output + "61"; } - if (attribute_value.elementalist_catalyst == true) { + if (value->elementalist_catalyst == true) { output = output + "67"; } - if (attribute_value.engineer_mechanist == true) { + if (value->engineer_mechanist == true) { output = output + "70"; } - if (attribute_value.guardian_willbender == true) { + if (value->guardian_willbender == true) { output = output + "65"; } - if (attribute_value.mesmer_virtuoso == true) { + if (value->mesmer_virtuoso == true) { output = output + "66"; } - if (attribute_value.necromancer_harbinger == true) { + if (value->necromancer_harbinger == true) { output = output + "64"; } - if (attribute_value.ranger_untamed == true) { + if (value->ranger_untamed == true) { output = output + "72"; } - if (attribute_value.revenant_vindicator == true) { + if (value->revenant_vindicator == true) { output = output + "69"; } - if (attribute_value.thief_specter == true) { + if (value->thief_specter == true) { output = output + "71"; } - if (attribute_value.warrior_bladesworn == true) { + if (value->warrior_bladesworn == true) { output = output + "68"; } - if (attribute_value.elementalist_air == true) { + if (value->elementalist_air == true) { output = output + "41"; } - if (attribute_value.elementalist_arcane == true) { + if (value->elementalist_arcane == true) { output = output + "37"; } - if (attribute_value.elementalist_earth == true) { + if (value->elementalist_earth == true) { output = output + "26"; } - if (attribute_value.elementalist_fire == true) { + if (value->elementalist_fire == true) { output = output + "31"; } - if (attribute_value.elementalist_water == true) { + if (value->elementalist_water == true) { output = output + "17"; } - if (attribute_value.engineer_alchemy == true) { + if (value->engineer_alchemy == true) { output = output + "29"; } - if (attribute_value.engineer_explosives == true) { + if (value->engineer_explosives == true) { output = output + "6"; } - if (attribute_value.engineer_firearms == true) { + if (value->engineer_firearms == true) { output = output + "38"; } - if (attribute_value.engineer_inventions == true) { + if (value->engineer_inventions == true) { output = output + "47"; } - if (attribute_value.engineer_tools == true) { + if (value->engineer_tools == true) { output = output + "21"; } - if (attribute_value.guardian_honor == true) { + if (value->guardian_honor == true) { output = output + "49"; } - if (attribute_value.guardian_radiance == true) { + if (value->guardian_radiance == true) { output = output + "16"; } - if (attribute_value.guardian_valor == true) { + if (value->guardian_valor == true) { output = output + "13"; } - if (attribute_value.guardian_virtues == true) { + if (value->guardian_virtues == true) { output = output + "46"; } - if (attribute_value.guardian_zeal == true) { + if (value->guardian_zeal == true) { output = output + "42"; } - if (attribute_value.mesmer_chaos == true) { + if (value->mesmer_chaos == true) { output = output + "45"; } - if (attribute_value.mesmer_domination == true) { + if (value->mesmer_domination == true) { output = output + "10"; } - if (attribute_value.mesmer_dueling == true) { + if (value->mesmer_dueling == true) { output = output + "1"; } - if (attribute_value.mesmer_illusions == true) { + if (value->mesmer_illusions == true) { output = output + "24"; } - if (attribute_value.mesmer_inspiration == true) { + if (value->mesmer_inspiration == true) { output = output + "23"; } - if (attribute_value.necromancer_blood_magic == true) { + if (value->necromancer_blood_magic == true) { output = output + "19"; } - if (attribute_value.necromancer_curses == true) { + if (value->necromancer_curses == true) { output = output + "39"; } - if (attribute_value.necromancer_death_magic == true) { + if (value->necromancer_death_magic == true) { output = output + "2"; } - if (attribute_value.necromancer_soul_reaping == true) { + if (value->necromancer_soul_reaping == true) { output = output + "50"; } - if (attribute_value.necromancer_spite == true) { + if (value->necromancer_spite == true) { output = output + "53"; } - if (attribute_value.ranger_beastmastery == true) { + if (value->ranger_beastmastery == true) { output = output + "32"; } - if (attribute_value.ranger_marksmanship == true) { + if (value->ranger_marksmanship == true) { output = output + "8"; } - if (attribute_value.ranger_nature_magic == true) { + if (value->ranger_nature_magic == true) { output = output + "25"; } - if (attribute_value.ranger_skirmishing == true) { + if (value->ranger_skirmishing == true) { output = output + "30"; } - if (attribute_value.ranger_wilderness_survival == true) { + if (value->ranger_wilderness_survival == true) { output = output + "33"; } - if (attribute_value.revenant_corruption == true) { + if (value->revenant_corruption == true) { output = output + "14"; } - if (attribute_value.revenant_devastation == true) { + if (value->revenant_devastation == true) { output = output + "15"; } - if (attribute_value.revenant_invocation == true) { + if (value->revenant_invocation == true) { output = output + "3"; } - if (attribute_value.revenant_retribution == true) { + if (value->revenant_retribution == true) { output = output + "9"; } - if (attribute_value.revenant_salvation == true) { + if (value->revenant_salvation == true) { output = output + "12"; } - if (attribute_value.thief_acrobatics == true) { + if (value->thief_acrobatics == true) { output = output + "54"; } - if (attribute_value.thief_critical_strikes == true) { + if (value->thief_critical_strikes == true) { output = output + "35"; } - if (attribute_value.thief_deadly_arts == true) { + if (value->thief_deadly_arts == true) { output = output + "28"; } - if (attribute_value.thief_shadow_arts == true) { + if (value->thief_shadow_arts == true) { output = output + "20"; } - if (attribute_value.thief_trickery == true) { + if (value->thief_trickery == true) { output = output + "44"; } - if (attribute_value.warrior_arms == true) { + if (value->warrior_arms == true) { output = output + "36"; } - if (attribute_value.warrior_defense == true) { + if (value->warrior_defense == true) { output = output + "22"; } - if (attribute_value.warrior_discipline == true) { + if (value->warrior_discipline == true) { output = output + "51"; } - if (attribute_value.warrior_strength == true) { + if (value->warrior_strength == true) { output = output + "4"; } - if (attribute_value.warrior_tactics == true) { + if (value->warrior_tactics == true) { output = output + "11"; } - return output; + return " " + attribute_name + "=\"" + output + "\""; } waypoint::SpecializationFilter* to_proto_specialization_filter(SpecializationFilter attribute_value) { diff --git a/xml_converter/src/attribute/specialization_filter_gen.hpp b/xml_converter/src/attribute/specialization_filter_gen.hpp index a8f4d21c..be3438e5 100644 --- a/xml_converter/src/attribute/specialization_filter_gen.hpp +++ b/xml_converter/src/attribute/specialization_filter_gen.hpp @@ -89,6 +89,6 @@ class SpecializationFilter { } }; SpecializationFilter parse_specialization_filter(rapidxml::xml_attribute<>* input, std::vector* errors); -std::string stringify_specialization_filter(SpecializationFilter attribute_value); +std::string specialization_filter_to_xml_attribute(const std::string& attribute_name, const SpecializationFilter* value); waypoint::SpecializationFilter* to_proto_specialization_filter(SpecializationFilter attribute_value); SpecializationFilter from_proto_specialization_filter(waypoint::SpecializationFilter proto_specialization_filter); diff --git a/xml_converter/src/attribute/species_filter_gen.cpp b/xml_converter/src/attribute/species_filter_gen.cpp index d2f3ad6c..43898691 100644 --- a/xml_converter/src/attribute/species_filter_gen.cpp +++ b/xml_converter/src/attribute/species_filter_gen.cpp @@ -47,24 +47,24 @@ SpeciesFilter parse_species_filter(rapidxml::xml_attribute<>* input, vectorasura == true) { output = output + "asura"; } - if (attribute_value.charr == true) { + if (value->charr == true) { output = output + "charr"; } - if (attribute_value.human == true) { + if (value->human == true) { output = output + "human"; } - if (attribute_value.norn == true) { + if (value->norn == true) { output = output + "norn"; } - if (attribute_value.sylvari == true) { + if (value->sylvari == true) { output = output + "sylvari"; } - return output; + return " " + attribute_name + "=\"" + output + "\""; } waypoint::SpeciesFilter* to_proto_species_filter(SpeciesFilter attribute_value) { diff --git a/xml_converter/src/attribute/species_filter_gen.hpp b/xml_converter/src/attribute/species_filter_gen.hpp index fd93e3d4..509332d8 100644 --- a/xml_converter/src/attribute/species_filter_gen.hpp +++ b/xml_converter/src/attribute/species_filter_gen.hpp @@ -22,6 +22,6 @@ class SpeciesFilter { } }; SpeciesFilter parse_species_filter(rapidxml::xml_attribute<>* input, std::vector* errors); -std::string stringify_species_filter(SpeciesFilter attribute_value); +std::string species_filter_to_xml_attribute(const std::string& attribute_name, const SpeciesFilter* value); waypoint::SpeciesFilter* to_proto_species_filter(SpeciesFilter attribute_value); SpeciesFilter from_proto_species_filter(waypoint::SpeciesFilter proto_species_filter); diff --git a/xml_converter/src/attribute/string.cpp b/xml_converter/src/attribute/string.cpp index 08e53392..5f3a0202 100644 --- a/xml_converter/src/attribute/string.cpp +++ b/xml_converter/src/attribute/string.cpp @@ -19,12 +19,10 @@ string parse_string(rapidxml::xml_attribute<>* input, vector*) { } //////////////////////////////////////////////////////////////////////////////// -// stringify_string +// string_to_xml_attribute // -// Returns the same string that was passed in which is encoded directly into -// xml. This function exists for stylistic convenience with all the other -// attribute stringify functions. +// Converts a string into a fully qualified xml attribute string. //////////////////////////////////////////////////////////////////////////////// -string stringify_string(string attribute_value) { - return attribute_value; +string string_to_xml_attribute(const string& attribute_name, const string* value) { + return " " + attribute_name + "=\"" + *value + "\""; } diff --git a/xml_converter/src/attribute/string.hpp b/xml_converter/src/attribute/string.hpp index a693f834..381ccc40 100644 --- a/xml_converter/src/attribute/string.hpp +++ b/xml_converter/src/attribute/string.hpp @@ -9,7 +9,7 @@ class XMLError; std::string parse_string(rapidxml::xml_attribute<>* input, std::vector* errors); -std::string stringify_string(std::string attribute_value); +std::string string_to_xml_attribute(const std::string& attribute_name, const std::string* value); // Zero Cost Abstraction identity functions to make parsing and writing protobufs more uniform inline std::string const& from_proto_string(const std::string& x) { diff --git a/xml_converter/src/attribute/trail_data.cpp b/xml_converter/src/attribute/trail_data.cpp index 5414cbfd..a58f5333 100644 --- a/xml_converter/src/attribute/trail_data.cpp +++ b/xml_converter/src/attribute/trail_data.cpp @@ -71,13 +71,14 @@ TrailData parse_trail_data(rapidxml::xml_attribute<>* input, vector* } //////////////////////////////////////////////////////////////////////////////// -// stringify_trail_data +// trail_data_to_xml_attribute // -// Returns the relative path of the trail_data to the xml files +// Converts a traildata into a fully qualified xml attribute string. // TODO: Write ".trl" files from data +// TOOD: Determine a better trail path name //////////////////////////////////////////////////////////////////////////////// -string stringify_trail_data(TrailData attribute_value) { - return "temp_name_of_trail.trl"; +string trail_data_to_xml_attribute(const string& attribute_name, const TrailData* value) { + return " " + attribute_name + "=\"" + "temp_name_of_trail.trl" + "\""; } //////////////////////////////////////////////////////////////////////////////// diff --git a/xml_converter/src/attribute/trail_data.hpp b/xml_converter/src/attribute/trail_data.hpp index 211d5739..517eabd0 100644 --- a/xml_converter/src/attribute/trail_data.hpp +++ b/xml_converter/src/attribute/trail_data.hpp @@ -20,7 +20,7 @@ class TrailData { TrailData parse_trail_data(rapidxml::xml_attribute<>* input, std::vector* errors, std::string base_dir); -std::string stringify_trail_data(TrailData attribute_value); +std::string trail_data_to_xml_attribute(const std::string& attribute_name, const TrailData* value); waypoint::TrailData* to_proto_trail_data(TrailData attribute_value); diff --git a/xml_converter/src/attribute/unique_id.cpp b/xml_converter/src/attribute/unique_id.cpp index abad77ec..6e136be4 100644 --- a/xml_converter/src/attribute/unique_id.cpp +++ b/xml_converter/src/attribute/unique_id.cpp @@ -21,8 +21,13 @@ UniqueId parse_unique_id(rapidxml::xml_attribute<>* input, vector*) { return unique_id; } -string stringify_unique_id(UniqueId attribute_value) { - return base64_encode(&attribute_value.guid[0], attribute_value.guid.size()); +//////////////////////////////////////////////////////////////////////////////// +// unique_id_to_xml_attribute +// +// Converts a unique id into a fully qualified xml attribute string. +//////////////////////////////////////////////////////////////////////////////// +string unique_id_to_xml_attribute(const string& attribute_name, const UniqueId* value) { + return " " + attribute_name + "=\"" + base64_encode(&(value->guid[0]), value->guid.size()) + "\""; } string to_proto_unique_id(UniqueId attribute_value) { diff --git a/xml_converter/src/attribute/unique_id.hpp b/xml_converter/src/attribute/unique_id.hpp index 59853469..0e58771b 100644 --- a/xml_converter/src/attribute/unique_id.hpp +++ b/xml_converter/src/attribute/unique_id.hpp @@ -18,7 +18,7 @@ class UniqueId { UniqueId parse_unique_id(rapidxml::xml_attribute<>* input, std::vector* errors); -std::string stringify_unique_id(UniqueId attribute_value); +std::string unique_id_to_xml_attribute(const std::string& attribute_name, const UniqueId* value); std::string to_proto_unique_id(UniqueId attribute_value); diff --git a/xml_converter/src/category_gen.cpp b/xml_converter/src/category_gen.cpp index 4ceddc0e..e6dbab6f 100644 --- a/xml_converter/src/category_gen.cpp +++ b/xml_converter/src/category_gen.cpp @@ -66,19 +66,19 @@ vector Category::as_xml() const { vector xml_node_contents; xml_node_contents.push_back("default_visibility_is_set) { - xml_node_contents.push_back(" DefaultToggle=\"" + stringify_bool(this->default_visibility) + "\""); + xml_node_contents.push_back(bool_to_xml_attribute("DefaultToggle", &this->default_visibility)); } if (this->display_name_is_set) { - xml_node_contents.push_back(" DisplayName=\"" + stringify_string(this->display_name) + "\""); + xml_node_contents.push_back(string_to_xml_attribute("DisplayName", &this->display_name)); } if (this->is_separator_is_set) { - xml_node_contents.push_back(" IsSeparator=\"" + stringify_bool(this->is_separator) + "\""); + xml_node_contents.push_back(bool_to_xml_attribute("IsSeparator", &this->is_separator)); } if (this->name_is_set) { - xml_node_contents.push_back(" Name=\"" + stringify_string(this->name) + "\""); + xml_node_contents.push_back(string_to_xml_attribute("Name", &this->name)); } if (this->tooltip_description_is_set) { - xml_node_contents.push_back(" TipDescription=\"" + stringify_string(this->tooltip_description) + "\""); + xml_node_contents.push_back(string_to_xml_attribute("TipDescription", &this->tooltip_description)); } xml_node_contents.push_back(">\n"); diff --git a/xml_converter/src/icon_gen.cpp b/xml_converter/src/icon_gen.cpp index 92f3b4d2..46b278e0 100644 --- a/xml_converter/src/icon_gen.cpp +++ b/xml_converter/src/icon_gen.cpp @@ -328,151 +328,151 @@ vector Icon::as_xml() const { vector xml_node_contents; xml_node_contents.push_back("achievement_bitmask_is_set) { - xml_node_contents.push_back(" AchievementBit=\"" + stringify_int(this->achievement_bitmask) + "\""); + xml_node_contents.push_back(int_to_xml_attribute("AchievementBit", &this->achievement_bitmask)); } if (this->achievement_id_is_set) { - xml_node_contents.push_back(" AchievementId=\"" + stringify_int(this->achievement_id) + "\""); + xml_node_contents.push_back(int_to_xml_attribute("AchievementId", &this->achievement_id)); } if (this->auto_trigger_is_set) { - xml_node_contents.push_back(" AutoTrigger=\"" + stringify_bool(this->auto_trigger) + "\""); + xml_node_contents.push_back(bool_to_xml_attribute("AutoTrigger", &this->auto_trigger)); } if (this->bounce_delay_is_set) { - xml_node_contents.push_back(" BounceDelay=\"" + stringify_float(this->bounce_delay) + "\""); + xml_node_contents.push_back(float_to_xml_attribute("BounceDelay", &this->bounce_delay)); } if (this->bounce_duration_is_set) { - xml_node_contents.push_back(" BounceDuration=\"" + stringify_float(this->bounce_duration) + "\""); + xml_node_contents.push_back(float_to_xml_attribute("BounceDuration", &this->bounce_duration)); } if (this->bounce_height_is_set) { - xml_node_contents.push_back(" BounceHeight=\"" + stringify_float(this->bounce_height) + "\""); + xml_node_contents.push_back(float_to_xml_attribute("BounceHeight", &this->bounce_height)); } if (this->can_fade_is_set) { - xml_node_contents.push_back(" CanFade=\"" + stringify_bool(this->can_fade) + "\""); + xml_node_contents.push_back(bool_to_xml_attribute("CanFade", &this->can_fade)); } if (this->category_is_set) { - xml_node_contents.push_back(" Type=\"" + stringify_marker_category(this->category) + "\""); + xml_node_contents.push_back(marker_category_to_xml_attribute("Type", &this->category)); } if (this->color_is_set) { - xml_node_contents.push_back(" Color=\"" + stringify_color(this->color) + "\""); + xml_node_contents.push_back(color_to_xml_attribute("Color", &this->color)); } if (this->color_is_set) { - xml_node_contents.push_back(" Alpha=\"" + stringify_float(this->color.alpha) + "\""); + xml_node_contents.push_back(float_to_xml_attribute("Alpha", &this->color.alpha)); } if (this->copy_clipboard_is_set) { - xml_node_contents.push_back(" Copy=\"" + stringify_string(this->copy_clipboard) + "\""); + xml_node_contents.push_back(string_to_xml_attribute("Copy", &this->copy_clipboard)); } if (this->copy_message_is_set) { - xml_node_contents.push_back(" CopyMessage=\"" + stringify_string(this->copy_message) + "\""); + xml_node_contents.push_back(string_to_xml_attribute("CopyMessage", &this->copy_message)); } if (this->cull_chirality_is_set) { - xml_node_contents.push_back(" Cull=\"" + stringify_cull_chirality(this->cull_chirality) + "\""); + xml_node_contents.push_back(cull_chirality_to_xml_attribute("Cull", &this->cull_chirality)); } if (this->distance_fade_end_is_set) { - xml_node_contents.push_back(" FadeFar=\"" + stringify_float(this->distance_fade_end) + "\""); + xml_node_contents.push_back(float_to_xml_attribute("FadeFar", &this->distance_fade_end)); } if (this->distance_fade_start_is_set) { - xml_node_contents.push_back(" FadeNear=\"" + stringify_float(this->distance_fade_start) + "\""); + xml_node_contents.push_back(float_to_xml_attribute("FadeNear", &this->distance_fade_start)); } if (this->festival_filter_is_set) { - xml_node_contents.push_back(" Festival=\"" + stringify_festival_filter(this->festival_filter) + "\""); + xml_node_contents.push_back(festival_filter_to_xml_attribute("Festival", &this->festival_filter)); } if (this->guid_is_set) { - xml_node_contents.push_back(" GUID=\"" + stringify_unique_id(this->guid) + "\""); + xml_node_contents.push_back(unique_id_to_xml_attribute("GUID", &this->guid)); } if (this->has_countdown_is_set) { - xml_node_contents.push_back(" HasCountdown=\"" + stringify_bool(this->has_countdown) + "\""); + xml_node_contents.push_back(bool_to_xml_attribute("HasCountdown", &this->has_countdown)); } if (this->height_offset_is_set) { - xml_node_contents.push_back(" HeightOffset=\"" + stringify_float(this->height_offset) + "\""); + xml_node_contents.push_back(float_to_xml_attribute("HeightOffset", &this->height_offset)); } if (this->hide_category_is_set) { - xml_node_contents.push_back(" Hide=\"" + stringify_marker_category(this->hide_category) + "\""); + xml_node_contents.push_back(marker_category_to_xml_attribute("Hide", &this->hide_category)); } if (this->icon_is_set) { - xml_node_contents.push_back(" IconFile=\"" + stringify_image(this->icon) + "\""); + xml_node_contents.push_back(image_to_xml_attribute("IconFile", &this->icon)); } if (this->icon_size_is_set) { - xml_node_contents.push_back(" IconSize=\"" + stringify_float(this->icon_size) + "\""); + xml_node_contents.push_back(float_to_xml_attribute("IconSize", &this->icon_size)); } if (this->info_message_is_set) { - xml_node_contents.push_back(" Info=\"" + stringify_string(this->info_message) + "\""); + xml_node_contents.push_back(string_to_xml_attribute("Info", &this->info_message)); } if (this->invert_visibility_is_set) { - xml_node_contents.push_back(" InvertBehavior=\"" + stringify_bool(this->invert_visibility) + "\""); + xml_node_contents.push_back(bool_to_xml_attribute("InvertBehavior", &this->invert_visibility)); } if (this->map_display_size_is_set) { - xml_node_contents.push_back(" MapDisplaySize=\"" + stringify_int(this->map_display_size) + "\""); + xml_node_contents.push_back(int_to_xml_attribute("MapDisplaySize", &this->map_display_size)); } if (this->map_id_is_set) { - xml_node_contents.push_back(" MapID=\"" + stringify_int(this->map_id) + "\""); + xml_node_contents.push_back(int_to_xml_attribute("MapID", &this->map_id)); } if (this->map_type_filter_is_set) { - xml_node_contents.push_back(" MapType=\"" + stringify_map_type_filter(this->map_type_filter) + "\""); + xml_node_contents.push_back(map_type_filter_to_xml_attribute("MapType", &this->map_type_filter)); } if (this->maximum_size_on_screen_is_set) { - xml_node_contents.push_back(" MaxSize=\"" + stringify_int(this->maximum_size_on_screen) + "\""); + xml_node_contents.push_back(int_to_xml_attribute("MaxSize", &this->maximum_size_on_screen)); } if (this->minimum_size_on_screen_is_set) { - xml_node_contents.push_back(" MinSize=\"" + stringify_int(this->minimum_size_on_screen) + "\""); + xml_node_contents.push_back(int_to_xml_attribute("MinSize", &this->minimum_size_on_screen)); } if (this->mount_filter_is_set) { - xml_node_contents.push_back(" Mount=\"" + stringify_mount_filter(this->mount_filter) + "\""); + xml_node_contents.push_back(mount_filter_to_xml_attribute("Mount", &this->mount_filter)); } if (this->position_is_set) { - xml_node_contents.push_back(" XPos=\"" + stringify_float(this->position.x_position) + "\""); + xml_node_contents.push_back(float_to_xml_attribute("XPos", &this->position.x_position)); } if (this->position_is_set) { - xml_node_contents.push_back(" YPos=\"" + stringify_float(this->position.y_position) + "\""); + xml_node_contents.push_back(float_to_xml_attribute("YPos", &this->position.y_position)); } if (this->position_is_set) { - xml_node_contents.push_back(" ZPos=\"" + stringify_float(this->position.z_position) + "\""); + xml_node_contents.push_back(float_to_xml_attribute("ZPos", &this->position.z_position)); } if (this->profession_filter_is_set) { - xml_node_contents.push_back(" Profession=\"" + stringify_profession_filter(this->profession_filter) + "\""); + xml_node_contents.push_back(profession_filter_to_xml_attribute("Profession", &this->profession_filter)); } if (this->render_ingame_is_set) { - xml_node_contents.push_back(" IngameVisibility=\"" + stringify_bool(this->render_ingame) + "\""); + xml_node_contents.push_back(bool_to_xml_attribute("IngameVisibility", &this->render_ingame)); } if (this->render_on_map_is_set) { - xml_node_contents.push_back(" MapVisibility=\"" + stringify_bool(this->render_on_map) + "\""); + xml_node_contents.push_back(bool_to_xml_attribute("MapVisibility", &this->render_on_map)); } if (this->render_on_minimap_is_set) { - xml_node_contents.push_back(" MinimapVisibility=\"" + stringify_bool(this->render_on_minimap) + "\""); + xml_node_contents.push_back(bool_to_xml_attribute("MinimapVisibility", &this->render_on_minimap)); } if (this->reset_behavior_is_set) { - xml_node_contents.push_back(" Behavior=\"" + stringify_reset_behavior(this->reset_behavior) + "\""); + xml_node_contents.push_back(reset_behavior_to_xml_attribute("Behavior", &this->reset_behavior)); } if (this->reset_length_is_set) { - xml_node_contents.push_back(" ResetLength=\"" + stringify_float(this->reset_length) + "\""); + xml_node_contents.push_back(float_to_xml_attribute("ResetLength", &this->reset_length)); } if (this->scale_on_map_with_zoom_is_set) { - xml_node_contents.push_back(" ScaleOnMapWithZoom=\"" + stringify_bool(this->scale_on_map_with_zoom) + "\""); + xml_node_contents.push_back(bool_to_xml_attribute("ScaleOnMapWithZoom", &this->scale_on_map_with_zoom)); } if (this->schedule_is_set) { - xml_node_contents.push_back(" Schedule=\"" + stringify_string(this->schedule) + "\""); + xml_node_contents.push_back(string_to_xml_attribute("Schedule", &this->schedule)); } if (this->schedule_duration_is_set) { - xml_node_contents.push_back(" ScheduleDuration=\"" + stringify_float(this->schedule_duration) + "\""); + xml_node_contents.push_back(float_to_xml_attribute("ScheduleDuration", &this->schedule_duration)); } if (this->show_category_is_set) { - xml_node_contents.push_back(" Show=\"" + stringify_marker_category(this->show_category) + "\""); + xml_node_contents.push_back(marker_category_to_xml_attribute("Show", &this->show_category)); } if (this->specialization_filter_is_set) { - xml_node_contents.push_back(" Specialization=\"" + stringify_specialization_filter(this->specialization_filter) + "\""); + xml_node_contents.push_back(specialization_filter_to_xml_attribute("Specialization", &this->specialization_filter)); } if (this->species_filter_is_set) { - xml_node_contents.push_back(" Race=\"" + stringify_species_filter(this->species_filter) + "\""); + xml_node_contents.push_back(species_filter_to_xml_attribute("Race", &this->species_filter)); } if (this->toggle_category_is_set) { - xml_node_contents.push_back(" Toggle=\"" + stringify_marker_category(this->toggle_category) + "\""); + xml_node_contents.push_back(marker_category_to_xml_attribute("Toggle", &this->toggle_category)); } if (this->tooltip_description_is_set) { - xml_node_contents.push_back(" TipDescription=\"" + stringify_string(this->tooltip_description) + "\""); + xml_node_contents.push_back(string_to_xml_attribute("TipDescription", &this->tooltip_description)); } if (this->tooltip_name_is_set) { - xml_node_contents.push_back(" TipName=\"" + stringify_string(this->tooltip_name) + "\""); + xml_node_contents.push_back(string_to_xml_attribute("TipName", &this->tooltip_name)); } if (this->trigger_range_is_set) { - xml_node_contents.push_back(" TriggerRange=\"" + stringify_float(this->trigger_range) + "\""); + xml_node_contents.push_back(float_to_xml_attribute("TriggerRange", &this->trigger_range)); } xml_node_contents.push_back("/>"); return xml_node_contents; diff --git a/xml_converter/src/trail_gen.cpp b/xml_converter/src/trail_gen.cpp index 26881f17..ffca5ab9 100644 --- a/xml_converter/src/trail_gen.cpp +++ b/xml_converter/src/trail_gen.cpp @@ -199,88 +199,88 @@ vector Trail::as_xml() const { vector xml_node_contents; xml_node_contents.push_back("achievement_bitmask_is_set) { - xml_node_contents.push_back(" AchievementBit=\"" + stringify_int(this->achievement_bitmask) + "\""); + xml_node_contents.push_back(int_to_xml_attribute("AchievementBit", &this->achievement_bitmask)); } if (this->achievement_id_is_set) { - xml_node_contents.push_back(" AchievementId=\"" + stringify_int(this->achievement_id) + "\""); + xml_node_contents.push_back(int_to_xml_attribute("AchievementId", &this->achievement_id)); } if (this->animation_speed_is_set) { - xml_node_contents.push_back(" AnimSpeed=\"" + stringify_float(this->animation_speed) + "\""); + xml_node_contents.push_back(float_to_xml_attribute("AnimSpeed", &this->animation_speed)); } if (this->can_fade_is_set) { - xml_node_contents.push_back(" CanFade=\"" + stringify_bool(this->can_fade) + "\""); + xml_node_contents.push_back(bool_to_xml_attribute("CanFade", &this->can_fade)); } if (this->category_is_set) { - xml_node_contents.push_back(" Type=\"" + stringify_marker_category(this->category) + "\""); + xml_node_contents.push_back(marker_category_to_xml_attribute("Type", &this->category)); } if (this->color_is_set) { - xml_node_contents.push_back(" Color=\"" + stringify_color(this->color) + "\""); + xml_node_contents.push_back(color_to_xml_attribute("Color", &this->color)); } if (this->color_is_set) { - xml_node_contents.push_back(" Alpha=\"" + stringify_float(this->color.alpha) + "\""); + xml_node_contents.push_back(float_to_xml_attribute("Alpha", &this->color.alpha)); } if (this->cull_chirality_is_set) { - xml_node_contents.push_back(" Cull=\"" + stringify_cull_chirality(this->cull_chirality) + "\""); + xml_node_contents.push_back(cull_chirality_to_xml_attribute("Cull", &this->cull_chirality)); } if (this->distance_fade_end_is_set) { - xml_node_contents.push_back(" FadeFar=\"" + stringify_float(this->distance_fade_end) + "\""); + xml_node_contents.push_back(float_to_xml_attribute("FadeFar", &this->distance_fade_end)); } if (this->distance_fade_start_is_set) { - xml_node_contents.push_back(" FadeNear=\"" + stringify_float(this->distance_fade_start) + "\""); + xml_node_contents.push_back(float_to_xml_attribute("FadeNear", &this->distance_fade_start)); } if (this->festival_filter_is_set) { - xml_node_contents.push_back(" Festival=\"" + stringify_festival_filter(this->festival_filter) + "\""); + xml_node_contents.push_back(festival_filter_to_xml_attribute("Festival", &this->festival_filter)); } if (this->guid_is_set) { - xml_node_contents.push_back(" GUID=\"" + stringify_unique_id(this->guid) + "\""); + xml_node_contents.push_back(unique_id_to_xml_attribute("GUID", &this->guid)); } if (this->is_wall_is_set) { - xml_node_contents.push_back(" IsWall=\"" + stringify_bool(this->is_wall) + "\""); + xml_node_contents.push_back(bool_to_xml_attribute("IsWall", &this->is_wall)); } if (this->map_display_size_is_set) { - xml_node_contents.push_back(" MapDisplaySize=\"" + stringify_int(this->map_display_size) + "\""); + xml_node_contents.push_back(int_to_xml_attribute("MapDisplaySize", &this->map_display_size)); } if (this->map_id_is_set) { - xml_node_contents.push_back(" MapID=\"" + stringify_int(this->map_id) + "\""); + xml_node_contents.push_back(int_to_xml_attribute("MapID", &this->map_id)); } if (this->map_type_filter_is_set) { - xml_node_contents.push_back(" MapType=\"" + stringify_map_type_filter(this->map_type_filter) + "\""); + xml_node_contents.push_back(map_type_filter_to_xml_attribute("MapType", &this->map_type_filter)); } if (this->mount_filter_is_set) { - xml_node_contents.push_back(" Mount=\"" + stringify_mount_filter(this->mount_filter) + "\""); + xml_node_contents.push_back(mount_filter_to_xml_attribute("Mount", &this->mount_filter)); } if (this->profession_filter_is_set) { - xml_node_contents.push_back(" Profession=\"" + stringify_profession_filter(this->profession_filter) + "\""); + xml_node_contents.push_back(profession_filter_to_xml_attribute("Profession", &this->profession_filter)); } if (this->render_ingame_is_set) { - xml_node_contents.push_back(" IngameVisibility=\"" + stringify_bool(this->render_ingame) + "\""); + xml_node_contents.push_back(bool_to_xml_attribute("IngameVisibility", &this->render_ingame)); } if (this->render_on_map_is_set) { - xml_node_contents.push_back(" MapVisibility=\"" + stringify_bool(this->render_on_map) + "\""); + xml_node_contents.push_back(bool_to_xml_attribute("MapVisibility", &this->render_on_map)); } if (this->render_on_minimap_is_set) { - xml_node_contents.push_back(" MinimapVisibility=\"" + stringify_bool(this->render_on_minimap) + "\""); + xml_node_contents.push_back(bool_to_xml_attribute("MinimapVisibility", &this->render_on_minimap)); } if (this->schedule_is_set) { - xml_node_contents.push_back(" Schedule=\"" + stringify_string(this->schedule) + "\""); + xml_node_contents.push_back(string_to_xml_attribute("Schedule", &this->schedule)); } if (this->schedule_duration_is_set) { - xml_node_contents.push_back(" ScheduleDuration=\"" + stringify_float(this->schedule_duration) + "\""); + xml_node_contents.push_back(float_to_xml_attribute("ScheduleDuration", &this->schedule_duration)); } if (this->specialization_filter_is_set) { - xml_node_contents.push_back(" Specialization=\"" + stringify_specialization_filter(this->specialization_filter) + "\""); + xml_node_contents.push_back(specialization_filter_to_xml_attribute("Specialization", &this->specialization_filter)); } if (this->species_filter_is_set) { - xml_node_contents.push_back(" Race=\"" + stringify_species_filter(this->species_filter) + "\""); + xml_node_contents.push_back(species_filter_to_xml_attribute("Race", &this->species_filter)); } if (this->texture_is_set) { - xml_node_contents.push_back(" Texture=\"" + stringify_image(this->texture) + "\""); + xml_node_contents.push_back(image_to_xml_attribute("Texture", &this->texture)); } if (this->trail_data_is_set) { - xml_node_contents.push_back(" TrailData=\"" + stringify_trail_data(this->trail_data) + "\""); + xml_node_contents.push_back(trail_data_to_xml_attribute("TrailData", &this->trail_data)); } if (this->trail_scale_is_set) { - xml_node_contents.push_back(" TrailScale=\"" + stringify_float(this->trail_scale) + "\""); + xml_node_contents.push_back(float_to_xml_attribute("TrailScale", &this->trail_scale)); } xml_node_contents.push_back("/>"); return xml_node_contents;