mirror of https://github.com/dnomd343/klotski.git
Dnomd343
2 years ago
8 changed files with 75 additions and 47 deletions
@ -1,4 +1,4 @@ |
|||
cmake_minimum_required(VERSION 3.0) |
|||
|
|||
add_library(common_code serialize.cc common_code.cc) |
|||
add_library(common_code convert.cc serialize.cc common_code.cc) |
|||
target_link_libraries(common_code utils raw_code) |
|||
|
@ -0,0 +1,41 @@ |
|||
#include "common_code.h" |
|||
|
|||
/// CommonCode to RawCode
|
|||
RawCode CommonCode::to_raw_code() const { |
|||
return RawCode(*this); // convert to raw code
|
|||
} |
|||
|
|||
/// CommonCode to ShortCode
|
|||
ShortCode CommonCode::to_short_code() const { |
|||
return ShortCode(*this); // convert to short code
|
|||
} |
|||
|
|||
/// RawCode to CommonCode
|
|||
CommonCode CommonCode::from_raw_code(uint64_t raw_code) { |
|||
return RawCode(raw_code).to_common_code(); |
|||
} |
|||
|
|||
CommonCode CommonCode::from_raw_code(const RawCode &raw_code) { |
|||
return raw_code.to_common_code(); |
|||
} |
|||
|
|||
CommonCode::CommonCode(const RawCode &raw_code) { |
|||
code = raw_code.to_common_code().code; // convert from raw code
|
|||
} |
|||
|
|||
/// ShortCode to CommonCode
|
|||
CommonCode CommonCode::from_short_code(uint32_t short_code) { |
|||
return ShortCode(short_code).to_common_code(); |
|||
} |
|||
|
|||
CommonCode CommonCode::from_short_code(const ShortCode &short_code) { |
|||
return short_code.to_common_code(); |
|||
} |
|||
|
|||
CommonCode CommonCode::from_short_code(const std::string &short_code) { |
|||
return ShortCode(short_code).to_common_code(); |
|||
} |
|||
|
|||
CommonCode::CommonCode(const ShortCode &short_code) { |
|||
code = short_code.to_common_code().code; // convert from short code
|
|||
} |
@ -1,4 +1,4 @@ |
|||
cmake_minimum_required(VERSION 3.0) |
|||
|
|||
add_library(raw_code convert.cc raw_code.cc) |
|||
target_link_libraries(raw_code utils common_code) |
|||
target_link_libraries(raw_code utils) |
|||
|
Loading…
Reference in new issue