text: // Copyright 1998-2015 Epic Games, Inc. All Rights Reserved.
  #pragma once
  
  struct SLATE_API FTextRange
  {
  	FTextRange()
  		: BeginIndex(INDEX_NONE)
  		, EndIndex(INDEX_NONE)
  	{
  
  	}
  
  	FTextRange( int32 InBeginIndex, int32 InEndIndex )
  		: BeginIndex( InBeginIndex )
  		, EndIndex( InEndIndex )
  	{
  
  	}
  
  	int32 Len() const { return EndIndex - BeginIndex; }
  	bool IsEmpty() const { return (EndIndex - BeginIndex) <= 0; }
  	void Offset(int32 Amount) { BeginIndex += Amount; BeginIndex = FMath::Max(0, BeginIndex);  EndIndex += Amount; EndIndex = FMath::Max(0, EndIndex); }
  	bool Contains(int32 Index) const { return Index >= BeginIndex && Index < EndIndex; }
  	bool InclusiveContains(int32 Index) const { return Index >= BeginIndex && Index <= EndIndex; }
  
  	FTextRange Intersect(const FTextRange& Other) const
  	{
  		FTextRange Intersected(FMath::Max(BeginIndex, Other.BeginIndex), FMath::Min(EndIndex, Other.EndIndex));
  		if (Intersected.EndIndex <= Intersected.BeginIndex)
  		{
  			return FTextRange(0, 0);
  		}
  
  		return Intersected;
  	}
  
  	/**
  	 * Produce an array of line ranges from the given text, breaking at any new-line characters
  	 */
  	static void CalculateLineRangesFromString(const FString& Input, TArray<FTextRange>& LineRanges);
  
  	int32 BeginIndex;
  	int32 EndIndex;
  };
  