diff --git a/README.md b/README.md index 438f82f..176fc3e 100644 --- a/README.md +++ b/README.md @@ -25,13 +25,13 @@ The following is a list of examples for using the library: * Creating a nil UUID ``` uuid empty; -assert(empty.is_nil()); +assert(empty.nil()); assert(empty.size() == 16); ``` * Creating a new UUID ``` uuid const guid = uuids::make_uuid(); -assert(!guid.is_nil()); +assert(!guid.nil()); assert(guid.size() == 16); assert(guid.version() == uuids::uuid_version::random_number_based); assert(guid.variant() == uuids::uuid_variant::rfc); @@ -64,18 +64,18 @@ assert(empty != guid); uuid empty; uuid guid = uuids::make_uuid(); -assert(empty.is_nil()); -assert(!guid.is_nil()); +assert(empty.nil()); +assert(!guid.nil()); std::swap(empty, guid); -assert(!empty.is_nil()); -assert(guid.is_nil()); +assert(!empty.nil()); +assert(guid.nil()); empty.swap(guid); -assert(empty.is_nil()); -assert(!guid.is_nil()); +assert(empty.nil()); +assert(!guid.nil()); ``` * Converting to string ``` diff --git a/build/.gitignore b/build/.gitignore new file mode 100644 index 0000000..45b2bb0 --- /dev/null +++ b/build/.gitignore @@ -0,0 +1,6 @@ +#ignore all +/* + +# keep these files +!.gitignore +!readme.txt \ No newline at end of file diff --git a/build/readme.txt b/build/readme.txt new file mode 100644 index 0000000..d9c7494 --- /dev/null +++ b/build/readme.txt @@ -0,0 +1,5 @@ +Create a project from this folder by running the command: + +cmake .. + +If you don't have CMake installed you can get it from https://cmake.org/ \ No newline at end of file diff --git a/include/uuid.h b/include/uuid.h index 7d10405..0cfa262 100644 --- a/include/uuid.h +++ b/include/uuid.h @@ -120,7 +120,7 @@ namespace uuids constexpr std::size_t size() const noexcept { return 16; } - constexpr bool is_nil() const noexcept + constexpr bool nil() const noexcept { for (size_t i = 0; i < data.size(); ++i) if (data[i] != 0) return false; return true; diff --git a/test/.gitignore b/test/.gitignore deleted file mode 100644 index bb35e58..0000000 --- a/test/.gitignore +++ /dev/null @@ -1 +0,0 @@ -CMakeFiles \ No newline at end of file diff --git a/test/test.cpp b/test/test.cpp index 61a7edd..c1c1852 100644 --- a/test/test.cpp +++ b/test/test.cpp @@ -12,7 +12,7 @@ int main() std::cout << "Test default constructor" << std::endl; uuid empty; - assert(empty.is_nil()); + assert(empty.nil()); assert(empty.size() == 16); } @@ -40,7 +40,7 @@ int main() std::cout << "Test make" << std::endl; uuid const guid = uuids::make_uuid(); - assert(!guid.is_nil()); + assert(!guid.nil()); assert(guid.size() == 16); assert(guid.version() == uuids::uuid_version::random_number_based); assert(guid.variant() == uuids::uuid_variant::rfc); @@ -106,18 +106,18 @@ int main() uuid empty; uuid guid = uuids::make_uuid(); - assert(empty.is_nil()); - assert(!guid.is_nil()); + assert(empty.nil()); + assert(!guid.nil()); std::swap(empty, guid); - assert(!empty.is_nil()); - assert(guid.is_nil()); + assert(!empty.nil()); + assert(guid.nil()); empty.swap(guid); - assert(empty.is_nil()); - assert(!guid.is_nil()); + assert(empty.nil()); + assert(!guid.nil()); } { @@ -132,7 +132,7 @@ int main() std::cout << "Test constexpr" << std::endl; constexpr uuid empty; - constexpr bool isnil = empty.is_nil(); + constexpr bool isnil = empty.nil(); constexpr size_t size = empty.size(); constexpr uuid_variant variant = empty.variant(); constexpr uuid_version version = empty.version();