argutil.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. /*############################################################################
  2. # Copyright 2016 Intel Corporation
  3. #
  4. # Licensed under the Apache License, Version 2.0 (the "License");
  5. # you may not use this file except in compliance with the License.
  6. # You may obtain a copy of the License at
  7. #
  8. # http://www.apache.org/licenses/LICENSE-2.0
  9. #
  10. # Unless required by applicable law or agreed to in writing, software
  11. # distributed under the License is distributed on an "AS IS" BASIS,
  12. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. # See the License for the specific language governing permissions and
  14. # limitations under the License.
  15. ############################################################################*/
  16. /*!
  17. * \file
  18. * \brief Argument parsing utilities interface.
  19. */
  20. #ifndef EXAMPLE_UTIL_ARGUTIL_H_
  21. #define EXAMPLE_UTIL_ARGUTIL_H_
  22. /// get the index of an option in argv
  23. /*!
  24. \param[in] argc number of arguments
  25. \param[in] argv list of arguments
  26. \param[in] name of option
  27. \returns index of the option in argv
  28. */
  29. int GetOptionIndex(int argc, char* const argv[], char const* option);
  30. /// test if an option is in argv
  31. /*!
  32. \param[in] argc number of arguments
  33. \param[in] argv list of arguments
  34. \param[in] name of option
  35. \retval true option is in argv
  36. \retval false option is not in argv
  37. */
  38. int CmdOptionExists(int argc, char* const argv[], char const* option);
  39. /// find option in argv
  40. /*!
  41. \param[in] argc number of arguments
  42. \param[in] argv list of arguments
  43. \param[in] name of option
  44. \returns pointer from argv for option
  45. */
  46. char const* GetCmdOption(int argc, char* const argv[], char const* option);
  47. #endif // EXAMPLE_UTIL_ARGUTIL_H_