gitlab.com/evatix-go/core@v1.3.55/coredata/corestr/TextWithLineNumber.go (about)

     1  package corestr
     2  
     3  import "gitlab.com/evatix-go/core/constants"
     4  
     5  type TextWithLineNumber struct {
     6  	LineNumber int
     7  	Text       string
     8  }
     9  
    10  func (it *TextWithLineNumber) HasLineNumber() bool {
    11  	return it != nil && it.LineNumber > constants.InvalidValue
    12  }
    13  
    14  func (it *TextWithLineNumber) IsInvalidLineNumber() bool {
    15  	return it == nil || it.LineNumber == constants.InvalidValue
    16  }
    17  
    18  func (it *TextWithLineNumber) Length() int {
    19  	if it == nil {
    20  		return 0
    21  	}
    22  
    23  	return len(it.Text)
    24  }
    25  
    26  func (it *TextWithLineNumber) IsEmpty() bool {
    27  	if it == nil {
    28  		return true
    29  	}
    30  
    31  	return it.IsEmptyText() || it.IsInvalidLineNumber()
    32  }
    33  
    34  func (it *TextWithLineNumber) IsEmptyText() bool {
    35  	if it == nil {
    36  		return true
    37  	}
    38  
    39  	return len(it.Text) == 0
    40  }
    41  
    42  func (it *TextWithLineNumber) IsEmptyTextLineBoth() bool {
    43  	return it.IsEmpty()
    44  }