SigUtil  0.95
Utility modules for modern C++
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
sig::Percent Class Reference

パーセント型 More...

Public Member Functions

 Percent (int percent)
 
int get_percent () const
 
double get_double () const
 
Percent operator= (Percent src)
 
Percent operator= (int src)
 
bool operator== (Percent obj) const
 
bool operator!= (Percent obj) const
 

Static Public Member Functions

static Percent const & unit ()
 

Friends

class boost::serialization::access
 
template<class Archive >
void save_construct_data (Archive &ar, Percent const *p, unsigned int version)
 
template<class Archive >
void load_construct_data (Archive &ar, Percent *p, unsigned int version)
 

Detailed Description

パーセント型

Percent pc1(100); Percent pc2(50); Percent pc3(0); Percent pc4(0);

pc3 = 1; // copy assignment. pc4 == 1% pc4 = Percent::unit(); // copy assignment. pc3 == 100%

assert(pc1.get_percent() == 100 && equal(pc1.get_double(), 1)); // 100% = 1 assert(pc2.get_percent() == 50 && equal(pc2.get_double(), 0.5)); // 50% = 0.5 assert(pc3.get_percent() == 1 && equal(pc3.get_double(), 0.01)); // 1% = 0.01 assert(pc1 == pc4);

Definition at line 36 of file percent.hpp.

Constructor & Destructor Documentation

sig::Percent::Percent ( int  percent)
inlineexplicit

Definition at line 41 of file percent.hpp.

Member Function Documentation

double sig::Percent::get_double ( ) const
inline

Definition at line 44 of file percent.hpp.

int sig::Percent::get_percent ( ) const
inline

Definition at line 43 of file percent.hpp.

bool sig::Percent::operator!= ( Percent  obj) const
inline

Definition at line 53 of file percent.hpp.

Percent sig::Percent::operator= ( Percent  src)
inline

Definition at line 48 of file percent.hpp.

Percent sig::Percent::operator= ( int  src)
inline

Definition at line 49 of file percent.hpp.

bool sig::Percent::operator== ( Percent  obj) const
inline

Definition at line 51 of file percent.hpp.

static Percent const& sig::Percent::unit ( )
inlinestatic

Definition at line 46 of file percent.hpp.

Friends And Related Function Documentation

friend class boost::serialization::access
friend

Definition at line 57 of file percent.hpp.

template<class Archive >
void load_construct_data ( Archive &  ar,
Percent p,
unsigned int  version 
)
friend

Definition at line 69 of file percent.hpp.

template<class Archive >
void save_construct_data ( Archive &  ar,
Percent const *  p,
unsigned int  version 
)
friend

Definition at line 66 of file percent.hpp.


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