You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

escape_status.go 853B

12345678910111213141516171819202122232425262728
  1. // Copyright 2021 The Gitea Authors. All rights reserved.
  2. // Use of this source code is governed by a MIT-style
  3. // license that can be found in the LICENSE file.
  4. package charset
  5. // EscapeStatus represents the findings of the unicode escaper
  6. type EscapeStatus struct {
  7. Escaped bool
  8. HasError bool
  9. HasBadRunes bool
  10. HasInvisible bool
  11. HasAmbiguous bool
  12. }
  13. // Or combines two EscapeStatus structs into one representing the conjunction of the two
  14. func (status *EscapeStatus) Or(other *EscapeStatus) *EscapeStatus {
  15. st := status
  16. if status == nil {
  17. st = &EscapeStatus{}
  18. }
  19. st.Escaped = st.Escaped || other.Escaped
  20. st.HasError = st.HasError || other.HasError
  21. st.HasBadRunes = st.HasBadRunes || other.HasBadRunes
  22. st.HasAmbiguous = st.HasAmbiguous || other.HasAmbiguous
  23. st.HasInvisible = st.HasInvisible || other.HasInvisible
  24. return st
  25. }