Ardour  9.0-pre0-582-g084a23a80d
pbd/pbd/types_convert.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2016-2017 Tim Mayberry <mojofunk@gmail.com>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License along
15  * with this program; if not, write to the Free Software Foundation, Inc.,
16  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17  */
18 
19 #ifndef PBD_TYPES_CONVERT_H
20 #define PBD_TYPES_CONVERT_H
21 
22 #include "pbd/enum_convert.h"
23 
24 #include "pbd/controllable.h"
25 #include "pbd/id.h"
26 
27 namespace PBD {
28 
30 
31 template <>
32 inline bool to_string (ID val, std::string& str)
33 {
34  str = val.to_s();
35  return true;
36 }
37 
38 template <>
39 inline bool string_to (const std::string& str, ID& val)
40 {
41  val = str;
42  return true;
43 }
44 
45 template <>
46 inline std::string to_string (ID val)
47 {
48  return val.to_s();
49 }
50 
51 template <>
52 inline ID string_to (const std::string& str)
53 {
54  return ID(str);
55 }
56 
57 } // namespace PBD
58 
59 #endif // PBD_TYPES_CONVERT_H
Definition: id.h:34
std::string to_s() const
Definition: axis_view.h:42
bool to_string(ARDOUR::AnyTime const &at, std::string &str)
DEFINE_ENUM_CONVERT(ARDOUR::Track::FreezeState)
bool string_to(std::string const &str, ARDOUR::AnyTime &at)