CLI11 2.4.1
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// [CLI11:public_includes:set]
10#include <string>
11#include <tuple>
12#include <utility>
13#include <vector>
14// [CLI11:public_includes:end]
15
16#include "Macros.hpp"
17
18namespace CLI {
19// [CLI11:split_hpp:verbatim]
20
21namespace detail {
22
23// Returns false if not a short option. Otherwise, sets opt name and rest and returns true
24CLI11_INLINE bool split_short(const std::string &current, std::string &name, std::string &rest);
25
26// Returns false if not a long option. Otherwise, sets opt name and other side of = and returns true
27CLI11_INLINE bool split_long(const std::string &current, std::string &name, std::string &value);
28
29// Returns false if not a windows style option. Otherwise, sets opt name and value and returns true
30CLI11_INLINE bool split_windows_style(const std::string &current, std::string &name, std::string &value);
31
32// Splits a string into multiple long and short names
33CLI11_INLINE std::vector<std::string> split_names(std::string current);
34
36CLI11_INLINE std::vector<std::pair<std::string, std::string>> get_default_flag_values(const std::string &str);
37
39CLI11_INLINE std::tuple<std::vector<std::string>, std::vector<std::string>, std::string>
40get_names(const std::vector<std::string> &input);
41
42} // namespace detail
43// [CLI11:split_hpp:end]
44} // namespace CLI
45
46#ifndef CLI11_COMPILE
47#include "impl/Split_inl.hpp"
48#endif
#define CLI11_INLINE
Definition: Macros.hpp:129
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 !
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:34