code.gitea.io/gitea@v1.19.3/modules/charset/escape_status.go (about)

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