2022-08-13 19:32:34 +01:00
|
|
|
// Copyright 2021 The Gitea Authors. All rights reserved.
|
2022-11-27 13:20:29 -05:00
|
|
|
// SPDX-License-Identifier: MIT
|
2022-08-13 19:32:34 +01:00
|
|
|
|
|
|
|
|
package charset
|
|
|
|
|
|
2026-04-06 13:07:33 +02:00
|
|
|
// EscapeStatus represents the findings of the Unicode escaper
|
2022-08-13 19:32:34 +01:00
|
|
|
type EscapeStatus struct {
|
2026-04-06 13:07:33 +02:00
|
|
|
Escaped bool // it means that some characters were escaped, and they can also be unescaped back
|
2022-08-13 19:32:34 +01:00
|
|
|
HasInvisible bool
|
|
|
|
|
HasAmbiguous bool
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Or combines two EscapeStatus structs into one representing the conjunction of the two
|
|
|
|
|
func (status *EscapeStatus) Or(other *EscapeStatus) *EscapeStatus {
|
|
|
|
|
st := status
|
|
|
|
|
if status == nil {
|
|
|
|
|
st = &EscapeStatus{}
|
|
|
|
|
}
|
|
|
|
|
st.Escaped = st.Escaped || other.Escaped
|
|
|
|
|
st.HasAmbiguous = st.HasAmbiguous || other.HasAmbiguous
|
|
|
|
|
st.HasInvisible = st.HasInvisible || other.HasInvisible
|
|
|
|
|
return st
|
|
|
|
|
}
|