- CMake
- git
Coming if anybody asks.
Download h.h. Add it to you project.
For example in a folder named include
.
Include the header to your .cpp file containing you main function.
#include "include/h.h" // h::hash, h::operator ""_h
// ...
int main(int argc, char** argv) {
switch (h::hash(argv[1], std::strlen(argv[1]))) {
using namespace h::literals;
case "foo"_h:
// ...
case "bar"_h:
// ...
}
}
For a full example check out example.cpp.
#include <cstring> // std::strlen
#include <cstdio> // std::printf
#include "include/h.h" // h::hash, h::operator ""_h
int main(int argc, char** argv) {
using namespace h::literals;
if (argc < 2) return EXIT_FAILURE;
switch (h::hash(argv[1], std::strlen(argv[1]))) {
case "--version"_h:
std::printf("com.viraltaco.h v%s\n", com_viraltaco_h_h);
break;
case "--help"_h:
case "-h"_h:
std::printf("--help\n");
break;
default:
std::printf("Invalid input: '%s'\n", argv[1]);
return EXIT_FAILURE;
}
}
Run the CMake project test_libh
.
Or compile and run ./tst/test.cxx
.
This library is provided as-is. Use at your own discretion.
- Fork
- Code (if you add a feature don't forget to write tests for it)
- Test
- Add and commit (if possible: each file individually)
- Push to your remote
- Make a pull request on this repo.
We use SemVer for versioning. For the versions available, see the tags on this repository.
- Anthony Capobianco - Initial work - viraltaco_
See also the list of contributors who participated in this project.
This project is licensed under the MIT License - see MIT for more information.
- PurpleBooth for
their
README.md
template