YARP
Yet Another Robot Platform
SplitString.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2006-2020 Istituto Italiano di Tecnologia (IIT)
3  * Copyright (C) 2006-2010 RobotCub Consortium
4  * All rights reserved.
5  *
6  * This software may be modified and distributed under the terms of the
7  * BSD-3-Clause license. See the accompanying LICENSE file for details.
8  */
9 
10 #ifndef YARP_OS_IMPL_SPLITSTRING_H
11 #define YARP_OS_IMPL_SPLITSTRING_H
12 
13 #include <yarp/os/api.h>
14 
15 #include <cstddef>
16 
17 namespace yarp {
18 namespace os {
19 namespace impl {
20 
27 {
28 public:
29  SplitString();
30 
31  SplitString(const char* command, const char splitter = ' ');
32 
33  int size();
34 
35  void set(int index, const char* txt);
36 
37  const char* get(int idx);
38 
39  const char** get();
40 
41  void apply(const char* command, char splitter = ' ');
42 
43 private:
44  static constexpr size_t MAX_ARG_CT = 20;
45  static constexpr size_t MAX_ARG_LEN = 256;
46 
47  int argc;
48  const char* argv[MAX_ARG_CT];
49  char buf[MAX_ARG_CT][MAX_ARG_LEN];
50 };
51 
52 } // namespace impl
53 } // namespace os
54 } // namespace yarp
55 
56 #endif // YARP_OS_IMPL_SPLITSTRING_H
yarp::os::impl::SplitString
Split a string into pieces.
Definition: SplitString.h:27
api.h
yarp
The main, catch-all namespace for YARP.
Definition: environment.h:18
YARP_os_impl_API
#define YARP_os_impl_API
Definition: api.h:45