using System;
|
using System.Collections.Generic;
|
using System.Linq;
|
using System.Text;
|
using System.Threading.Tasks;
|
|
namespace LB_VisionControl.ScriptEditControl.FastColorTextBox
|
{
|
/// <summary>
|
/// Line index and char index
|
/// </summary>
|
public struct Place
|
{
|
public int iChar;
|
public int iLine;
|
|
public Place(int iChar, int iLine)
|
{
|
this.iChar = iChar;
|
this.iLine = iLine;
|
}
|
|
public void Offset(int dx, int dy)
|
{
|
iChar += dx;
|
iLine += dy;
|
}
|
|
public static bool operator !=(Place p1, Place p2)
|
{
|
return !p1.Equals(p2);
|
}
|
|
public static bool operator ==(Place p1, Place p2)
|
{
|
return p1.Equals(p2);
|
}
|
|
public static bool operator <(Place p1, Place p2)
|
{
|
if (p1.iLine < p2.iLine) return true;
|
if (p1.iLine > p2.iLine) return false;
|
if (p1.iChar < p2.iChar) return true;
|
return false;
|
}
|
|
public static bool operator <=(Place p1, Place p2)
|
{
|
if (p1.Equals(p2)) return true;
|
if (p1.iLine < p2.iLine) return true;
|
if (p1.iLine > p2.iLine) return false;
|
if (p1.iChar < p2.iChar) return true;
|
return false;
|
}
|
|
public static bool operator >(Place p1, Place p2)
|
{
|
if (p1.iLine > p2.iLine) return true;
|
if (p1.iLine < p2.iLine) return false;
|
if (p1.iChar > p2.iChar) return true;
|
return false;
|
}
|
|
public static bool operator >=(Place p1, Place p2)
|
{
|
if (p1.Equals(p2)) return true;
|
if (p1.iLine > p2.iLine) return true;
|
if (p1.iLine < p2.iLine) return false;
|
if (p1.iChar > p2.iChar) return true;
|
return false;
|
}
|
|
public static Place Empty
|
{
|
get { return new Place(); }
|
}
|
|
public override string ToString()
|
{
|
return "(" + iChar + "," + iLine + ")";
|
}
|
}
|
}
|