CrabUI
Loading...
Searching...
No Matches
CrabUI.IntRange Struct Reference

Same as Range but with normal ints. More...

Public Member Functions

 IntRange (int start, int end)
 
override string ToString ()
 

Static Public Member Functions

static bool operator== (IntRange a, IntRange b)
 
static bool operator!= (IntRange a, IntRange b)
 
static IntRange Parse (string raw)
 

Public Attributes

int Start
 
int End
 

Static Public Attributes

static IntRange Zero = new IntRange(0, 0)
 

Properties

bool IsZero [get]
 
bool IsEmpty [get]
 

Detailed Description

Same as Range but with normal ints.

Definition at line 16 of file Ranges.cs.

Constructor & Destructor Documentation

◆ IntRange()

CrabUI.IntRange.IntRange ( int start,
int end )

Definition at line 23 of file Ranges.cs.

24 {
25 if (end >= start) (Start, End) = (start, end);
26 else (End, Start) = (start, end);
27 }

Member Function Documentation

◆ Parse()

static IntRange CrabUI.IntRange.Parse ( string raw)
static

Definition at line 32 of file Ranges.cs.

33 {
34 if (raw == null || raw == "") return new IntRange(0, 0);
35
36 string content = raw.Split('[', ']')[1];
37
38 List<string> coords = content.Split(',').Select(s => s.Trim()).ToList();
39
40 int start;
41 int end;
42
43 int.TryParse(coords.ElementAtOrDefault(0), out start);
44 int.TryParse(coords.ElementAtOrDefault(1), out end);
45
46 return new IntRange(start, end);
47 }

Member Data Documentation

◆ End

int CrabUI.IntRange.End

Definition at line 20 of file Ranges.cs.

◆ Start

int CrabUI.IntRange.Start

Definition at line 19 of file Ranges.cs.

◆ Zero

IntRange CrabUI.IntRange.Zero = new IntRange(0, 0)
static

Definition at line 18 of file Ranges.cs.

Property Documentation

◆ IsEmpty

bool CrabUI.IntRange.IsEmpty
get

Definition at line 22 of file Ranges.cs.

◆ IsZero

bool CrabUI.IntRange.IsZero
get

Definition at line 21 of file Ranges.cs.


The documentation for this struct was generated from the following file: