mc_rtc  2.12.0
StringInput.h
Go to the documentation of this file.
1 /*
2  * Copyright 2015-2019 CNRS-UM LIRMM, CNRS-AIST JRL
3  */
4 
5 #pragma once
6 
7 #include <mc_rtc/gui/elements.h>
8 
9 namespace mc_rtc::gui
10 {
11 
12 namespace details
13 {
14 
16 template<typename GetT, typename SetT>
17 struct StringInputImpl : public CommonInputImpl<GetT, SetT>
18 {
19  static constexpr auto type = Elements::StringInput;
20 
21  StringInputImpl(const std::string & name, GetT get_fn, SetT set_fn)
22  : CommonInputImpl<GetT, SetT>(name, get_fn, set_fn)
23  {
24  }
25 
28 };
29 
30 } // namespace details
31 
33 template<typename GetT, typename SetT>
34 auto StringInput(const std::string & name, GetT get_fn, SetT set_fn)
35 {
36  return details::StringInputImpl(name, get_fn, set_fn);
37 }
38 
40 inline auto StringInput(const std::string & name, std::string & value)
41 {
42  return details::StringInputImpl(name, details::read(value), details::write(value));
43 }
44 
45 } // namespace mc_rtc::gui
auto read(const T &&value)
Definition: traits.h:188
auto write(T &value)
Definition: traits.h:224
Definition: Observer.h:16
auto StringInput(const std::string &name, GetT get_fn, SetT set_fn)
Definition: StringInput.h:34
Definition: elements.h:167
const std::string & name() const
Definition: elements.h:61
Definition: StringInput.h:18
StringInputImpl(const std::string &name, GetT get_fn, SetT set_fn)
Definition: StringInput.h:21
static constexpr auto type
Definition: StringInput.h:19
StringInputImpl()
Definition: StringInput.h:27