1 #include "constraints.h" 2 #include "util/filesystem.h" 3 #include <algorithm> 4 using namespace std; 5 is_not_invalid_doid(const doid_t & c)6bool is_not_invalid_doid(const doid_t& c) 7 { 8 return c != INVALID_DO_ID; 9 } is_not_reserved_doid(const doid_t & c)10bool is_not_reserved_doid(const doid_t& c) 11 { 12 return (c < 1) || (c > 999); 13 } is_not_invalid_channel(const channel_t & c)14bool is_not_invalid_channel(const channel_t& c) 15 { 16 return c != INVALID_CHANNEL; 17 } is_not_reserved_channel(const channel_t & c)18bool is_not_reserved_channel(const channel_t& c) 19 { 20 return (c < 1) 21 || ((c > 999) && (c < (channel_t(1) << ZONE_BITS))) 22 || (c > channel_t(999) << ZONE_BITS); 23 } is_boolean_keyword(const string & str)24bool is_boolean_keyword(const string& str) 25 { 26 string lower = str; 27 transform(lower.begin(), lower.end(), lower.begin(), ::tolower); 28 return (lower == "false") || (lower == "true"); 29 } 30 is_existing_and_readable_file(const std::string & file)31bool is_existing_and_readable_file(const std::string& file) 32 { 33 return fs::file_exists(file) && fs::is_readable(file); 34 } 35