CLI11  2.5.0
Split.hpp
Go to the documentation of this file.
1 // Copyright (c) 2017-2025, 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 
20 namespace CLI {
21 // [CLI11:split_hpp:verbatim]
22 
23 namespace detail {
24 
25 // Returns false if not a short option. Otherwise, sets opt name and rest and returns true
26 CLI11_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
29 CLI11_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
32 CLI11_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
35 CLI11_INLINE std::vector<std::string> split_names(std::string current);
36 
38 CLI11_INLINE std::vector<std::pair<std::string, std::string>> get_default_flag_values(const std::string &str);
39 
41 CLI11_INLINE std::tuple<std::vector<std::string>, std::vector<std::string>, std::string>
42 get_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
Definition: App.hpp:36
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 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)
#define CLI11_INLINE
Definition: Macros.hpp:150
CLI11_INLINE bool split_long(const std::string &current, std::string &name, std::string &value)
CLI11_INLINE std::tuple< std::vector< std::string >, std::vector< std::string >, std::string > get_names(const std::vector< std::string > &input, bool allow_non_standard=false)
Get a vector of short names, one of long names, and a single name.
CLI11_INLINE std::vector< std::string > split_names(std::string current)