From d1cf21511325622116c42188ef3b2e1e203d6b2d Mon Sep 17 00:00:00 2001 From: Edouard DUPIN Date: Thu, 5 Mar 2015 11:20:24 +0100 Subject: [PATCH] [DEV] add etk::to_string --- audio/channel.cpp | 16 ++++++++++++++++ audio/format.cpp | 17 +++++++++++++++++ 2 files changed, 33 insertions(+) diff --git a/audio/channel.cpp b/audio/channel.cpp index d4b8f03..0e3f1bd 100644 --- a/audio/channel.cpp +++ b/audio/channel.cpp @@ -87,3 +87,19 @@ std::vector audio::getListChannelFromString(const std::stri } return out; } + +namespace etk { + template<> std::string to_string(const enum audio::channel& _variable) { + return listValues[_variable]; + } + template <> bool from_string(enum audio::channel& _variableRet, const std::string& _value) { + for (int32_t iii=0; iii(iii); + return true; + } + } + _variableRet = audio::channel_unknow; + return false; + } +} diff --git a/audio/format.cpp b/audio/format.cpp index 06cd792..2cc6c2a 100644 --- a/audio/format.cpp +++ b/audio/format.cpp @@ -80,4 +80,21 @@ uint32_t audio::getFormatBytes(audio::format _format) { } AUDIO_ERROR("undefined format : " << _format); return 0; +} + + +namespace etk { + template<> std::string to_string(const enum audio::format& _variable) { + return listValues[_variable]; + } + template <> bool from_string(enum audio::format& _variableRet, const std::string& _value) { + for (int32_t iii=0; iii(iii); + return true; + } + } + _variableRet = audio::format_unknow; + return false; + } } \ No newline at end of file