diff --git a/kml/pykmlib/bindings.cpp b/kml/pykmlib/bindings.cpp index 4283f00257..9aef61af62 100644 --- a/kml/pykmlib/bindings.cpp +++ b/kml/pykmlib/bindings.cpp @@ -290,18 +290,16 @@ std::string PredefinedColorToString(PredefinedColor c) { switch (c) { - case PredefinedColor::None: return "NONE"; - case PredefinedColor::Red: return "RED"; - case PredefinedColor::Blue: return "BLUE"; - case PredefinedColor::Purple: return "PURPLE"; - case PredefinedColor::Yellow: return "YELLOW"; - case PredefinedColor::Pink: return "PINK"; - case PredefinedColor::Brown: return "BROWN"; - case PredefinedColor::Green: return "GREEN"; - case PredefinedColor::Orange: return "ORANGE"; - case PredefinedColor::Count: - CHECK(false, ("Unknown predefined color")); - return {}; + case PredefinedColor::None: return "NONE"; + case PredefinedColor::Red: return "RED"; + case PredefinedColor::Blue: return "BLUE"; + case PredefinedColor::Purple: return "PURPLE"; + case PredefinedColor::Yellow: return "YELLOW"; + case PredefinedColor::Pink: return "PINK"; + case PredefinedColor::Brown: return "BROWN"; + case PredefinedColor::Green: return "GREEN"; + case PredefinedColor::Orange: return "ORANGE"; + case PredefinedColor::Count: CHECK(false, ("Unknown predefined color")); return {}; } } @@ -309,11 +307,12 @@ std::string AccessRulesToString(AccessRules accessRules) { switch (accessRules) { - case AccessRules::Private: return "PRIVATE"; - case AccessRules::Public: return "PUBLIC"; - case AccessRules::Count: - CHECK(false, ("Unknown access rules")); - return {}; + case AccessRules::Local: return "LOCAL"; + case AccessRules::DirectLink: return "DIRECT_LINK"; + case AccessRules::P2P: return "P2P"; + case AccessRules::Paid: return "PAID"; + case AccessRules::Public: return "PUBLIC"; + case AccessRules::Count: CHECK(false, ("Unknown access rules")); return {}; } } @@ -321,30 +320,28 @@ std::string BookmarkIconToString(BookmarkIcon icon) { switch (icon) { - case BookmarkIcon::None: return "NONE"; - case BookmarkIcon::Hotel: return "HOTEL"; - case BookmarkIcon::Animals: return "ANIMALS"; - case BookmarkIcon::Buddhism: return "BUDDHISM"; - case BookmarkIcon::Building: return "BUILDING"; - case BookmarkIcon::Christianity: return "CHRISTIANITY"; - case BookmarkIcon::Entertainment: return "ENTERTAINMENT"; - case BookmarkIcon::Exchange: return "EXCHANGE"; - case BookmarkIcon::Food: return "FOOD"; - case BookmarkIcon::Gas: return "GAS"; - case BookmarkIcon::Judaism: return "JUDAISM"; - case BookmarkIcon::Medicine: return "MEDICINE"; - case BookmarkIcon::Mountain: return "MOUNTAIN"; - case BookmarkIcon::Museum: return "MUSEUM"; - case BookmarkIcon::Islam: return "ISLAM"; - case BookmarkIcon::Park: return "PARK"; - case BookmarkIcon::Parking: return "PARKING"; - case BookmarkIcon::Shop: return "SHOP"; - case BookmarkIcon::Sights: return "SIGHTS"; - case BookmarkIcon::Swim: return "SWIM"; - case BookmarkIcon::Water: return "WATER"; - case BookmarkIcon::Count: - CHECK(false, ("Unknown bookmark icon")); - return {}; + case BookmarkIcon::None: return "NONE"; + case BookmarkIcon::Hotel: return "HOTEL"; + case BookmarkIcon::Animals: return "ANIMALS"; + case BookmarkIcon::Buddhism: return "BUDDHISM"; + case BookmarkIcon::Building: return "BUILDING"; + case BookmarkIcon::Christianity: return "CHRISTIANITY"; + case BookmarkIcon::Entertainment: return "ENTERTAINMENT"; + case BookmarkIcon::Exchange: return "EXCHANGE"; + case BookmarkIcon::Food: return "FOOD"; + case BookmarkIcon::Gas: return "GAS"; + case BookmarkIcon::Judaism: return "JUDAISM"; + case BookmarkIcon::Medicine: return "MEDICINE"; + case BookmarkIcon::Mountain: return "MOUNTAIN"; + case BookmarkIcon::Museum: return "MUSEUM"; + case BookmarkIcon::Islam: return "ISLAM"; + case BookmarkIcon::Park: return "PARK"; + case BookmarkIcon::Parking: return "PARKING"; + case BookmarkIcon::Shop: return "SHOP"; + case BookmarkIcon::Sights: return "SIGHTS"; + case BookmarkIcon::Swim: return "SWIM"; + case BookmarkIcon::Water: return "WATER"; + case BookmarkIcon::Count: CHECK(false, ("Unknown bookmark icon")); return {}; } } @@ -662,7 +659,10 @@ BOOST_PYTHON_MODULE(pykmlib) .export_values(); enum_("AccessRules") - .value(AccessRulesToString(AccessRules::Private).c_str(), AccessRules::Private) + .value(AccessRulesToString(AccessRules::Local).c_str(), AccessRules::Local) + .value(AccessRulesToString(AccessRules::DirectLink).c_str(), AccessRules::DirectLink) + .value(AccessRulesToString(AccessRules::P2P).c_str(), AccessRules::P2P) + .value(AccessRulesToString(AccessRules::Paid).c_str(), AccessRules::Paid) .value(AccessRulesToString(AccessRules::Public).c_str(), AccessRules::Public) .export_values(); diff --git a/kml/serdes.cpp b/kml/serdes.cpp index fe6dbab05b..a5b2281d24 100644 --- a/kml/serdes.cpp +++ b/kml/serdes.cpp @@ -806,7 +806,16 @@ void KmlParser::CharData(std::string value) } else if (currTag == "mwm:accessRules") { - if (value == "Public") + // 'Private' is here for back-compatibility. + if (value == "Private" || value == "Local") + m_data.m_categoryData.m_accessRules = AccessRules::Local; + else if (value == "DirectLink") + m_data.m_categoryData.m_accessRules = AccessRules::DirectLink; + else if (value == "P2P") + m_data.m_categoryData.m_accessRules = AccessRules::P2P; + else if (value == "Paid") + m_data.m_categoryData.m_accessRules = AccessRules::Paid; + else if (value == "Public") m_data.m_categoryData.m_accessRules = AccessRules::Public; } else if (currTag == "mwm:imageUrl") diff --git a/kml/types.hpp b/kml/types.hpp index 55855ea67b..34c9ede294 100644 --- a/kml/types.hpp +++ b/kml/types.hpp @@ -32,23 +32,26 @@ inline std::string DebugPrint(PredefinedColor color) { switch (color) { - case PredefinedColor::None: return "None"; - case PredefinedColor::Red: return "Red"; - case PredefinedColor::Blue: return "Blue"; - case PredefinedColor::Purple: return "Purple"; - case PredefinedColor::Yellow: return "Yellow"; - case PredefinedColor::Pink: return "Pink"; - case PredefinedColor::Brown: return "Brown"; - case PredefinedColor::Green: return "Green"; - case PredefinedColor::Orange: return "Orange"; - case PredefinedColor::Count: return {}; + case PredefinedColor::None: return "None"; + case PredefinedColor::Red: return "Red"; + case PredefinedColor::Blue: return "Blue"; + case PredefinedColor::Purple: return "Purple"; + case PredefinedColor::Yellow: return "Yellow"; + case PredefinedColor::Pink: return "Pink"; + case PredefinedColor::Brown: return "Brown"; + case PredefinedColor::Green: return "Green"; + case PredefinedColor::Orange: return "Orange"; + case PredefinedColor::Count: return {}; } CHECK_SWITCH(); } enum class AccessRules : uint8_t { - Private = 0, + Local = 0, + DirectLink, + P2P, + Paid, Public, Count @@ -58,9 +61,12 @@ inline std::string DebugPrint(AccessRules accessRules) { switch (accessRules) { - case AccessRules::Private: return "Private"; - case AccessRules::Public: return "Public"; - case AccessRules::Count: return {}; + case AccessRules::Local: return "Local"; + case AccessRules::DirectLink: return "DirectLink"; + case AccessRules::P2P: return "P2P"; + case AccessRules::Paid: return "Paid"; + case AccessRules::Public: return "Public"; + case AccessRules::Count: return {}; } CHECK_SWITCH(); } @@ -95,28 +101,28 @@ inline std::string DebugPrint(BookmarkIcon icon) { switch (icon) { - case BookmarkIcon::None: return "None"; - case BookmarkIcon::Hotel: return "Hotel"; - case BookmarkIcon::Animals: return "Animals"; - case BookmarkIcon::Buddhism: return "Buddhism"; - case BookmarkIcon::Building: return "Building"; - case BookmarkIcon::Christianity: return "Christianity"; - case BookmarkIcon::Entertainment: return "Entertainment"; - case BookmarkIcon::Exchange: return "Exchange"; - case BookmarkIcon::Food: return "Food"; - case BookmarkIcon::Gas: return "Gas"; - case BookmarkIcon::Judaism: return "Judaism"; - case BookmarkIcon::Medicine: return "Medicine"; - case BookmarkIcon::Mountain: return "Mountain"; - case BookmarkIcon::Museum: return "Museum"; - case BookmarkIcon::Islam: return "Islam"; - case BookmarkIcon::Park: return "Park"; - case BookmarkIcon::Parking: return "Parking"; - case BookmarkIcon::Shop: return "Shop"; - case BookmarkIcon::Sights: return "Sights"; - case BookmarkIcon::Swim: return "Swim"; - case BookmarkIcon::Water: return "Water"; - case BookmarkIcon::Count: return {}; + case BookmarkIcon::None: return "None"; + case BookmarkIcon::Hotel: return "Hotel"; + case BookmarkIcon::Animals: return "Animals"; + case BookmarkIcon::Buddhism: return "Buddhism"; + case BookmarkIcon::Building: return "Building"; + case BookmarkIcon::Christianity: return "Christianity"; + case BookmarkIcon::Entertainment: return "Entertainment"; + case BookmarkIcon::Exchange: return "Exchange"; + case BookmarkIcon::Food: return "Food"; + case BookmarkIcon::Gas: return "Gas"; + case BookmarkIcon::Judaism: return "Judaism"; + case BookmarkIcon::Medicine: return "Medicine"; + case BookmarkIcon::Mountain: return "Mountain"; + case BookmarkIcon::Museum: return "Museum"; + case BookmarkIcon::Islam: return "Islam"; + case BookmarkIcon::Park: return "Park"; + case BookmarkIcon::Parking: return "Parking"; + case BookmarkIcon::Shop: return "Shop"; + case BookmarkIcon::Sights: return "Sights"; + case BookmarkIcon::Swim: return "Swim"; + case BookmarkIcon::Water: return "Water"; + case BookmarkIcon::Count: return {}; } CHECK_SWITCH(); } @@ -314,7 +320,7 @@ struct CategoryData // Number of reviews. uint32_t m_reviewsNumber = 0; // Access rules. - AccessRules m_accessRules = AccessRules::Private; + AccessRules m_accessRules = AccessRules::Local; // Collection of tags. std::vector m_tags; // Collection of cities coordinates.