diff options
author | Sakari Bergen <sakari.bergen@beatwaves.net> | 2008-09-26 12:33:16 +0000 |
---|---|---|
committer | Sakari Bergen <sakari.bergen@beatwaves.net> | 2008-09-26 12:33:16 +0000 |
commit | 6f4daaae0af346bc8a3a1b528a043b45198b687a (patch) | |
tree | 88fa21a0b7ac3836de16f2212c2961ba3f53d7f0 /libs/ardour/ardour/export_profile_manager.h | |
parent | 66ab3d39e0ec9da12cb3dee1229ad90531df53f7 (diff) |
Improved ExportProfileManager error handling, and added some missing (?) initialization
git-svn-id: svn://localhost/ardour2/branches/3.0@3807 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour/ardour/export_profile_manager.h')
-rw-r--r-- | libs/ardour/ardour/export_profile_manager.h | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/libs/ardour/ardour/export_profile_manager.h b/libs/ardour/ardour/export_profile_manager.h index d63549e185..d2f1c162e0 100644 --- a/libs/ardour/ardour/export_profile_manager.h +++ b/libs/ardour/ardour/export_profile_manager.h @@ -25,6 +25,7 @@ #include <vector> #include <map> #include <set> +#include <stdexcept> #include <boost/shared_ptr.hpp> #include <boost/weak_ptr.hpp> @@ -143,7 +144,7 @@ class ExportProfileManager typedef std::list<TimespanStatePtr> TimespanStateList; void set_selection_range (nframes_t start = 0, nframes_t end = 0); - TimespanStateList const & get_timespans () { return timespans; } + TimespanStateList const & get_timespans () { return check_list (timespans); } private: @@ -175,7 +176,7 @@ class ExportProfileManager typedef boost::shared_ptr<ChannelConfigState> ChannelConfigStatePtr; typedef std::list<ChannelConfigStatePtr> ChannelConfigStateList; - ChannelConfigStateList const & get_channel_configs () { return channel_configs; } + ChannelConfigStateList const & get_channel_configs () { return check_list (channel_configs); } private: @@ -199,7 +200,7 @@ class ExportProfileManager typedef boost::shared_ptr<FormatState> FormatStatePtr; typedef std::list<FormatStatePtr> FormatStateList; - FormatStateList const & get_formats () { return formats; } + FormatStateList const & get_formats () { return check_list (formats); } FormatStatePtr duplicate_format_state (FormatStatePtr state); void remove_format_state (FormatStatePtr state); @@ -238,7 +239,7 @@ class ExportProfileManager typedef boost::shared_ptr<FilenameState> FilenameStatePtr; typedef std::list<FilenameStatePtr> FilenameStateList; - FilenameStateList const & get_filenames () { return filenames; } + FilenameStateList const & get_filenames () { return check_list (filenames); } FilenameStatePtr duplicate_filename_state (FilenameStatePtr state); void remove_filename_state (FilenameStatePtr state); @@ -265,6 +266,20 @@ class ExportProfileManager ChannelConfigStatePtr channel_config_state, FormatStatePtr format_state, FilenameStatePtr filename_state); + + /* Utilities */ + + /* Element state lists should never be empty, this is used to check them */ + template<typename T> + std::list<T> const & + check_list (std::list<T> const & list) + { + if (list.empty()) { + throw std::runtime_error ("Programming error: Uninitialized list in ExportProfileManager"); + } + return list; + } + }; |