Created
April 22, 2011 18:15
-
-
Save manicai/937285 to your computer and use it in GitHub Desktop.
Simple AutoExp visualizers
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class TimePeriod | |
{ | |
private: | |
unsigned int value_; | |
public: | |
TimePeriod(int days, int months, int years) | |
{ | |
value_ = days; | |
value_ += months << 16; | |
value_ += years << 20; | |
} | |
int days() const { return (value_ & 0xFFFF); } | |
int months() const { return (value_ & 0xF0000) >> 16; } | |
int years() const { return value_ >> 20; } | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
TimePeriod{ | |
preview ( | |
#( | |
(($c.value_ & 0xFFF00000) >> 20), " years ", | |
(($c.value_ & 0xF0000) >> 16), " months ", | |
($c.value_ & 0xFFFF), " days" | |
) | |
) | |
children | |
( | |
#( | |
[raw] : [$c,!], | |
years : (($c.value_ & 0xFFF00000) >> 20), | |
months : (($c.value_ & 0xF0000) >> 16), | |
days : ($c.value_ & 0xFFFF) | |
) | |
) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment