CLI11 2.4.2
Loading...
Searching...
No Matches
Split.hpp
Go to the documentation of this file.
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);
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
#define CLI11_INLINE
Definition Macros.hpp:131
CLI11_INLINE std::vector< std::pair< std::string, std::string > > get_default_flag_values(const std::string &str)
extract default flag values either {def} or starting with a !
auto checked_to_string(T &&value) -> decltype(to_string(std::forward< T >(value)))
special template overload
Definition TypeTools.hpp:368
CLI11_INLINE std::tuple< std::vector< std::string >, std::vector< std::string >, std::string > get_names(const std::vector< std::string > &input)
Get a vector of short names, one of long names, and a single name.
CLI11_INLINE bool split_long(const std::string &current, std::string &name, std::string &value)
CLI11_INLINE bool split_windows_style(const std::string &current, std::string &name, std::string &value)
CLI11_INLINE bool split_short(const std::string &current, std::string &name, std::string &rest)
CLI11_INLINE std::vector< std::string > split_names(std::string current)
Definition App.hpp:36