0 Views
0 Downloads
0 Favorites
BinFlags
ÿþ/**/

#include "BinFlags.mqh"

/****************************************************************

Flag names can be enumerated for convenience.

/****************************************************************/

enum ENUM_EXAMPLE_FLAGS {A=0x1,B=0x2,C=0x4,D=0x8};

/****************************************************************

Example of BinFalgs usage.

/****************************************************************/

void OnStart()

  {

   BinFlags<int>bf(A|B);         //init & write

   /*MANIPULATE*/

   Print(bf.Format());           //0011 (2 flags on)

   Print("A:",bf.Chk(A));        //A:true

   Print("AD:",bf.Chk(A|D));     //AD:false

   bf.Set(C|D);                  //set C & D

   Print(bf.Format());           //1111 (all flags on)

   bf.Rst(A);                    //reset A

   Print("BCD:",bf.Chk(B|C|D));  //BCD:true

   Print(bf.Format());           //1110 (one flag down)

  }

/****************************************************************

Output:

/**

   BinFlags:0011

   A:true

   AD:false

   BinFlags:1111

   BCD:true

   BinFlags:1110

/**/

Comments