|
|
@ -5,6 +5,10 @@ uint32_t ShortCode::unwrap() const { |
|
|
|
return code; // raw uint32_t code
|
|
|
|
} |
|
|
|
|
|
|
|
bool ShortCode::valid() const { |
|
|
|
return ShortCode::check(code); |
|
|
|
} |
|
|
|
|
|
|
|
ShortCode ShortCode::create(uint32_t short_code) { |
|
|
|
return ShortCode(short_code); |
|
|
|
} |
|
|
@ -20,6 +24,10 @@ bool ShortCode::check(uint32_t short_code) { |
|
|
|
return short_code < SHORT_CODE_LIMIT; // 0 ~ (SHORT_CODE_LIMIT - 1)
|
|
|
|
} |
|
|
|
|
|
|
|
bool ShortCode::operator==(const ShortCode &short_code) const { |
|
|
|
return this->code == short_code.code; |
|
|
|
} |
|
|
|
|
|
|
|
std::ostream& operator<<(std::ostream &out, const ShortCode &self) { |
|
|
|
out << self.to_string() << "(" << self.code << ")"; // short code info
|
|
|
|
return out; |
|
|
|