1 module des.gui.base;
2 
3 public
4 {
5     import des.math.linear;
6 
7     import des.util.arch;
8     import des.util.helpers;
9     import des.util.logsys;
10     import des.util.localization;
11     import des.util.testsuite;
12     import des.il.region;
13 }
14 
15 alias DiRect=Region!(2,int);
16 alias DiVec=Vector!(2,int);
17 
18 ///
19 class DiException : Exception
20 {
21     ///
22     this( string msg, string file=__FILE__, size_t line=__LINE__ ) pure nothrow @safe
23     { super( msg, file, line ); }
24 }
25 
26 /// add binary flag
27 T binAdd(T)( in T a, in T b ) if( isIntegral!T ) { return a | b; }
28 
29 /// remove binary flag
30 T binRemove(T)( in T a, in T b ) if( isIntegral!T ) { return a ^ ( a & b ); }
31 
32 /// find binary flag ( b in a )
33 bool binFind(T)( in T a, in T b ) if( isIntegral!T ) { return ( a & b ) == b; }
34 
35 unittest
36 {
37     auto a = 0b0001;
38     auto b = 0b0010;
39     auto c = binAdd(a,b);
40     assertEq( c, 0b0011 );
41     assertEq( binRemove(c,a), b );
42     assertEq( binRemove(c,b), a );
43     assert( binFind(c,a) );
44     assert( binFind(c,b) );
45     auto x = 0b0100;
46     assert( !binFind(c,x) );
47 }