-
Notifications
You must be signed in to change notification settings - Fork 660
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactored the verbal text formatter to handle logic for street name and sign #3369
Conversation
…and sign. Simplified code for narrative builder and signs
…rbal_text_formatter_refactor
@@ -52,8 +52,7 @@ std::string StreetNames::ToString(uint32_t max_count, | |||
if (!name_string.empty()) { | |||
name_string += delim; | |||
} | |||
name_string += | |||
(verbal_formatter) ? verbal_formatter->Format(street_name->value()) : street_name->value(); | |||
name_string += (verbal_formatter) ? verbal_formatter->Format(street_name) : street_name->value(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
simplified call to Format
// If markup string exists then use it | ||
if (markup_string) { | ||
return *markup_string; | ||
std::string VerbalTextFormatter::Format(const std::unique_ptr<baldr::StreetName>& street_name, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
handles the formatting logic for street names
return verbal_text; | ||
} | ||
|
||
std::string VerbalTextFormatter::Format(const odin::Sign& sign, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
handles the formatting logic for signs
return VerbalTextFormatter::Format(text, markup_string); | ||
} | ||
|
||
std::string VerbalTextFormatterUs::Format(const std::string& text) const { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
simplified and cleaned up
return VerbalTextFormatter::Format(text, markup_string); | ||
} | ||
|
||
std::string VerbalTextFormatterUsTx::Format(const std::string& text) const { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
simplified and cleaned up
@@ -49,7 +49,7 @@ void MarkupFormatter::set_markup_enabled(bool markup_enabled) { | |||
} | |||
|
|||
boost::optional<std::string> | |||
MarkupFormatter::Format(const std::unique_ptr<baldr::StreetName>& street_name) const { | |||
MarkupFormatter::FormatPhonemeElement(const std::unique_ptr<baldr::StreetName>& street_name) const { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
better name for method
@@ -66,7 +66,7 @@ MarkupFormatter::Format(const std::unique_ptr<baldr::StreetName>& street_name) c | |||
return boost::none; | |||
} | |||
|
|||
boost::optional<std::string> MarkupFormatter::Format(const Sign& sign) const { | |||
boost::optional<std::string> MarkupFormatter::FormatPhonemeElement(const Sign& sign) const { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
better name for method
(verbal_formatter) | ||
? verbal_formatter->Format(street_name->value(), markup_formatter_.Format(street_name)) | ||
: street_name->value(); | ||
street_names_string += (verbal_formatter) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
simplified code for street name formatting
((markup_formatter) ? markup_formatter->Format(sign) | ||
: boost::none)) | ||
: sign.text(); | ||
sign_string += |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
simplified code for sign formatting
Simplified code for narrative builder and signs
Tasklist