Skip to content
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

Teach Catch2 about LocalizedString and move out of namespace msg. #387

Merged
merged 4 commits into from
Feb 28, 2022

Conversation

BillyONeal
Copy link
Member

@BillyONeal BillyONeal commented Feb 26, 2022

The namespace msg is necessary for localized stuff to:

  1. Give {formatter} parameters pretty short names without stepping on things.
  2. To distinguish the localization safe versions and localization unsafe version of things e.g. vcpkg::println vs vcpkg::msg::println.

LocalizedString doesn't fall into any of these categories, and as we start passing them around in more places adding msg:: is annoying, and encourages "using namespace"s that harm (1) and (2).

The namespace msg is necessary for localized stuff to:

1. Give {formatter} parameters pretty short names without stepping on things.
2. To distinguish the localization safe versions and localization unsafe version of things e.g. vcpkg::println vs msg::println.println.

LocalizedString doesn't fall into any of these categories, and as we start passing them around in more places adding msg:: is annoying, and encourages "using namespace"s that harm (1) and (2).

inline const char* to_printf_arg(const msg::LocalizedString& s) { return s.data().c_str(); }

struct LocalizedStringMapLess
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This struct was not used and suggested that LocalizedString has no natural ordering which isn't true.

@BillyONeal
Copy link
Member Author

I sucked this change out of the command line parser overhaul.

@strega-nil-ms strega-nil-ms merged commit e3fceab into microsoft:main Feb 28, 2022
@BillyONeal BillyONeal deleted the msg-namespace branch February 28, 2022 22:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants