PageRenderTime 46ms CodeModel.GetById 1ms RepoModel.GetById 1ms app.codeStats 0ms

/src/cyad/CommandlineParser/CmdlineErrors.cpp

https://gitlab.com/github-cloud-corporation/cynara
C++ | 73 lines | 37 code | 15 blank | 21 comment | 0 complexity | 9add0df7556ee91cac70f0e16ecb971f MD5 | raw file
  1. /*
  2. * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
  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 src/cyad/CommandlineParser/CommandlineErrors.cpp
  18. * @author Aleksander Zdyb <a.zdyb@samsung.com>
  19. * @version 1.0
  20. * @brief Command-line error messages
  21. */
  22. #include <cyad/CommandlineParser/CmdlineOpts.h>
  23. #include "CmdlineErrors.h"
  24. namespace Cynara {
  25. namespace CmdlineErrors {
  26. std::string inOption(CmdlineOpts::CmdlineOpt option, const std::string &prefix) {
  27. const auto &opt = CmdlineOpts::commandlineOptions.at(option);
  28. return prefix + " in --" + opt.longOption + " (-" + opt.shortOption + ")";
  29. }
  30. std::string unknownError(void) {
  31. return "Unknown error";
  32. };
  33. std::string noOption(void) {
  34. return "No option specified";
  35. };
  36. std::string unknownOption(void) {
  37. return "Unknown option";
  38. };
  39. std::string unknownOption(CmdlineOpts::CmdlineOpt option) {
  40. return inOption(option, "Unknown option");
  41. };
  42. std::string noType(void) {
  43. return "No --policy specified";
  44. };
  45. std::string noBucket(void) {
  46. return "No bucket specified";
  47. };
  48. std::string invalidType(void) {
  49. return "Invalid --policy option";
  50. };
  51. std::string optionMissing(CmdlineOpts::CmdlineOpt option) {
  52. return inOption(option, "One or more option missing");
  53. };
  54. std::string argumentMissing(CmdlineOpts::CmdlineOpt option) {
  55. return inOption(option, "One or more argument missing");
  56. };
  57. } /* namespace CmdlineErrors */
  58. } /* namespace Cynara */