CLI11  2.3.2
Split.hpp
Go to the documentation of this file.
1 // Copyright (c) 2017-2023, 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 
18 namespace CLI {
19 // [CLI11:split_hpp:verbatim]
20 
21 namespace detail {
22 
23 // Returns false if not a short option. Otherwise, sets opt name and rest and returns true
24 CLI11_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
27 CLI11_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
30 CLI11_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
33 CLI11_INLINE std::vector<std::string> split_names(std::string current);
34 
36 CLI11_INLINE std::vector<std::pair<std::string, std::string>> get_default_flag_values(const std::string &str);
37 
39 CLI11_INLINE std::tuple<std::vector<std::string>, std::vector<std::string>, std::string>
40 get_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
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.
Definition: App.hpp:34
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:73
CLI11_INLINE bool split_long(const std::string &current, std::string &name, std::string &value)
CLI11_INLINE std::vector< std::string > split_names(std::string current)