From 4d112a8e6b90fa64a5cd333042044768111ba994 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Tue, 14 Sep 2010 15:45:21 +0000 Subject: remove Glib::ustring from libardour; allow any characters except '/' and '\' in paths (may cause issues when loading creatively named 2.X sessions; fix a couple of details of name collection and usage from the startup dialog git-svn-id: svn://localhost/ardour2/branches/3.0@7772 d708f5d6-7413-0410-9779-e7cbd77b26cf --- libs/ardour/ardour/audio_unit.h | 4 +- libs/ardour/ardour/audiofilesource.h | 28 +++--- libs/ardour/ardour/audiosource.h | 21 ++--- libs/ardour/ardour/export_channel_configuration.h | 8 +- libs/ardour/ardour/export_filename.h | 28 +++--- libs/ardour/ardour/export_format_base.h | 14 +-- libs/ardour/ardour/export_format_compatibility.h | 3 +- libs/ardour/ardour/export_format_manager.h | 6 +- libs/ardour/ardour/export_format_specification.h | 14 +-- libs/ardour/ardour/export_formats.h | 6 +- libs/ardour/ardour/export_profile_manager.h | 10 +- libs/ardour/ardour/export_timespan.h | 15 ++- libs/ardour/ardour/file_source.h | 28 +++--- libs/ardour/ardour/import_status.h | 2 +- libs/ardour/ardour/plugin.h | 6 +- libs/ardour/ardour/session.h | 4 +- libs/ardour/ardour/session_configuration_vars.h | 2 +- libs/ardour/ardour/session_metadata.h | 107 +++++++++++----------- libs/ardour/ardour/smf_source.h | 6 +- libs/ardour/ardour/sndfilesource.h | 6 +- libs/ardour/ardour/source.h | 2 +- libs/ardour/ardour/utils.h | 10 +- libs/ardour/audio_region_importer.cc | 2 +- libs/ardour/audio_unit.cc | 20 ++-- libs/ardour/audiofile_tagger.cc | 4 +- libs/ardour/audiofilesource.cc | 38 ++++---- libs/ardour/audiosource.cc | 9 +- libs/ardour/export_filename.cc | 30 +++--- libs/ardour/export_format_manager.cc | 4 +- libs/ardour/export_format_specification.cc | 4 +- libs/ardour/export_formats.cc | 4 +- libs/ardour/export_graph_builder.cc | 3 +- libs/ardour/export_handler.cc | 6 +- libs/ardour/export_profile_manager.cc | 10 +- libs/ardour/file_source.cc | 46 +++++----- libs/ardour/import.cc | 4 +- libs/ardour/midi_patch_manager.cc | 2 +- libs/ardour/port_set.cc | 14 +-- libs/ardour/session.cc | 6 +- libs/ardour/session_metadata.cc | 102 ++++++++++----------- libs/ardour/session_state.cc | 2 +- libs/ardour/smf_source.cc | 6 +- libs/ardour/sndfilesource.cc | 10 +- libs/ardour/utils.cc | 87 +++++++++++++++--- libs/ardour/vst_plugin.cc | 2 +- 45 files changed, 403 insertions(+), 342 deletions(-) (limited to 'libs') diff --git a/libs/ardour/ardour/audio_unit.h b/libs/ardour/ardour/audio_unit.h index 6d2b2410fd..3ec17cda59 100644 --- a/libs/ardour/ardour/audio_unit.h +++ b/libs/ardour/ardour/audio_unit.h @@ -167,7 +167,7 @@ class AUPluginInfo : public PluginInfo { AUPluginCachedInfo cache; static PluginInfoList* discover (); - static void get_names (CAComponentDescription&, std::string& name, Glib::ustring& maker); + static void get_names (CAComponentDescription&, std::string& name, std::string& maker); static std::string stringify_descriptor (const CAComponentDescription&); static int load_cached_info (); @@ -180,7 +180,7 @@ class AUPluginInfo : public PluginInfo { static void discover_fx (PluginInfoList&); static void discover_generators (PluginInfoList&); static void discover_by_description (PluginInfoList&, CAComponentDescription&); - static Glib::ustring au_cache_path (); + static std::string au_cache_path (); typedef std::map CachedInfoMap; static CachedInfoMap cached_info; diff --git a/libs/ardour/ardour/audiofilesource.h b/libs/ardour/ardour/audiofilesource.h index f0710843f8..3aef900630 100644 --- a/libs/ardour/ardour/audiofilesource.h +++ b/libs/ardour/ardour/audiofilesource.h @@ -43,15 +43,15 @@ public: return (set_source_name(newname, destructive()) == 0); } - Glib::ustring peak_path (Glib::ustring audio_path); - Glib::ustring find_broken_peakfile (Glib::ustring missing_peak_path, - Glib::ustring audio_path); + std::string peak_path (std::string audio_path); + std::string find_broken_peakfile (std::string missing_peak_path, + std::string audio_path); - static void set_peak_dir (Glib::ustring dir) { peak_dir = dir; } + static void set_peak_dir (std::string dir) { peak_dir = dir; } - static bool get_soundfile_info (Glib::ustring path, SoundFileInfo& _info, std::string& error); + static bool get_soundfile_info (std::string path, SoundFileInfo& _info, std::string& error); - bool safe_file_extension (const Glib::ustring& path) const { + bool safe_file_extension (const std::string& path) const { return safe_audio_file_extension(path); } @@ -77,9 +77,9 @@ public: bool can_truncate_peaks() const { return !destructive(); } bool can_be_analysed() const { return _length > 0; } - static bool safe_audio_file_extension (const Glib::ustring& path); + static bool safe_audio_file_extension (const std::string& path); - static bool is_empty (Session&, Glib::ustring path); + static bool is_empty (Session&, std::string path); static void set_bwf_serial_number (int); static void set_header_position_offset (nframes_t offset ); @@ -88,16 +88,16 @@ public: protected: /** Constructor to be called for existing external-to-session files */ - AudioFileSource (Session&, const Glib::ustring& path, Source::Flag flags); + AudioFileSource (Session&, const std::string& path, Source::Flag flags); /** Constructor to be called for new in-session files */ - AudioFileSource (Session&, const Glib::ustring& path, Source::Flag flags, + AudioFileSource (Session&, const std::string& path, Source::Flag flags, SampleFormat samp_format, HeaderFormat hdr_format); /** Constructor to be called for existing in-session files */ AudioFileSource (Session&, const XMLNode&, bool must_exist = true); - int init (const Glib::ustring& idstr, bool must_exist); + int init (const std::string& idstr, bool must_exist); virtual void set_header_timeline_position () = 0; virtual void handle_header_position_change () {} @@ -106,7 +106,7 @@ protected: static Sample* get_interleave_buffer (nframes_t size); - static Glib::ustring peak_dir; + static std::string peak_dir; static char bwf_country_code[3]; static char bwf_organization_code[4]; @@ -115,8 +115,8 @@ protected: static uint64_t header_position_offset; private: - Glib::ustring old_peak_path (Glib::ustring audio_path); - Glib::ustring broken_peak_path (Glib::ustring audio_path); + std::string old_peak_path (std::string audio_path); + std::string broken_peak_path (std::string audio_path); }; } // namespace ARDOUR diff --git a/libs/ardour/ardour/audiosource.h b/libs/ardour/ardour/audiosource.h index 249757f9b4..7ea7260688 100644 --- a/libs/ardour/ardour/audiosource.h +++ b/libs/ardour/ardour/audiosource.h @@ -26,7 +26,6 @@ #include #include -#include #include #include "ardour/source.h" @@ -43,7 +42,7 @@ class AudioSource : virtual public Source, public boost::enable_shared_from_this { public: - AudioSource (Session&, Glib::ustring name); + AudioSource (Session&, std::string name); AudioSource (Session&, const XMLNode&); virtual ~AudioSource (); @@ -65,8 +64,8 @@ class AudioSource : virtual public Source, virtual bool can_truncate_peaks() const { return true; } - void set_captured_for (Glib::ustring str) { _captured_for = str; } - Glib::ustring captured_for() const { return _captured_for; } + void set_captured_for (std::string str) { _captured_for = str; } + std::string captured_for() const { return _captured_for; } uint32_t read_data_count() const { return _read_data_count; } uint32_t write_data_count() const { return _write_data_count; } @@ -84,7 +83,7 @@ class AudioSource : virtual public Source, XMLNode& get_state (); int set_state (const XMLNode&, int version); - int rename_peakfile (Glib::ustring newpath); + int rename_peakfile (std::string newpath); void touch_peakfile (); static void set_build_missing_peakfiles (bool yn) { @@ -114,13 +113,13 @@ class AudioSource : virtual public Source, framecnt_t _length; bool _peaks_built; mutable Glib::Mutex _peaks_ready_lock; - Glib::ustring peakpath; - Glib::ustring _captured_for; + std::string peakpath; + std::string _captured_for; mutable uint32_t _read_data_count; // modified in read() mutable uint32_t _write_data_count; // modified in write() - int initialize_peakfile (bool newfile, Glib::ustring path); + int initialize_peakfile (bool newfile, std::string path); int build_peaks_from_scratch (); int compute_and_write_peaks (Sample* buf, framepos_t first_frame, framecnt_t cnt, bool force, bool intermediate_peaks_ready_signal); @@ -130,9 +129,9 @@ class AudioSource : virtual public Source, virtual framecnt_t read_unlocked (Sample *dst, framepos_t start, framecnt_t cnt) const = 0; virtual framecnt_t write_unlocked (Sample *dst, framecnt_t cnt) = 0; - virtual Glib::ustring peak_path(Glib::ustring audio_path) = 0; - virtual Glib::ustring find_broken_peakfile (Glib::ustring missing_peak_path, - Glib::ustring audio_path) = 0; + virtual std::string peak_path(std::string audio_path) = 0; + virtual std::string find_broken_peakfile (std::string missing_peak_path, + std::string audio_path) = 0; virtual int read_peaks_with_fpp (PeakData *peaks, framecnt_t npeaks, framepos_t start, framecnt_t cnt, diff --git a/libs/ardour/ardour/export_channel_configuration.h b/libs/ardour/ardour/export_channel_configuration.h index e088aba2f0..932a74328c 100644 --- a/libs/ardour/ardour/export_channel_configuration.h +++ b/libs/ardour/ardour/export_channel_configuration.h @@ -22,7 +22,7 @@ #define __ardour_export_channel_configuration_h__ #include -#include +#include #include #include "ardour/export_channel.h" @@ -62,8 +62,8 @@ class ExportChannelConfiguration : public boost::enable_shared_from_this -#include +#include #include "pbd/statefuldestructible.h" namespace ARDOUR @@ -68,25 +68,25 @@ class ExportFilename { /* data access */ - Glib::ustring get_path (FormatPtr format) const; - Glib::ustring get_folder () const { return folder; } + std::string get_path (FormatPtr format) const; + std::string get_folder () const { return folder; } TimeFormat get_time_format () const { return time_format; } DateFormat get_date_format () const { return date_format; } - Glib::ustring get_time_format_str (TimeFormat format) const; - Glib::ustring get_date_format_str (DateFormat format) const; + std::string get_time_format_str (TimeFormat format) const; + std::string get_date_format_str (DateFormat format) const; - Glib::ustring get_label () const { return label; } + std::string get_label () const { return label; } uint32_t get_revision () const { return revision; } /* data modification */ void set_time_format (TimeFormat format); void set_date_format (DateFormat format); - void set_label (Glib::ustring value); + void set_label (std::string value); void set_revision (uint32_t value) { revision = value; } void set_channel (uint32_t value) { channel = value; } - bool set_folder (Glib::ustring path); + bool set_folder (std::string path); void set_timespan (TimespanPtr ts) { timespan = ts; } void set_channel_config (ChannelConfigPtr cc) { channel_config = cc; } @@ -106,16 +106,16 @@ class ExportFilename { Session & session; - Glib::ustring label; + std::string label; uint32_t revision; uint32_t channel; - Glib::ustring folder; + std::string folder; DateFormat date_format; TimeFormat time_format; - Glib::ustring get_formatted_time (Glib::ustring const & format) const; + std::string get_formatted_time (std::string const & format) const; // Due to the static allocation used in strftime(), no destructor or copy-ctor is needed for this struct tm * time_struct; @@ -124,10 +124,10 @@ class ExportFilename { /* Serialization helpers */ - typedef std::pair FieldPair; + typedef std::pair FieldPair; - void add_field (XMLNode * node, Glib::ustring const & name, bool enabled, Glib::ustring const & value = ""); - FieldPair get_field (XMLNode const & node, Glib::ustring const & name); + void add_field (XMLNode * node, std::string const & name, bool enabled, std::string const & value = ""); + FieldPair get_field (XMLNode const & node, std::string const & name); FieldPair analyse_folder (); }; diff --git a/libs/ardour/ardour/export_format_base.h b/libs/ardour/ardour/export_format_base.h index e372553f29..3bd2bf98fb 100644 --- a/libs/ardour/ardour/export_format_base.h +++ b/libs/ardour/ardour/export_format_base.h @@ -24,7 +24,7 @@ #include #include #include -#include +#include #include #include @@ -122,19 +122,19 @@ class ExportFormatBase { bool selected () const { return _selected; } bool compatible () const { return _compatible; } - Glib::ustring name () const { return _name; } + std::string name () const { return _name; } void set_selected (bool value); void set_compatible (bool value); protected: - void set_name (Glib::ustring name) { _name = name; } + void set_name (std::string name) { _name = name; } private: bool _selected; bool _compatible; - Glib::ustring _name; + std::string _name; }; public: @@ -160,8 +160,8 @@ class ExportFormatBase { bool has_format (FormatId format) const { return format_ids.find (format) != format_ids.end(); } bool has_quality (Quality quality) const { return qualities.find (quality) != qualities.end(); } - void set_extension (Glib::ustring const & extension) { _extension = extension; } - Glib::ustring const & extension () const { return _extension; } + void set_extension (std::string const & extension) { _extension = extension; } + std::string const & extension () const { return _extension; } protected: @@ -182,7 +182,7 @@ class ExportFormatBase { private: - Glib::ustring _extension; + std::string _extension; enum SetOperation { SetUnion, diff --git a/libs/ardour/ardour/export_format_compatibility.h b/libs/ardour/ardour/export_format_compatibility.h index cd2dae5e20..e0a984db6c 100644 --- a/libs/ardour/ardour/export_format_compatibility.h +++ b/libs/ardour/ardour/export_format_compatibility.h @@ -21,6 +21,7 @@ #ifndef __ardour_export_format_compatibility_h__ #define __ardour_export_format_compatibility_h__ +#include #include "ardour/export_format_base.h" namespace ARDOUR @@ -31,7 +32,7 @@ class ExportFormatCompatibility : public ExportFormatBase, public ExportFormatBa private: public: - ExportFormatCompatibility (Glib::ustring name) + ExportFormatCompatibility (std::string name) { set_name (name); sample_formats.insert (SF_None); diff --git a/libs/ardour/ardour/export_format_manager.h b/libs/ardour/ardour/export_format_manager.h index 0d1a0310d9..f82230b8c3 100644 --- a/libs/ardour/ardour/export_format_manager.h +++ b/libs/ardour/ardour/export_format_manager.h @@ -65,7 +65,7 @@ class ExportFormatManager : public PBD::ScopedConnectionList class QualityState : public ExportFormatBase::SelectableCompatible { public: - QualityState (ExportFormatBase::Quality quality, Glib::ustring name) : + QualityState (ExportFormatBase::Quality quality, std::string name) : quality (quality) { set_name (name); } ExportFormatBase::Quality quality; }; @@ -77,7 +77,7 @@ class ExportFormatManager : public PBD::ScopedConnectionList class SampleRateState : public ExportFormatBase::SelectableCompatible { public: - SampleRateState (ExportFormatBase::SampleRate rate, Glib::ustring name) + SampleRateState (ExportFormatBase::SampleRate rate, std::string name) : rate (rate) { set_name (name); } ExportFormatBase::SampleRate rate; }; @@ -103,7 +103,7 @@ class ExportFormatManager : public PBD::ScopedConnectionList /* Non interactive selections */ - void set_name (Glib::ustring name); + void set_name (std::string name); void select_src_quality (ExportFormatBase::SRCQuality value); void select_trim_beginning (bool value); diff --git a/libs/ardour/ardour/export_format_specification.h b/libs/ardour/ardour/export_format_specification.h index 3b9382237c..9594485a91 100644 --- a/libs/ardour/ardour/export_format_specification.h +++ b/libs/ardour/ardour/export_format_specification.h @@ -21,7 +21,7 @@ #ifndef __ardour_export_format_specification_h__ #define __ardour_export_format_specification_h__ -#include +#include #include "pbd/uuid.h" @@ -76,7 +76,7 @@ class ExportFormatSpecification : public ExportFormatBase { void set_format (boost::shared_ptr format); - void set_name (Glib::ustring const & name) { _name = name; } + void set_name (std::string const & name) { _name = name; } void set_type (Type type) { _type = type; } void set_format_id (FormatId value) { format_ids.clear(); format_ids.insert (value); } @@ -100,12 +100,12 @@ class ExportFormatSpecification : public ExportFormatBase { /* Accessing functions */ PBD::UUID const & id () { return _id; } - Glib::ustring const & name () const { return _name; } - Glib::ustring description (); + std::string const & name () const { return _name; } + std::string description (); bool has_broadcast_info () const { return _has_broadcast_info; } uint32_t channel_limit () const { return _channel_limit; } - Glib::ustring format_name () const { return _format_name; } + std::string format_name () const { return _format_name; } Type type () const { return _type; } FormatId format_id () const { return *format_ids.begin(); } @@ -144,7 +144,7 @@ class ExportFormatSpecification : public ExportFormatBase { /* The variables below do not have setters (usually set via set_format) */ - Glib::ustring _format_name; + std::string _format_name; bool has_sample_format; bool supports_tagging; bool _has_broadcast_info; @@ -152,7 +152,7 @@ class ExportFormatSpecification : public ExportFormatBase { /* The variables below have getters and setters */ - Glib::ustring _name; + std::string _name; PBD::UUID _id; Type _type; diff --git a/libs/ardour/ardour/export_formats.h b/libs/ardour/ardour/export_formats.h index 03585f79a9..c29f7a4fbf 100644 --- a/libs/ardour/ardour/export_formats.h +++ b/libs/ardour/ardour/export_formats.h @@ -91,7 +91,7 @@ class HasSampleFormat : public PBD::ScopedConnectionList { class SampleFormatState : public ExportFormatBase::SelectableCompatible { public: - SampleFormatState (ExportFormatBase::SampleFormat format, Glib::ustring name) : + SampleFormatState (ExportFormatBase::SampleFormat format, std::string name) : format (format) { set_name (name); } ExportFormatBase::SampleFormat format; @@ -145,7 +145,7 @@ class HasSampleFormat : public PBD::ScopedConnectionList { private: /* Connected to signals */ - void add_dither_type (ExportFormatBase::DitherType type, Glib::ustring name); + void add_dither_type (ExportFormatBase::DitherType type, std::string name); void update_sample_format_selection (bool); void update_dither_type_selection (bool); @@ -156,7 +156,7 @@ class HasSampleFormat : public PBD::ScopedConnectionList { class ExportFormatLinear : public ExportFormat, public HasSampleFormat { public: - ExportFormatLinear (Glib::ustring name, FormatId format_id); + ExportFormatLinear (std::string name, FormatId format_id); ~ExportFormatLinear () {}; bool set_compatibility_state (ExportFormatCompatibility const & compatibility); diff --git a/libs/ardour/ardour/export_profile_manager.h b/libs/ardour/ardour/export_profile_manager.h index aff481eced..b8e86d11df 100644 --- a/libs/ardour/ardour/export_profile_manager.h +++ b/libs/ardour/ardour/export_profile_manager.h @@ -25,10 +25,10 @@ #include #include #include +#include #include #include -#include #include "pbd/uuid.h" #include "pbd/file_utils.h" @@ -137,7 +137,7 @@ class ExportProfileManager typedef std::list TimespanStateList; void set_selection_range (nframes_t start = 0, nframes_t end = 0); - std::string set_single_range (nframes_t start, nframes_t end, Glib::ustring name); + std::string set_single_range (nframes_t start, nframes_t end, std::string name); TimespanStateList const & get_timespans () { return check_list (timespans); } private: @@ -250,9 +250,9 @@ class ExportProfileManager /* Warnings */ public: struct Warnings { - std::list errors; - std::list warnings; - std::list conflicting_filenames; + std::list errors; + std::list warnings; + std::list conflicting_filenames; }; boost::shared_ptr get_warnings (); diff --git a/libs/ardour/ardour/export_timespan.h b/libs/ardour/ardour/export_timespan.h index 9053ace0f9..592f36b1a9 100644 --- a/libs/ardour/ardour/export_timespan.h +++ b/libs/ardour/ardour/export_timespan.h @@ -23,8 +23,7 @@ #include #include - -#include +#include #include "ardour/export_status.h" #include "ardour/export_channel.h" @@ -48,11 +47,11 @@ class ExportTimespan public: ~ExportTimespan (); - Glib::ustring name () const { return _name; } - void set_name (Glib::ustring name) { _name = name; } + std::string name () const { return _name; } + void set_name (std::string name) { _name = name; } - Glib::ustring range_id () const { return _range_id; } - void set_range_id (Glib::ustring range_id) { _range_id = range_id; } + std::string range_id () const { return _range_id; } + void set_range_id (std::string range_id) { _range_id = range_id; } void set_range (nframes_t start, nframes_t end); nframes_t get_length () const { return end_frame - start_frame; } @@ -68,8 +67,8 @@ class ExportTimespan nframes_t position; nframes_t frame_rate; - Glib::ustring _name; - Glib::ustring _range_id; + std::string _name; + std::string _range_id; }; diff --git a/libs/ardour/ardour/file_source.h b/libs/ardour/ardour/file_source.h index 379d391c73..aa4fe973b1 100644 --- a/libs/ardour/ardour/file_source.h +++ b/libs/ardour/ardour/file_source.h @@ -34,55 +34,55 @@ public: /** A source associated with a file on disk somewhere */ class FileSource : virtual public Source { public: - const Glib::ustring& path() const { return _path; } + const std::string& path() const { return _path; } int unstubify (); void stubify (); - virtual bool safe_file_extension (const Glib::ustring& path) const = 0; + virtual bool safe_file_extension (const std::string& path) const = 0; - int move_to_trash (const Glib::ustring& trash_dir_name); - void mark_take (const Glib::ustring& id); + int move_to_trash (const std::string& trash_dir_name); + void mark_take (const std::string& id); void mark_immutable (); void mark_nonremovable (); - const Glib::ustring& take_id () const { return _take_id; } + const std::string& take_id () const { return _take_id; } bool within_session () const { return _within_session; } uint16_t channel() const { return _channel; } int set_state (const XMLNode&, int version); - int set_source_name (const Glib::ustring& newname, bool destructive); + int set_source_name (const std::string& newname, bool destructive); - static void set_search_path (DataType type, const Glib::ustring& path); + static void set_search_path (DataType type, const std::string& path); - static bool find (DataType type, const Glib::ustring& path, + static bool find (DataType type, const std::string& path, bool must_exist, bool& is_new, uint16_t& chan, - Glib::ustring& found_path); + std::string& found_path); void inc_use_count (); bool removable () const; protected: FileSource (Session& session, DataType type, - const Glib::ustring& path, + const std::string& path, Source::Flag flags = Source::Flag(0)); FileSource (Session& session, const XMLNode& node, bool must_exist); - virtual int init (const Glib::ustring& idstr, bool must_exist); + virtual int init (const std::string& idstr, bool must_exist); virtual void set_path (const std::string&); virtual int move_dependents_to_trash() { return 0; } void set_within_session_from_path (const std::string&); - Glib::ustring _path; - Glib::ustring _take_id; + std::string _path; + std::string _take_id; bool _file_is_new; uint16_t _channel; bool _within_session; - static std::map search_paths; + static std::map search_paths; }; } // namespace ARDOUR diff --git a/libs/ardour/ardour/import_status.h b/libs/ardour/ardour/import_status.h index 90513e8639..d06a464716 100644 --- a/libs/ardour/ardour/import_status.h +++ b/libs/ardour/ardour/import_status.h @@ -37,7 +37,7 @@ struct ImportStatus : public InterThreadInfo { uint32_t total; SrcQuality quality; volatile bool freeze; - std::vector paths; + std::vector paths; bool replace_existing_source; /* result */ diff --git a/libs/ardour/ardour/plugin.h b/libs/ardour/ardour/plugin.h index 328f657b57..4f9ce3e7ea 100644 --- a/libs/ardour/ardour/plugin.h +++ b/libs/ardour/ardour/plugin.h @@ -21,7 +21,7 @@ #define __ardour_plugin_h__ #include -#include +#include #include "pbd/statefuldestructible.h" #include "pbd/controllable.h" @@ -55,8 +55,8 @@ class PluginInfo { std::string name; std::string category; - Glib::ustring creator; - Glib::ustring path; + std::string creator; + std::string path; ChanCount n_inputs; ChanCount n_outputs; ARDOUR::PluginType type; diff --git a/libs/ardour/ardour/session.h b/libs/ardour/ardour/session.h index 7834c644e6..db7a59b76d 100644 --- a/libs/ardour/ardour/session.h +++ b/libs/ardour/ardour/session.h @@ -177,7 +177,7 @@ class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionLi int ensure_subdirs (); - Glib::ustring peak_path (Glib::ustring) const; + std::string peak_path (std::string) const; std::string change_source_path_by_name (std::string oldpath, std::string oldname, std::string newname, bool destructive); @@ -540,7 +540,7 @@ class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionLi boost::shared_ptr create_midi_source_for_session (Track*, std::string const &, bool as_stub = false); boost::shared_ptr source_by_id (const PBD::ID&); - boost::shared_ptr source_by_path_and_channel (const Glib::ustring&, uint16_t); + boost::shared_ptr source_by_path_and_channel (const std::string&, uint16_t); void add_playlist (boost::shared_ptr, bool unused = false); diff --git a/libs/ardour/ardour/session_configuration_vars.h b/libs/ardour/ardour/session_configuration_vars.h index 0e676c7090..828b2cbfcf 100644 --- a/libs/ardour/ardour/session_configuration_vars.h +++ b/libs/ardour/ardour/session_configuration_vars.h @@ -34,7 +34,7 @@ CONFIG_VARIABLE (bool, punch_in, "punch-in", false) CONFIG_VARIABLE (bool, punch_out, "punch-out", false) CONFIG_VARIABLE (uint32_t, subframes_per_frame, "subframes-per-frame", 100) CONFIG_VARIABLE (TimecodeFormat, timecode_format, "timecode-format", timecode_30) -CONFIG_VARIABLE_SPECIAL(Glib::ustring, raid_path, "raid-path", "", path_expand) +CONFIG_VARIABLE_SPECIAL(std::string, raid_path, "raid-path", "", path_expand) CONFIG_VARIABLE (std::string, bwf_country_code, "bwf-country-code", "US") CONFIG_VARIABLE (std::string, bwf_organization_code, "bwf-organization-code", "US") CONFIG_VARIABLE (LayerModel, layer_model, "layer-model", MoveAddHigher) diff --git a/libs/ardour/ardour/session_metadata.h b/libs/ardour/ardour/session_metadata.h index 481e21c338..296bf6243f 100644 --- a/libs/ardour/ardour/session_metadata.h +++ b/libs/ardour/ardour/session_metadata.h @@ -21,7 +21,6 @@ #define __ardour_session_metadata_h__ #include -#include #include #include @@ -42,68 +41,68 @@ class SessionMetadata : public PBD::StatefulDestructible ~SessionMetadata (); /*** Accessing ***/ - Glib::ustring comment () const; - Glib::ustring copyright () const; - Glib::ustring isrc () const; + std::string comment () const; + std::string copyright () const; + std::string isrc () const; uint32_t year () const; - Glib::ustring grouping () const; - Glib::ustring title () const; - Glib::ustring subtitle () const; - - Glib::ustring artist () const; - Glib::ustring album_artist () const; - Glib::ustring lyricist () const; - Glib::ustring composer () const; - Glib::ustring conductor () const; - Glib::ustring remixer () const; - Glib::ustring arranger () const; - Glib::ustring engineer () const; - Glib::ustring producer () const; - Glib::ustring dj_mixer () const; - Glib::ustring mixer () const; - - Glib::ustring album () const; - Glib::ustring compilation () const; - Glib::ustring disc_subtitle () const; + std::string grouping () const; + std::string title () const; + std::string subtitle () const; + + std::string artist () const; + std::string album_artist () const; + std::string lyricist () const; + std::string composer () const; + std::string conductor () const; + std::string remixer () const; + std::string arranger () const; + std::string engineer () const; + std::string producer () const; + std::string dj_mixer () const; + std::string mixer () const; + + std::string album () const; + std::string compilation () const; + std::string disc_subtitle () const; uint32_t disc_number () const; uint32_t total_discs () const; uint32_t track_number () const; uint32_t total_tracks () const; - Glib::ustring genre () const; + std::string genre () const; /*** Editing ***/ - void set_comment (const Glib::ustring &); - void set_copyright (const Glib::ustring &); - void set_isrc (const Glib::ustring &); + void set_comment (const std::string &); + void set_copyright (const std::string &); + void set_isrc (const std::string &); void set_year (uint32_t); - void set_grouping (const Glib::ustring &); - void set_title (const Glib::ustring &); - void set_subtitle (const Glib::ustring &); - - void set_artist (const Glib::ustring &); - void set_album_artist (const Glib::ustring &); - void set_lyricist (const Glib::ustring &); - void set_composer (const Glib::ustring &); - void set_conductor (const Glib::ustring &); - void set_remixer (const Glib::ustring &); - void set_arranger (const Glib::ustring &); - void set_engineer (const Glib::ustring &); - void set_producer (const Glib::ustring &); - void set_dj_mixer (const Glib::ustring &); - void set_mixer (const Glib::ustring &); - - void set_album (const Glib::ustring &); - void set_compilation (const Glib::ustring &); - void set_disc_subtitle (const Glib::ustring &); + void set_grouping (const std::string &); + void set_title (const std::string &); + void set_subtitle (const std::string &); + + void set_artist (const std::string &); + void set_album_artist (const std::string &); + void set_lyricist (const std::string &); + void set_composer (const std::string &); + void set_conductor (const std::string &); + void set_remixer (const std::string &); + void set_arranger (const std::string &); + void set_engineer (const std::string &); + void set_producer (const std::string &); + void set_dj_mixer (const std::string &); + void set_mixer (const std::string &); + + void set_album (const std::string &); + void set_compilation (const std::string &); + void set_disc_subtitle (const std::string &); void set_disc_number (uint32_t); void set_total_discs (uint32_t); void set_track_number (uint32_t); void set_total_tracks (uint32_t); - void set_genre (const Glib::ustring &); + void set_genre (const std::string &); /*** Serialization ***/ XMLNode & get_state (); @@ -111,17 +110,17 @@ class SessionMetadata : public PBD::StatefulDestructible private: - typedef std::pair Property; - typedef std::map PropertyMap; + typedef std::pair Property; + typedef std::map PropertyMap; PropertyMap map; - XMLNode * get_xml (const Glib::ustring & name); + XMLNode * get_xml (const std::string & name); - Glib::ustring get_value (const Glib::ustring & name) const; - uint32_t get_uint_value (const Glib::ustring & name) const; + std::string get_value (const std::string & name) const; + uint32_t get_uint_value (const std::string & name) const; - void set_value (const Glib::ustring & name, const Glib::ustring & value); - void set_value (const Glib::ustring & name, uint32_t value); + void set_value (const std::string & name, const std::string & value); + void set_value (const std::string & name, uint32_t value); }; } // namespace ARDOUR diff --git a/libs/ardour/ardour/smf_source.h b/libs/ardour/ardour/smf_source.h index ab62a2d211..165e03e483 100644 --- a/libs/ardour/ardour/smf_source.h +++ b/libs/ardour/ardour/smf_source.h @@ -37,7 +37,7 @@ template class MidiRingBuffer; class SMFSource : public MidiSource, public FileSource, public Evoral::SMF { public: /** Constructor for existing external-to-session files */ - SMFSource (Session& session, const Glib::ustring& path, + SMFSource (Session& session, const std::string& path, Source::Flag flags = Source::Flag(0)); /** Constructor for existing in-session files */ @@ -45,7 +45,7 @@ public: virtual ~SMFSource (); - bool safe_file_extension (const Glib::ustring& path) const { + bool safe_file_extension (const std::string& path) const { return safe_midi_file_extension(path); } @@ -67,7 +67,7 @@ public: static void set_header_position_offset (nframes_t offset, bool negative); - static bool safe_midi_file_extension (const Glib::ustring& path); + static bool safe_midi_file_extension (const std::string& path); protected: void set_path (const std::string& newpath); diff --git a/libs/ardour/ardour/sndfilesource.h b/libs/ardour/ardour/sndfilesource.h index 151889dbb5..59dd603236 100644 --- a/libs/ardour/ardour/sndfilesource.h +++ b/libs/ardour/ardour/sndfilesource.h @@ -31,10 +31,10 @@ namespace ARDOUR { class SndFileSource : public AudioFileSource { public: /** Constructor to be called for existing external-to-session files */ - SndFileSource (Session&, const Glib::ustring& path, int chn, Flag flags); + SndFileSource (Session&, const std::string& path, int chn, Flag flags); /* Constructor to be called for new in-session files */ - SndFileSource (Session&, const Glib::ustring& path, + SndFileSource (Session&, const std::string& path, SampleFormat samp_format, HeaderFormat hdr_format, nframes_t rate, Flag flags = SndFileSource::default_writable_flags); @@ -63,7 +63,7 @@ class SndFileSource : public AudioFileSource { static void setup_standard_crossfades (Session const &, nframes_t sample_rate); static const Source::Flag default_writable_flags; - static int get_soundfile_info (const Glib::ustring& path, SoundFileInfo& _info, std::string& error_msg); + static int get_soundfile_info (const std::string& path, SoundFileInfo& _info, std::string& error_msg); protected: void set_path (const std::string& p); diff --git a/libs/ardour/ardour/source.h b/libs/ardour/ardour/source.h index cb46e90085..ebe8cdf0f5 100644 --- a/libs/ardour/ardour/source.h +++ b/libs/ardour/ardour/source.h @@ -64,7 +64,7 @@ class Source : public SessionObject virtual framecnt_t length (framepos_t pos) const = 0; virtual void update_length (framepos_t pos, framecnt_t cnt) = 0; - virtual const Glib::ustring& path() const = 0; + virtual const std::string& path() const = 0; virtual framepos_t natural_position() const { return 0; } diff --git a/libs/ardour/ardour/utils.h b/libs/ardour/ardour/utils.h index f3f9c4182c..1eab554178 100644 --- a/libs/ardour/ardour/utils.h +++ b/libs/ardour/ardour/utils.h @@ -39,7 +39,7 @@ bool string_is_affirmative (const std::string&); class XMLNode; -Glib::ustring legalize_for_path (Glib::ustring str); +std::string legalize_for_path (const std::string& str); XMLNode* find_named_node (const XMLNode& node, std::string name); std::string bool_as_string (bool); @@ -56,11 +56,11 @@ std::string bump_name_once(const std::string& s, char delimiter); int cmp_nocase (const std::string& s, const std::string& s2); -int touch_file(Glib::ustring path); +int touch_file(std::string path); -Glib::ustring path_expand (Glib::ustring); -Glib::ustring region_name_from_path (Glib::ustring path, bool strip_channels, bool add_channel_suffix = false, uint32_t total = 0, uint32_t this_one = 0); -bool path_is_paired (Glib::ustring path, Glib::ustring& pair_base); +std::string path_expand (std::string); +std::string region_name_from_path (std::string path, bool strip_channels, bool add_channel_suffix = false, uint32_t total = 0, uint32_t this_one = 0); +bool path_is_paired (std::string path, std::string& pair_base); void compute_equal_power_fades (ARDOUR::nframes_t nframes, float* in, float* out); diff --git a/libs/ardour/audio_region_importer.cc b/libs/ardour/audio_region_importer.cc index 7be155b5f5..2cade745f2 100644 --- a/libs/ardour/audio_region_importer.cc +++ b/libs/ardour/audio_region_importer.cc @@ -356,7 +356,7 @@ AudioRegionImporter::prepare_sources () session.import_audiofiles (status); // Add imported sources to handlers map - std::vector::iterator file_it = status.paths.begin(); + std::vector::iterator file_it = status.paths.begin(); for (SourceList::iterator source_it = status.sources.begin(); source_it != status.sources.end(); ++source_it) { if (*source_it) { handler.add_source(*file_it, *source_it); diff --git a/libs/ardour/audio_unit.cc b/libs/ardour/audio_unit.cc index 4a63f66cf5..3eb4672160 100644 --- a/libs/ardour/audio_unit.cc +++ b/libs/ardour/audio_unit.cc @@ -74,7 +74,7 @@ _render_callback(void *userData, } static int -save_property_list (CFPropertyListRef propertyList, Glib::ustring path) +save_property_list (CFPropertyListRef propertyList, string path) { CFDataRef xmlData; @@ -122,7 +122,7 @@ save_property_list (CFPropertyListRef propertyList, Glib::ustring path) static CFPropertyListRef -load_property_list (Glib::ustring path) +load_property_list (string path) { int fd; CFPropertyListRef propertyList; @@ -291,7 +291,7 @@ AUPlugin::AUPlugin (AudioEngine& engine, Session& session, boost::shared_ptr v; - Glib::ustring user_preset_path; + vector v; + string user_preset_path; bool ret = true; std::string m = maker(); @@ -1436,7 +1436,7 @@ AUPluginInfo::load (Session& session) } } -Glib::ustring +string AUPluginInfo::au_cache_path () { return Glib::build_filename (ARDOUR::get_user_ardour_path(), "au_cache"); @@ -1780,7 +1780,7 @@ AUPluginInfo::save_cached_info () } - Glib::ustring path = au_cache_path (); + string path = au_cache_path (); XMLTree tree; tree.set_root (node); @@ -1794,7 +1794,7 @@ AUPluginInfo::save_cached_info () int AUPluginInfo::load_cached_info () { - Glib::ustring path = au_cache_path (); + string path = au_cache_path (); XMLTree tree; if (!Glib::file_test (path, Glib::FILE_TEST_EXISTS)) { @@ -1858,7 +1858,7 @@ AUPluginInfo::load_cached_info () } void -AUPluginInfo::get_names (CAComponentDescription& comp_desc, std::string& name, Glib::ustring& maker) +AUPluginInfo::get_names (CAComponentDescription& comp_desc, std::string& name, string& maker) { CFStringRef itemName = NULL; diff --git a/libs/ardour/audiofile_tagger.cc b/libs/ardour/audiofile_tagger.cc index c06b712f4e..81ccf7a35e 100644 --- a/libs/ardour/audiofile_tagger.cc +++ b/libs/ardour/audiofile_tagger.cc @@ -31,8 +31,8 @@ #include "taglib/taglib.h" #include "taglib/xiphcomment.h" -/* Convert Glib::ustring to TagLib::String */ -#define TL_STR(ustring) TagLib::String ((ustring).c_str(), TagLib::String::UTF8) +/* Convert string to TagLib::String */ +#define TL_STR(string) TagLib::String ((string).c_str(), TagLib::String::UTF8) using namespace PBD; diff --git a/libs/ardour/audiofilesource.cc b/libs/ardour/audiofilesource.cc index 0ccbaf3154..d3e050e4ba 100644 --- a/libs/ardour/audiofilesource.cc +++ b/libs/ardour/audiofilesource.cc @@ -68,7 +68,7 @@ using namespace ARDOUR; using namespace PBD; using namespace Glib; -ustring AudioFileSource::peak_dir = ""; +string AudioFileSource::peak_dir = ""; PBD::Signal0 AudioFileSource::HeaderPositionOffsetChanged; uint64_t AudioFileSource::header_position_offset = 0; @@ -92,7 +92,7 @@ struct SizedSampleBuffer { Glib::StaticPrivate thread_interleave_buffer = GLIBMM_STATIC_PRIVATE_INIT; /** Constructor used for existing internal-to-session files. */ -AudioFileSource::AudioFileSource (Session& s, const ustring& path, Source::Flag flags) +AudioFileSource::AudioFileSource (Session& s, const string& path, Source::Flag flags) : Source (s, DataType::AUDIO, path, flags) , AudioSource (s, path) , FileSource (s, DataType::AUDIO, path, flags) @@ -104,7 +104,7 @@ AudioFileSource::AudioFileSource (Session& s, const ustring& path, Source::Flag } /** Constructor used for new internal-to-session files. */ -AudioFileSource::AudioFileSource (Session& s, const ustring& path, Source::Flag flags, +AudioFileSource::AudioFileSource (Session& s, const string& path, Source::Flag flags, SampleFormat /*samp_format*/, HeaderFormat /*hdr_format*/) : Source (s, DataType::AUDIO, path, flags) , AudioSource (s, path) @@ -140,16 +140,16 @@ AudioFileSource::~AudioFileSource () } int -AudioFileSource::init (const ustring& pathstr, bool must_exist) +AudioFileSource::init (const string& pathstr, bool must_exist) { _peaks_built = false; return FileSource::init (pathstr, must_exist); } -ustring -AudioFileSource::peak_path (ustring audio_path) +string +AudioFileSource::peak_path (string audio_path) { - ustring base; + string base; base = PBD::basename_nosuffix (audio_path); base += '%'; @@ -158,10 +158,10 @@ AudioFileSource::peak_path (ustring audio_path) return _session.peak_path (base); } -ustring -AudioFileSource::find_broken_peakfile (ustring peak_path, ustring audio_path) +string +AudioFileSource::find_broken_peakfile (string peak_path, string audio_path) { - ustring str; + string str; /* check for the broken location in use by 2.0 for several months */ @@ -199,21 +199,21 @@ AudioFileSource::find_broken_peakfile (ustring peak_path, ustring audio_path) return peak_path; } -ustring -AudioFileSource::broken_peak_path (ustring audio_path) +string +AudioFileSource::broken_peak_path (string audio_path) { return _session.peak_path (audio_path); } -ustring -AudioFileSource::old_peak_path (ustring audio_path) +string +AudioFileSource::old_peak_path (string audio_path) { /* XXX hardly bombproof! fix me */ struct stat stat_file; struct stat stat_mount; - ustring mp = mountpoint (audio_path); + string mp = mountpoint (audio_path); stat (audio_path.c_str(), &stat_file); stat (mp.c_str(), &stat_mount); @@ -225,7 +225,7 @@ AudioFileSource::old_peak_path (ustring audio_path) snprintf (buf, sizeof (buf), "%" PRId64 "-%" PRId64 "-%d.peak", (int64_t) stat_mount.st_ino, (int64_t) stat_file.st_ino, _channel); #endif - ustring res = peak_dir; + string res = peak_dir; res += buf; res += peakfile_suffix; @@ -233,7 +233,7 @@ AudioFileSource::old_peak_path (ustring audio_path) } bool -AudioFileSource::get_soundfile_info (ustring path, SoundFileInfo& _info, string& error_msg) +AudioFileSource::get_soundfile_info (string path, SoundFileInfo& _info, string& error_msg) { /* try sndfile first because it gets timecode info from .wav (BWF) if it exists, which at present, ExtAudioFile from Apple seems unable to do. @@ -312,7 +312,7 @@ AudioFileSource::set_header_position_offset (nframes_t offset) } bool -AudioFileSource::is_empty (Session& /*s*/, ustring path) +AudioFileSource::is_empty (Session& /*s*/, string path) { SoundFileInfo info; string err; @@ -336,7 +336,7 @@ AudioFileSource::setup_peakfile () } bool -AudioFileSource::safe_audio_file_extension(const ustring& file) +AudioFileSource::safe_audio_file_extension(const string& file) { const char* suffixes[] = { ".aif", ".AIF", diff --git a/libs/ardour/audiosource.cc b/libs/ardour/audiosource.cc index 083cf3bea9..9af388c1cd 100644 --- a/libs/ardour/audiosource.cc +++ b/libs/ardour/audiosource.cc @@ -48,7 +48,6 @@ using namespace std; using namespace ARDOUR; using namespace PBD; -using Glib::ustring; bool AudioSource::_build_missing_peakfiles = false; @@ -57,7 +56,7 @@ bool AudioSource::_build_peakfiles = false; #define _FPP 256 -AudioSource::AudioSource (Session& s, ustring name) +AudioSource::AudioSource (Session& s, string name) : Source (s, DataType::AUDIO, name) , _length (0) { @@ -196,11 +195,11 @@ AudioSource::touch_peakfile () } int -AudioSource::rename_peakfile (ustring newpath) +AudioSource::rename_peakfile (string newpath) { /* caller must hold _lock */ - ustring oldpath = peakpath; + string oldpath = peakpath; if (access (oldpath.c_str(), F_OK) == 0) { if (rename (oldpath.c_str(), newpath.c_str()) != 0) { @@ -215,7 +214,7 @@ AudioSource::rename_peakfile (ustring newpath) } int -AudioSource::initialize_peakfile (bool newfile, ustring audio_path) +AudioSource::initialize_peakfile (bool newfile, string audio_path) { struct stat statbuf; diff --git a/libs/ardour/export_filename.cc b/libs/ardour/export_filename.cc index 51e32a4ca9..7034600c8a 100644 --- a/libs/ardour/export_filename.cc +++ b/libs/ardour/export_filename.cc @@ -18,6 +18,7 @@ */ +#include #include "ardour/export_filename.h" #include "pbd/xml++.h" @@ -35,6 +36,7 @@ using namespace PBD; using namespace Glib; +using std::string; namespace ARDOUR { @@ -136,10 +138,10 @@ ExportFilename::set_state (const XMLNode & node) return 0; } -ustring +string ExportFilename::get_path (FormatPtr format) const { - ustring path = folder; + string path = folder; bool filename_empty = true; path += "/"; @@ -200,7 +202,7 @@ ExportFilename::get_path (FormatPtr format) const return path; } -ustring +string ExportFilename::get_time_format_str (TimeFormat format) const { switch ( format ) { @@ -218,7 +220,7 @@ ExportFilename::get_time_format_str (TimeFormat format) const } } -ustring +string ExportFilename::get_date_format_str (DateFormat format) const { switch (format) { @@ -267,32 +269,32 @@ ExportFilename::set_date_format (DateFormat format) } void -ExportFilename::set_label (ustring value) +ExportFilename::set_label (string value) { label = value; include_label = !value.compare (""); } bool -ExportFilename::set_folder (ustring path) +ExportFilename::set_folder (string path) { // TODO check folder existence folder = path; return true; } -ustring -ExportFilename::get_formatted_time (ustring const & format) const +string +ExportFilename::get_formatted_time (string const & format) const { char buffer [80]; strftime (buffer, 80, format.c_str(), time_struct); - ustring return_value (buffer); + string return_value (buffer); return return_value; } void -ExportFilename::add_field (XMLNode * node, ustring const & name, bool enabled, ustring const & value) +ExportFilename::add_field (XMLNode * node, string const & name, bool enabled, string const & value) { XMLNode * child = node->add_child ("Field"); @@ -309,7 +311,7 @@ ExportFilename::add_field (XMLNode * node, ustring const & name, bool enabled, u } ExportFilename::FieldPair -ExportFilename::get_field (XMLNode const & node, ustring const & name) +ExportFilename::get_field (XMLNode const & node, string const & name) { FieldPair pair; pair.first = false; @@ -344,10 +346,10 @@ ExportFilename::analyse_folder () { FieldPair pair; - ustring session_dir = session.session_directory().root_path().to_string(); - ustring::size_type session_dir_len = session_dir.length(); + string session_dir = session.session_directory().root_path().to_string(); + string::size_type session_dir_len = session_dir.length(); - ustring folder_beginning = folder.substr (0, session_dir_len); + string folder_beginning = folder.substr (0, session_dir_len); if (!folder_beginning.compare (session_dir)) { pair.first = true; diff --git a/libs/ardour/export_format_manager.cc b/libs/ardour/export_format_manager.cc index 5cb87ee75b..7971622c4a 100644 --- a/libs/ardour/export_format_manager.cc +++ b/libs/ardour/export_format_manager.cc @@ -26,6 +26,8 @@ #include "i18n.h" +using std::string; + namespace ARDOUR { @@ -248,7 +250,7 @@ ExportFormatManager::add_sample_rate (SampleRatePtr ptr) } void -ExportFormatManager::set_name (Glib::ustring name) +ExportFormatManager::set_name (string name) { current_selection->set_name (name); } diff --git a/libs/ardour/export_format_specification.cc b/libs/ardour/export_format_specification.cc index e1e6776a1b..1658e8cffc 100644 --- a/libs/ardour/export_format_specification.cc +++ b/libs/ardour/export_format_specification.cc @@ -512,10 +512,10 @@ ExportFormatSpecification::set_format (boost::shared_ptr format) } } -Glib::ustring +string ExportFormatSpecification::description () { - Glib::ustring desc; + string desc; desc = _name + ": "; diff --git a/libs/ardour/export_formats.cc b/libs/ardour/export_formats.cc index ef6bbe35bc..c78f9332c0 100644 --- a/libs/ardour/export_formats.cc +++ b/libs/ardour/export_formats.cc @@ -68,7 +68,7 @@ HasSampleFormat::add_sample_format (ExportFormatBase::SampleFormat format) } void -HasSampleFormat::add_dither_type (ExportFormatBase::DitherType type, Glib::ustring name) +HasSampleFormat::add_dither_type (ExportFormatBase::DitherType type, string name) { DitherTypePtr ptr (new DitherTypeState (type, name)); dither_type_states.push_back (ptr); @@ -179,7 +179,7 @@ HasSampleFormat::get_sample_format_name (ExportFormatBase::SampleFormat format) /*** Linear ***/ -ExportFormatLinear::ExportFormatLinear (Glib::ustring name, FormatId format_id) : +ExportFormatLinear::ExportFormatLinear (string name, FormatId format_id) : HasSampleFormat (sample_formats), _default_sample_format (SF_None) { diff --git a/libs/ardour/export_graph_builder.cc b/libs/ardour/export_graph_builder.cc index 002bc62932..e7507b7449 100644 --- a/libs/ardour/export_graph_builder.cc +++ b/libs/ardour/export_graph_builder.cc @@ -20,6 +20,7 @@ #include "pbd/filesystem.h" using namespace AudioGrapher; +using std::string; namespace ARDOUR { @@ -166,7 +167,7 @@ ExportGraphBuilder::Encoder::init_writer (boost::shared_ptrget_n_chans(); int format = get_real_format (config); - Glib::ustring filename = config.filename->get_path (config.format); + string filename = config.filename->get_path (config.format); writer.reset (new AudioGrapher::SndfileWriter (filename, format, channels, config.format->sample_rate(), config.broadcast_info)); writer->FileWritten.connect_same_thread (copy_files_connection, boost::bind (&ExportGraphBuilder::Encoder::copy_files, this, _1)); diff --git a/libs/ardour/export_handler.cc b/libs/ardour/export_handler.cc index b4131a5cf8..05fa1d881d 100644 --- a/libs/ardour/export_handler.cc +++ b/libs/ardour/export_handler.cc @@ -364,7 +364,7 @@ ExportHandler::export_cd_marker_file (TimespanPtr timespan, FormatPtr file_forma void ExportHandler::write_cue_header (CDMarkerStatus & status) { - Glib::ustring title = status.timespan->name().compare ("Session") ? status.timespan->name() : (Glib::ustring) session.name(); + string title = status.timespan->name().compare ("Session") ? status.timespan->name() : (string) session.name(); status.out << "REM Cue file generated by Ardour" << endl; status.out << "TITLE \"" << title << "\"" << endl; @@ -388,7 +388,7 @@ ExportHandler::write_cue_header (CDMarkerStatus & status) status.out << "FILE \"" << Glib::path_get_basename(status.filename) << "\" "; if (!status.format->format_name().compare ("WAV")) { status.out << "WAVE"; - } else if (status.format->format_name() == ExportFormatBase::F_RAW && + } else if (status.format->format_id() == ExportFormatBase::F_RAW && status.format->sample_format() == ExportFormatBase::SF_16 && status.format->sample_rate() == ExportFormatBase::SR_44_1) { // Format is RAW 16bit 44.1kHz @@ -407,7 +407,7 @@ ExportHandler::write_cue_header (CDMarkerStatus & status) void ExportHandler::write_toc_header (CDMarkerStatus & status) { - Glib::ustring title = status.timespan->name().compare ("Session") ? status.timespan->name() : (Glib::ustring) session.name(); + string title = status.timespan->name().compare ("Session") ? status.timespan->name() : (string) session.name(); status.out << "CD_DA" << endl; status.out << "CD_TEXT {" << endl << " LANGUAGE_MAP {" << endl << " 0 : EN" << endl << " }" << endl; diff --git a/libs/ardour/export_profile_manager.cc b/libs/ardour/export_profile_manager.cc index 40160d1ada..d745b1f94c 100644 --- a/libs/ardour/export_profile_manager.cc +++ b/libs/ardour/export_profile_manager.cc @@ -307,7 +307,7 @@ ExportProfileManager::set_selection_range (nframes_t start, nframes_t end) } std::string -ExportProfileManager::set_single_range (nframes_t start, nframes_t end, Glib::ustring name) +ExportProfileManager::set_single_range (nframes_t start, nframes_t end, string name) { single_range_mode = true; @@ -361,7 +361,7 @@ ExportProfileManager::deserialize_timespan (XMLNode & root) prop = (*node_it)->property ("id"); if (!prop) { continue; } - ustring id = prop->value(); + string id = prop->value(); for (LocationList::iterator it = ranges->begin(); it != ranges->end(); ++it) { if ((!id.compare ("session") && *it == session_range.get()) || @@ -494,7 +494,7 @@ ExportProfileManager::save_format_to_disk (FormatPtr format) /* Get filename for file */ - Glib::ustring new_name = format->name(); + string new_name = format->name(); new_name += export_format_suffix; sys::path new_path (export_config_dir); @@ -777,7 +777,7 @@ ExportProfileManager::check_config (boost::shared_ptr warnings, for (uint32_t chan = 1; chan <= channel_config->get_n_chans(); ++chan) { filename->set_channel (chan); - Glib::ustring path = filename->get_path (format); + string path = filename->get_path (format); if (sys::exists (sys::path (path))) { warnings->conflicting_filenames.push_back (path); @@ -785,7 +785,7 @@ ExportProfileManager::check_config (boost::shared_ptr warnings, } } else { - Glib::ustring path = filename->get_path (format); + string path = filename->get_path (format); if (sys::exists (sys::path (path))) { warnings->conflicting_filenames.push_back (path); diff --git a/libs/ardour/file_source.cc b/libs/ardour/file_source.cc index 6a72359a96..5e52d7739a 100644 --- a/libs/ardour/file_source.cc +++ b/libs/ardour/file_source.cc @@ -52,9 +52,9 @@ using namespace ARDOUR; using namespace PBD; using namespace Glib; -map FileSource::search_paths; +map FileSource::search_paths; -FileSource::FileSource (Session& session, DataType type, const ustring& path, Source::Flag flag) +FileSource::FileSource (Session& session, DataType type, const string& path, Source::Flag flag) : Source(session, type, path, flag) , _path(path) , _file_is_new(true) @@ -90,7 +90,7 @@ FileSource::removable () const } int -FileSource::init (const ustring& pathstr, bool must_exist) +FileSource::init (const string& pathstr, bool must_exist) { _timeline_position = 0; @@ -126,7 +126,7 @@ FileSource::set_state (const XMLNode& node, int /*version*/) } void -FileSource::mark_take (const ustring& id) +FileSource::mark_take (const string& id) { if (writable ()) { _take_id = id; @@ -134,7 +134,7 @@ FileSource::mark_take (const ustring& id) } int -FileSource::move_to_trash (const ustring& trash_dir_name) +FileSource::move_to_trash (const string& trash_dir_name) { if (!within_session() || !writable()) { return -1; @@ -156,7 +156,7 @@ FileSource::move_to_trash (const ustring& trash_dir_name) if (Glib::file_test (newpath.c_str(), Glib::FILE_TEST_EXISTS)) { char buf[PATH_MAX+1]; int version = 1; - ustring newpath_v; + string newpath_v; snprintf (buf, sizeof (buf), "%s.%d", newpath.c_str(), version); newpath_v = buf; @@ -204,13 +204,13 @@ FileSource::move_to_trash (const ustring& trash_dir_name) * \return true iff the file was found. */ bool -FileSource::find (DataType type, const ustring& path, bool must_exist, - bool& isnew, uint16_t& chan, ustring& found_path) +FileSource::find (DataType type, const string& path, bool must_exist, + bool& isnew, uint16_t& chan, string& found_path) { - Glib::ustring search_path = search_paths[type]; + string search_path = search_paths[type]; - ustring pathstr = path; - ustring::size_type pos; + string pathstr = path; + string::size_type pos; bool ret = false; isnew = false; @@ -219,10 +219,10 @@ FileSource::find (DataType type, const ustring& path, bool must_exist, /* non-absolute pathname: find pathstr in search path */ - vector dirs; + vector dirs; int cnt; - ustring fullpath; - ustring keeppath; + string fullpath; + string keeppath; if (search_path.length() == 0) { error << _("FileSource: search path not set") << endmsg; @@ -233,7 +233,7 @@ FileSource::find (DataType type, const ustring& path, bool must_exist, cnt = 0; - for (vector::iterator i = dirs.begin(); i != dirs.end(); ++i) { + for (vector::iterator i = dirs.begin(); i != dirs.end(); ++i) { fullpath = Glib::build_filename (*i, pathstr); @@ -241,7 +241,7 @@ FileSource::find (DataType type, const ustring& path, bool must_exist, Ardour 0.99 .. this hack tries to make things sort of work. */ - if ((pos = pathstr.find_last_of (':')) != ustring::npos) { + if ((pos = pathstr.find_last_of (':')) != string::npos) { if (Glib::file_test (fullpath, Glib::FILE_TEST_EXISTS|Glib::FILE_TEST_IS_REGULAR)) { @@ -258,7 +258,7 @@ FileSource::find (DataType type, const ustring& path, bool must_exist, without the :suffix exists */ - ustring shorter = pathstr.substr (0, pos); + string shorter = pathstr.substr (0, pos); fullpath = Glib::build_filename (*i, shorter); if (Glib::file_test (pathstr, Glib::FILE_TEST_EXISTS|Glib::FILE_TEST_IS_REGULAR)) { @@ -323,9 +323,9 @@ FileSource::find (DataType type, const ustring& path, bool must_exist, /* ugh, handle ':' situation */ - if ((pos = pathstr.find_last_of (':')) != ustring::npos) { + if ((pos = pathstr.find_last_of (':')) != string::npos) { - ustring shorter = pathstr.substr (0, pos); + string shorter = pathstr.substr (0, pos); if (Glib::file_test (shorter, Glib::FILE_TEST_EXISTS|Glib::FILE_TEST_IS_REGULAR)) { chan = atoi (pathstr.substr (pos+1)); @@ -369,11 +369,11 @@ out: } int -FileSource::set_source_name (const ustring& newname, bool destructive) +FileSource::set_source_name (const string& newname, bool destructive) { Glib::Mutex::Lock lm (_lock); - ustring oldpath = _path; - ustring newpath = _session.change_source_path_by_name (oldpath, _name, newname, destructive); + string oldpath = _path; + string newpath = _session.change_source_path_by_name (oldpath, _name, newname, destructive); if (newpath.empty()) { error << string_compose (_("programming error: %1"), "cannot generate a changed file path") << endmsg; @@ -398,7 +398,7 @@ FileSource::set_source_name (const ustring& newname, bool destructive) } void -FileSource::set_search_path (DataType type, const ustring& p) +FileSource::set_search_path (DataType type, const string& p) { search_paths[type] = p; } diff --git a/libs/ardour/import.cc b/libs/ardour/import.cc index d1a4a5cad4..784fedefdb 100644 --- a/libs/ardour/import.cc +++ b/libs/ardour/import.cc @@ -240,7 +240,7 @@ create_mono_sources_for_writing (const vector& new_paths, Session& sess, return true; } -static Glib::ustring +static string compose_status_message (const string& path, uint file_samplerate, uint session_samplerate, @@ -448,7 +448,7 @@ Session::import_audiofiles (ImportStatus& status) status.sources.clear (); - for (vector::iterator p = status.paths.begin(); + for (vector::iterator p = status.paths.begin(); p != status.paths.end() && !status.cancel; ++p) { diff --git a/libs/ardour/midi_patch_manager.cc b/libs/ardour/midi_patch_manager.cc index a2522fe997..2c2f36daa6 100644 --- a/libs/ardour/midi_patch_manager.cc +++ b/libs/ardour/midi_patch_manager.cc @@ -65,7 +65,7 @@ MidiPatchManager::refresh() assert(is_directory(path_to_patches)); - Glib::PatternSpec pattern(Glib::ustring("*.midnam")); + Glib::PatternSpec pattern(string("*.midnam")); vector result; find_matching_files_in_directory(path_to_patches, pattern, result); diff --git a/libs/ardour/port_set.cc b/libs/ardour/port_set.cc index a5fbc9eee6..35c8d9f410 100644 --- a/libs/ardour/port_set.cc +++ b/libs/ardour/port_set.cc @@ -16,12 +16,14 @@ 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include +#include #include "ardour/port_set.h" #include "ardour/midi_port.h" #include "ardour/audio_port.h" +using std::string; + namespace ARDOUR { PortSet::PortSet() @@ -32,18 +34,18 @@ PortSet::PortSet() static bool sort_ports_by_name (Port* a, Port* b) { - Glib::ustring aname (a->name()); - Glib::ustring bname (b->name()); + string aname (a->name()); + string bname (b->name()); - Glib::ustring::size_type last_digit_position_a = aname.size(); - Glib::ustring::reverse_iterator r_iterator = aname.rbegin(); + string::size_type last_digit_position_a = aname.size(); + string::reverse_iterator r_iterator = aname.rbegin(); while (r_iterator!= aname.rend() && Glib::Unicode::isdigit(*r_iterator)) { r_iterator++; last_digit_position_a--; } - Glib::ustring::size_type last_digit_position_b = bname.size(); + string::size_type last_digit_position_b = bname.size(); r_iterator = bname.rbegin(); while (r_iterator != bname.rend() && Glib::Unicode::isdigit(*r_iterator)) { diff --git a/libs/ardour/session.cc b/libs/ardour/session.cc index 6e4f6295a1..f68da4adb2 100644 --- a/libs/ardour/session.cc +++ b/libs/ardour/session.cc @@ -2719,7 +2719,7 @@ Session::source_by_id (const PBD::ID& id) } boost::shared_ptr -Session::source_by_path_and_channel (const Glib::ustring& path, uint16_t chn) +Session::source_by_path_and_channel (const string& path, uint16_t chn) { Glib::Mutex::Lock lm (source_lock); @@ -2865,8 +2865,8 @@ Session::new_source_path_from_name (DataType type, const string& name, bool as_s return p.to_string(); } -Glib::ustring -Session::peak_path (Glib::ustring base) const +string +Session::peak_path (string base) const { sys::path peakfile_path(_session_dir->peak_path()); peakfile_path /= basename_nosuffix (base) + peakfile_suffix; diff --git a/libs/ardour/session_metadata.cc b/libs/ardour/session_metadata.cc index 10c39983df..51dba7ceff 100644 --- a/libs/ardour/session_metadata.cc +++ b/libs/ardour/session_metadata.cc @@ -88,9 +88,9 @@ SessionMetadata::~SessionMetadata () } XMLNode * -SessionMetadata::get_xml (const ustring & name) +SessionMetadata::get_xml (const string & name) { - ustring value = get_value (name); + string value = get_value (name); if (value.empty()) { return 0; } @@ -102,8 +102,8 @@ SessionMetadata::get_xml (const ustring & name) return node; } -ustring -SessionMetadata::get_value (const ustring & name) const +string +SessionMetadata::get_value (const string & name) const { PropertyMap::const_iterator it = map.find (name); if (it == map.end()) { @@ -116,13 +116,13 @@ SessionMetadata::get_value (const ustring & name) const } uint32_t -SessionMetadata::get_uint_value (const ustring & name) const +SessionMetadata::get_uint_value (const string & name) const { return atoi (get_value (name).c_str()); } void -SessionMetadata::set_value (const ustring & name, const ustring & value) +SessionMetadata::set_value (const string & name, const string & value) { PropertyMap::iterator it = map.find (name); if (it == map.end()) { @@ -135,7 +135,7 @@ SessionMetadata::set_value (const ustring & name, const ustring & value) } void -SessionMetadata::set_value (const ustring & name, uint32_t value) +SessionMetadata::set_value (const string & name, uint32_t value) { std::ostringstream oss; oss << value; @@ -166,8 +166,8 @@ int SessionMetadata::set_state (const XMLNode & state, int /*version*/) { const XMLNodeList & children = state.children(); - ustring name; - ustring value; + string name; + string value; XMLNode * node; for (XMLNodeConstIterator it = children.begin(); it != children.end(); it++) { @@ -187,19 +187,19 @@ SessionMetadata::set_state (const XMLNode & state, int /*version*/) } /*** Accessing ***/ -ustring +string SessionMetadata::comment () const { return get_value("comment"); } -ustring +string SessionMetadata::copyright () const { return get_value("copyright"); } -ustring +string SessionMetadata::isrc () const { return get_value("isrc"); @@ -211,103 +211,103 @@ SessionMetadata::year () const return get_uint_value("year"); } -ustring +string SessionMetadata::grouping () const { return get_value("grouping"); } -ustring +string SessionMetadata::title () const { return get_value("title"); } -ustring +string SessionMetadata::subtitle () const { return get_value("subtitle"); } -ustring +string SessionMetadata::artist () const { return get_value("artist"); } -ustring +string SessionMetadata::album_artist () const { return get_value("album_artist"); } -ustring +string SessionMetadata::lyricist () const { return get_value("lyricist"); } -ustring +string SessionMetadata::composer () const { return get_value("composer"); } -ustring +string SessionMetadata::conductor () const { return get_value("conductor"); } -ustring +string SessionMetadata::remixer () const { return get_value("remixer"); } -ustring +string SessionMetadata::arranger () const { return get_value("arranger"); } -ustring +string SessionMetadata::engineer () const { return get_value("engineer"); } -ustring +string SessionMetadata::producer () const { return get_value("producer"); } -ustring +string SessionMetadata::dj_mixer () const { return get_value("dj_mixer"); } -ustring +string SessionMetadata::mixer () const { return get_value("mixer"); } -ustring +string SessionMetadata::album () const { return get_value("album"); } -ustring +string SessionMetadata::compilation () const { return get_value("compilation"); } -ustring +string SessionMetadata::disc_subtitle () const { return get_value("disc_subtitle"); @@ -337,7 +337,7 @@ SessionMetadata::total_tracks () const return get_uint_value("total_tracks"); } -ustring +string SessionMetadata::genre () const { return get_value("genre"); @@ -345,19 +345,19 @@ SessionMetadata::genre () const /*** Editing ***/ void -SessionMetadata::set_comment (const ustring & v) +SessionMetadata::set_comment (const string & v) { set_value ("comment", v); } void -SessionMetadata::set_copyright (const ustring & v) +SessionMetadata::set_copyright (const string & v) { set_value ("copyright", v); } void -SessionMetadata::set_isrc (const ustring & v) +SessionMetadata::set_isrc (const string & v) { set_value ("isrc", v); } @@ -369,103 +369,103 @@ SessionMetadata::set_year (uint32_t v) } void -SessionMetadata::set_grouping (const ustring & v) +SessionMetadata::set_grouping (const string & v) { set_value ("grouping", v); } void -SessionMetadata::set_title (const ustring & v) +SessionMetadata::set_title (const string & v) { set_value ("title", v); } void -SessionMetadata::set_subtitle (const ustring & v) +SessionMetadata::set_subtitle (const string & v) { set_value ("subtitle", v); } void -SessionMetadata::set_artist (const ustring & v) +SessionMetadata::set_artist (const string & v) { set_value ("artist", v); } void -SessionMetadata::set_album_artist (const ustring & v) +SessionMetadata::set_album_artist (const string & v) { set_value ("album_artist", v); } void -SessionMetadata::set_lyricist (const ustring & v) +SessionMetadata::set_lyricist (const string & v) { set_value ("lyricist", v); } void -SessionMetadata::set_composer (const ustring & v) +SessionMetadata::set_composer (const string & v) { set_value ("composer", v); } void -SessionMetadata::set_conductor (const ustring & v) +SessionMetadata::set_conductor (const string & v) { set_value ("conductor", v); } void -SessionMetadata::set_remixer (const ustring & v) +SessionMetadata::set_remixer (const string & v) { set_value ("remixer", v); } void -SessionMetadata::set_arranger (const ustring & v) +SessionMetadata::set_arranger (const string & v) { set_value ("arranger", v); } void -SessionMetadata::set_engineer (const ustring & v) +SessionMetadata::set_engineer (const string & v) { set_value ("engineer", v); } void -SessionMetadata::set_producer (const ustring & v) +SessionMetadata::set_producer (const string & v) { set_value ("producer", v); } void -SessionMetadata::set_dj_mixer (const ustring & v) +SessionMetadata::set_dj_mixer (const string & v) { set_value ("dj_mixer", v); } void -SessionMetadata::set_mixer (const ustring & v) +SessionMetadata::set_mixer (const string & v) { set_value ("mixer", v); } void -SessionMetadata::set_album (const ustring & v) +SessionMetadata::set_album (const string & v) { set_value ("album", v); } void -SessionMetadata::set_compilation (const ustring & v) +SessionMetadata::set_compilation (const string & v) { set_value ("compilation", v); } void -SessionMetadata::set_disc_subtitle (const ustring & v) +SessionMetadata::set_disc_subtitle (const string & v) { set_value ("disc_subtitle", v); } @@ -495,7 +495,7 @@ SessionMetadata::set_total_tracks (uint32_t v) } void -SessionMetadata::set_genre (const ustring & v) +SessionMetadata::set_genre (const string & v) { set_value ("genre", v); } diff --git a/libs/ardour/session_state.cc b/libs/ardour/session_state.cc index 6d319d23b8..9290f673cf 100644 --- a/libs/ardour/session_state.cc +++ b/libs/ardour/session_state.cc @@ -2417,7 +2417,7 @@ Session::find_all_sources (string path, set& result) continue; } - Glib::ustring found_path; + string found_path; bool is_new; uint16_t chan; diff --git a/libs/ardour/smf_source.cc b/libs/ardour/smf_source.cc index d03489e6e8..11100b9f52 100644 --- a/libs/ardour/smf_source.cc +++ b/libs/ardour/smf_source.cc @@ -50,7 +50,7 @@ using namespace Glib; using namespace PBD; /** Constructor used for new internal-to-session files. File cannot exist. */ -SMFSource::SMFSource (Session& s, const ustring& path, Source::Flag flags) +SMFSource::SMFSource (Session& s, const string& path, Source::Flag flags) : Source(s, DataType::MIDI, path, flags) , MidiSource(s, path) , FileSource(s, DataType::MIDI, path, flags) @@ -416,9 +416,9 @@ SMFSource::mark_streaming_write_completed () } bool -SMFSource::safe_midi_file_extension (const Glib::ustring& file) +SMFSource::safe_midi_file_extension (const string& file) { - return (file.rfind(".mid") != Glib::ustring::npos); + return (file.rfind(".mid") != string::npos); } void diff --git a/libs/ardour/sndfilesource.cc b/libs/ardour/sndfilesource.cc index 9ab647e98e..1cc8edd708 100644 --- a/libs/ardour/sndfilesource.cc +++ b/libs/ardour/sndfilesource.cc @@ -44,7 +44,7 @@ using namespace std; using namespace ARDOUR; using namespace PBD; -using Glib::ustring; +using std::string; gain_t* SndFileSource::out_coefficient = 0; gain_t* SndFileSource::in_coefficient = 0; @@ -67,7 +67,7 @@ SndFileSource::SndFileSource (Session& s, const XMLNode& node) } /** Files created this way are never writable or removable */ -SndFileSource::SndFileSource (Session& s, const ustring& path, int chn, Flag flags) +SndFileSource::SndFileSource (Session& s, const string& path, int chn, Flag flags) : Source(s, DataType::AUDIO, path, flags) , AudioFileSource (s, path, Flag (flags & ~(Writable|Removable|RemovableIfEmpty|RemoveAtDestroy))) { @@ -81,7 +81,7 @@ SndFileSource::SndFileSource (Session& s, const ustring& path, int chn, Flag fla } /** This constructor is used to construct new files, not open existing ones. */ -SndFileSource::SndFileSource (Session& s, const ustring& path, +SndFileSource::SndFileSource (Session& s, const string& path, SampleFormat sfmt, HeaderFormat hf, nframes_t rate, Flag flags) : Source(s, DataType::AUDIO, path, flags) , AudioFileSource (s, path, flags, sfmt, hf) @@ -178,7 +178,7 @@ SndFileSource::SndFileSource (Session& s, const ustring& path, void SndFileSource::init_sndfile () { - ustring file; + string file; // lets try to keep the object initalizations here at the top xfade_buf = 0; @@ -830,7 +830,7 @@ SndFileSource::set_timeline_position (int64_t pos) } int -SndFileSource::get_soundfile_info (const ustring& path, SoundFileInfo& info, string& error_msg) +SndFileSource::get_soundfile_info (const string& path, SoundFileInfo& info, string& error_msg) { SNDFILE *sf; SF_INFO sf_info; diff --git a/libs/ardour/utils.cc b/libs/ardour/utils.cc index a7d5b960f8..71dbc42694 100644 --- a/libs/ardour/utils.cc +++ b/libs/ardour/utils.cc @@ -39,6 +39,7 @@ #include #include +#include #ifdef HAVE_WORDEXP #include @@ -48,6 +49,7 @@ #include "pbd/stacktrace.h" #include "pbd/xml++.h" #include "pbd/basename.h" +#include "pbd/strsplit.h" #include "ardour/utils.h" #include "i18n.h" @@ -55,14 +57,14 @@ using namespace ARDOUR; using namespace std; using namespace PBD; -using Glib::ustring; -ustring -legalize_for_path (ustring str) +string +legalize_for_path (const string& str) { - ustring::size_type pos; - ustring legal_chars = "abcdefghijklmnopqrtsuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_+=: "; - ustring legal; +#if OLD_SCHOOL_PROHIBITIVE + string::size_type pos; + string legal_chars = "abcdefghijklmnopqrtsuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_+=: "; + string legal; legal = str; pos = 0; @@ -73,6 +75,21 @@ legalize_for_path (ustring str) } return legal; +#else + string::size_type pos; + string illegal_chars = "/\\"; /* DOS, POSIX. Yes, we're going to ignore HFS */ + string legal; + + legal = str; + pos = 0; + + while ((pos = legal.find_first_of (illegal_chars, pos)) != string::npos) { + legal.replace (pos, 1, "_"); + pos += 1; + } + + return legal; +#endif } string @@ -117,6 +134,46 @@ bump_name_once (const std::string& name, char delimiter) } +bool +could_be_a_valid_path (const string& path) +{ + vector posix_dirs; + vector dos_dirs; + string testpath; + + split (path, posix_dirs, '/'); + split (path, dos_dirs, '\\'); + + /* remove the last component of each */ + + posix_dirs.erase (--posix_dirs.end()); + dos_dirs.erase (--dos_dirs.end()); + + if (G_DIR_SEPARATOR == '/') { + for (vector::iterator x = posix_dirs.begin(); x != posix_dirs.end(); ++x) { + testpath = Glib::build_filename (testpath, *x); + cerr << "Testing " << testpath << endl; + if (!Glib::file_test (testpath, Glib::FILE_TEST_IS_DIR|Glib::FILE_TEST_EXISTS)) { + return false; + } + } + } + + if (G_DIR_SEPARATOR == '\\') { + testpath = ""; + for (vector::iterator x = dos_dirs.begin(); x != dos_dirs.end(); ++x) { + testpath = Glib::build_filename (testpath, *x); + cerr << "Testing " << testpath << endl; + if (!Glib::file_test (testpath, Glib::FILE_TEST_IS_DIR|Glib::FILE_TEST_EXISTS)) { + return false; + } + } + } + + return true; +} + + XMLNode * find_named_node (const XMLNode& node, string name) { @@ -156,7 +213,7 @@ cmp_nocase (const string& s, const string& s2) } int -touch_file (ustring path) +touch_file (string path) { int fd = open (path.c_str(), O_RDWR|O_CREAT, 0660); if (fd >= 0) { @@ -166,8 +223,8 @@ touch_file (ustring path) return 1; } -ustring -region_name_from_path (ustring path, bool strip_channels, bool add_channel_suffix, uint32_t total, uint32_t this_one) +string +region_name_from_path (string path, bool strip_channels, bool add_channel_suffix, uint32_t total, uint32_t this_one) { path = PBD::basename_nosuffix (path); @@ -175,7 +232,7 @@ region_name_from_path (ustring path, bool strip_channels, bool add_channel_suffi /* remove any "?R", "?L" or "?[a-z]" channel identifier */ - ustring::size_type len = path.length(); + string::size_type len = path.length(); if (len > 3 && (path[len-2] == '%' || path[len-2] == '?' || path[len-2] == '.') && (path[len-1] == 'R' || path[len-1] == 'L' || (islower (path[len-1])))) { @@ -199,9 +256,9 @@ region_name_from_path (ustring path, bool strip_channels, bool add_channel_suffi } bool -path_is_paired (ustring path, ustring& pair_base) +path_is_paired (string path, string& pair_base) { - ustring::size_type pos; + string::size_type pos; /* remove any leading path */ @@ -215,7 +272,7 @@ path_is_paired (ustring path, ustring& pair_base) path = path.substr (0, pos); } - ustring::size_type len = path.length(); + string::size_type len = path.length(); /* look for possible channel identifier: "?R", "%R", ".L" etc. */ @@ -230,8 +287,8 @@ path_is_paired (ustring path, ustring& pair_base) return false; } -ustring -path_expand (ustring path) +string +path_expand (string path) { #ifdef HAVE_WORDEXP /* Handle tilde and environment variable expansion in session path */ diff --git a/libs/ardour/vst_plugin.cc b/libs/ardour/vst_plugin.cc index b978c7993a..3ea8c6d6ea 100644 --- a/libs/ardour/vst_plugin.cc +++ b/libs/ardour/vst_plugin.cc @@ -30,7 +30,7 @@ #include #include -#include +#include #include #include -- cgit v1.2.3