data_user_names.h 873 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. /*
  2. This file is part of Telegram Desktop,
  3. the official desktop application for the Telegram messaging service.
  4. For license and copyright information please follow this link:
  5. https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
  6. */
  7. #pragma once
  8. namespace Data {
  9. struct Username final {
  10. QString username;
  11. bool active = false;
  12. bool editable = false;
  13. };
  14. using Usernames = std::vector<Username>;
  15. class UsernamesInfo final {
  16. public:
  17. UsernamesInfo();
  18. void setUsername(const QString &username);
  19. void setUsernames(const Usernames &usernames);
  20. [[nodiscard]] QString username() const;
  21. [[nodiscard]] QString editableUsername() const;
  22. [[nodiscard]] const std::vector<QString> &usernames() const;
  23. [[nodiscard]] bool isEditable(const QString &username) const;
  24. private:
  25. std::vector<QString> _usernames;
  26. int _indexEditableUsername = -1;
  27. };
  28. } // namespace Data