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 781B

123456789101112131415161718192021222324252627
  1. // Copyright 2021 The Gitea Authors. All rights reserved.
  2. // SPDX-License-Identifier: MIT
  3. package charset
  4. // EscapeStatus represents the findings of the unicode escaper
  5. type EscapeStatus struct {
  6. Escaped bool
  7. HasError bool
  8. HasBadRunes bool
  9. HasInvisible bool
  10. HasAmbiguous bool
  11. }
  12. // Or combines two EscapeStatus structs into one representing the conjunction of the two
  13. func (status *EscapeStatus) Or(other *EscapeStatus) *EscapeStatus {
  14. st := status
  15. if status == nil {
  16. st = &EscapeStatus{}
  17. }
  18. st.Escaped = st.Escaped || other.Escaped
  19. st.HasError = st.HasError || other.HasError
  20. st.HasBadRunes = st.HasBadRunes || other.HasBadRunes
  21. st.HasAmbiguous = st.HasAmbiguous || other.HasAmbiguous
  22. st.HasInvisible = st.HasInvisible || other.HasInvisible
  23. return st
  24. }