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
mc_rtc::gui::StringInput
auto StringInput(const std::string &name, GetT get_fn, SetT set_fn)
Definition: StringInput.h:34
mc_rtc::gui::details::StringInputImpl::StringInputImpl
StringInputImpl()
Definition: StringInput.h:27
mc_rtc::gui::details::read
auto read(const T &&value)
Definition: traits.h:188
elements.h
mc_rtc::gui::details::write
auto write(T &value)
Definition: traits.h:224
mc_rtc::gui::details::StringInputImpl::StringInputImpl
StringInputImpl(const std::string &name, GetT get_fn, SetT set_fn)
Definition: StringInput.h:21
mc_rtc::gui::details::StringInputImpl
Definition: StringInput.h:17
mc_rtc::gui::Elements::StringInput
@ StringInput
mc_rtc::gui::details::StringInputImpl::type
static constexpr auto type
Definition: StringInput.h:19
mc_rtc::gui::CommonInputImpl
Definition: elements.h:166
mc_rtc::gui
Definition: Observer.h:15
mc_rtc::gui::Element::name
const std::string & name() const
Definition: elements.h:61