1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79
|
#ifndef LOLDATATYPE
#define LOLDATATYPE
#define WIN true
#define FAIL false
typedef enum {
noob,
numbar,
troof,
lettr
} lol_e;
class lol_t {
public:
void *data;
lol_e type;
//~ public:
lol_t() {data = 0; type = numbar;}
lol_t(NUMBAR n) {data = (void*)new int(n); type = numbar;}
friend std::ostream& operator<<(std::ostream& output, const lol_t& p) {
if(p.type == numbar)
output << *((int*)(p.data)) << std::endl;
else if(p.type == troof)
output << *((bool*)(p.data)) << std::endl;
else if(p.type == lettr)
output << *((char*)(p.data)) << std::endl;
return output; // for multiple << operators.
}
friend std::istream& operator>>(std::istream& input, lol_t& p) {
//p.type = lettr;
input >> *((char*)(p.data));
return input; // for multiple << operators.
}
friend bool operator> (const lol_t &t, const NUMBAR &i)
{
return *((int*)(t.data)) > i;
}
friend bool operator< (const lol_t &t, const NUMBAR &i)
{
return *((int*)(t.data)) < i;
}
friend bool operator<<(lol_t &t, const NUMBAR &i)
{
return *((int*)(t.data)) += i;
}
friend bool operator>>(lol_t &t, const NUMBAR &i)
{
return *((int*)(t.data)) *= i;
}
friend bool operator|=(lol_t &t, const NUMBAR &i)
{
return *((int*)(t.data)) /= i;
}
////////////////////////////////////////////////////////////////////////
friend bool operator|(lol_t &t, const int &i)
{
t.type = numbar;
return *((int*)(t.data)) = i;
}
friend bool operator|(lol_t &t, const lol_t &i)
{
t.type = i.type;
return *((int*)(t.data)) = *((int*)(i.data));
}
friend bool operator|(lol_t &t, const char &i)
{
t.type = lettr;
return *((char*)(t.data)) = i;
}
friend bool operator|(lol_t &t, const bool &i)
{
t.type = troof;
return *((bool*)(t.data)) = i;
}
};
#endif
|