CLI11
C++11 Command Line Interface Parser
Loading...
Searching...
No Matches
Split.hpp
1// Copyright (c) 2017-2024, University of Cincinnati, developed by Henry Schreiner
2// under NSF AWARD 1414736 and by the respective contributors.
3// All rights reserved.
4//
5// SPDX-License-Identifier: BSD-3-Clause
6
7#pragma once
8
9// IWYU pragma: private, include "CLI/CLI.hpp"
10
11// [CLI11:public_includes:set]
12#include <string>
13#include <tuple>
14#include <utility>
15#include <vector>
16// [CLI11:public_includes:end]
17
18#include "Macros.hpp"
19
20namespace CLI {
21// [CLI11:split_hpp:verbatim]
22
23namespace detail {
24
25// Returns false if not a short option. Otherwise, sets opt name and rest and returns true
26CLI11_INLINE bool split_short(const std::string &current, std::string &name, std::string &rest);
27
28// Returns false if not a long option. Otherwise, sets opt name and other side of = and returns true
29CLI11_INLINE bool split_long(const std::string &current, std::string &name, std::string &value);
30
31// Returns false if not a windows style option. Otherwise, sets opt name and value and returns true
32CLI11_INLINE bool split_windows_style(const std::string &current, std::string &name, std::string &value);
33
34// Splits a string into multiple long and short names
35CLI11_INLINE std::vector<std::string> split_names(std::string current);
36
38CLI11_INLINE std::vector<std::pair<std::string, std::string>> get_default_flag_values(const std::string &str);
39
41CLI11_INLINE std::tuple<std::vector<std::string>, std::vector<std::string>, std::string>
42get_names(const std::vector<std::string> &input, bool allow_non_standard = false);
43
44} // namespace detail
45// [CLI11:split_hpp:end]
46} // namespace CLI
47
48#ifndef CLI11_COMPILE
49#include "impl/Split_inl.hpp" // IWYU pragma: export
50#endif