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
This commit is contained in:
Paul Davis 2010-09-14 15:45:21 +00:00
parent 875f0befd5
commit 4d112a8e6b
57 changed files with 563 additions and 474 deletions

View file

@ -118,6 +118,8 @@ sigc::signal<void> ARDOUR_UI::RapidScreenUpdate;
sigc::signal<void> ARDOUR_UI::SuperRapidScreenUpdate;
sigc::signal<void,nframes_t, bool, nframes_t> ARDOUR_UI::Clock;
bool could_be_a_valid_path (const string& path);
ARDOUR_UI::ARDOUR_UI (int *argcp, char **argvp[])
: Gtkmm2ext::UI (PROGRAM_NAME, argcp, argvp),
@ -2465,9 +2467,9 @@ ARDOUR_UI::loading_message (const std::string& /*msg*/)
int
ARDOUR_UI::get_session_parameters (bool quit_on_cancel, bool should_be_new, string load_template)
{
Glib::ustring session_name;
Glib::ustring session_path;
Glib::ustring template_name;
string session_name;
string session_path;
string template_name;
int ret = -1;
bool likely_new = false;
@ -2496,6 +2498,7 @@ ARDOUR_UI::get_session_parameters (bool quit_on_cancel, bool should_be_new, stri
} else {
bool const apply = run_startup (should_be_new, load_template);
if (!apply) {
if (quit_on_cancel) {
exit (1);
@ -2513,16 +2516,17 @@ ARDOUR_UI::get_session_parameters (bool quit_on_cancel, bool should_be_new, stri
/* this shouldn't happen, but we catch it just in case it does */
if (session_name.empty()) {
break;
continue;
}
if (_startup->use_session_template()) {
template_name = _startup->session_template_name();
_session_is_new = true;
}
if (session_name[0] == '/' ||
(session_name.length() > 2 && session_name[0] == '.' && session_name[1] == '/') ||
(session_name.length() > 3 && session_name[0] == '.' && session_name[1] == '.' && session_name[2] == '/')) {
if (session_name[0] == G_DIR_SEPARATOR ||
(session_name.length() > 2 && session_name[0] == '.' && session_name[1] == G_DIR_SEPARATOR) ||
(session_name.length() > 3 && session_name[0] == '.' && session_name[1] == '.' && session_name[2] == G_DIR_SEPARATOR)) {
/* absolute path or cwd-relative path specified for session name: infer session folder
from what was given.
@ -2534,6 +2538,22 @@ ARDOUR_UI::get_session_parameters (bool quit_on_cancel, bool should_be_new, stri
} else {
session_path = _startup->session_folder();
if (session_name.find ('/') != string::npos) {
MessageDialog msg (*_startup, _("To ensure compatibility with various systems\n"
"session names may not contain a '/' character"));
msg.run ();
ARDOUR_COMMAND_LINE::session_name = ""; // cancel that
continue;
}
if (session_name.find ('\\') != string::npos) {
MessageDialog msg (*_startup, _("To ensure compatibility with various systems\n"
"session names may not contain a '\\' character"));
msg.run ();
ARDOUR_COMMAND_LINE::session_name = ""; // cancel that
continue;
}
}
}

View file

@ -3223,7 +3223,7 @@ Editor::setup_midi_toolbar ()
int
Editor::convert_drop_to_paths (
vector<ustring>& paths,
vector<string>& paths,
const RefPtr<Gdk::DragContext>& /*context*/,
gint /*x*/,
gint /*y*/,
@ -3234,7 +3234,7 @@ Editor::convert_drop_to_paths (
if (_session == 0) {
return -1;
}
vector<ustring> uris = data.get_uris();
if (uris.empty()) {

View file

@ -27,8 +27,6 @@
#include <sys/time.h>
#include <bitset>
#include <glibmm/ustring.h>
#include <boost/optional.hpp>
#include <libgnomecanvasmm/canvas.h>
@ -424,8 +422,8 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
int get_regionview_count_from_region_list (boost::shared_ptr<ARDOUR::Region>);
void do_import (std::vector<Glib::ustring> paths, Editing::ImportDisposition, Editing::ImportMode mode, ARDOUR::SrcQuality, nframes64_t&);
void do_embed (std::vector<Glib::ustring> paths, Editing::ImportDisposition, Editing::ImportMode mode, nframes64_t&);
void do_import (std::vector<std::string> paths, Editing::ImportDisposition, Editing::ImportMode mode, ARDOUR::SrcQuality, nframes64_t&);
void do_embed (std::vector<std::string> paths, Editing::ImportDisposition, Editing::ImportMode mode, nframes64_t&);
void get_regions_corresponding_to (boost::shared_ptr<ARDOUR::Region> region, std::vector<RegionView*>& regions);
@ -1172,21 +1170,21 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
void session_import_dialog ();
int check_whether_and_how_to_import(std::string, bool all_or_nothing = true);
bool check_multichannel_status (const std::vector<Glib::ustring>& paths);
bool check_multichannel_status (const std::vector<std::string>& paths);
SoundFileOmega* sfbrowser;
void bring_in_external_audio (Editing::ImportMode mode, nframes64_t& pos);
bool idle_drop_paths (std::vector<Glib::ustring> paths, nframes64_t frame, double ypos);
void drop_paths_part_two (const std::vector<Glib::ustring>& paths, nframes64_t frame, double ypos);
bool idle_drop_paths (std::vector<std::string> paths, nframes64_t frame, double ypos);
void drop_paths_part_two (const std::vector<std::string>& paths, nframes64_t frame, double ypos);
int import_sndfiles (std::vector<Glib::ustring> paths, Editing::ImportMode mode, ARDOUR::SrcQuality, nframes64_t& pos,
int import_sndfiles (std::vector<std::string> paths, Editing::ImportMode mode, ARDOUR::SrcQuality, nframes64_t& pos,
int target_regions, int target_tracks, boost::shared_ptr<ARDOUR::Track>&, bool);
int embed_sndfiles (std::vector<Glib::ustring> paths, bool multiple_files, bool& check_sample_rate, Editing::ImportMode mode,
int embed_sndfiles (std::vector<std::string> paths, bool multiple_files, bool& check_sample_rate, Editing::ImportMode mode,
nframes64_t& pos, int target_regions, int target_tracks, boost::shared_ptr<ARDOUR::Track>&);
int add_sources (std::vector<Glib::ustring> paths, ARDOUR::SourceList& sources, nframes64_t& pos, Editing::ImportMode,
int add_sources (std::vector<std::string> paths, ARDOUR::SourceList& sources, nframes64_t& pos, Editing::ImportMode,
int target_regions, int target_tracks, boost::shared_ptr<ARDOUR::Track>&, bool add_channel_suffix);
int finish_bringing_in_material (boost::shared_ptr<ARDOUR::Region> region, uint32_t, uint32_t, nframes64_t& pos, Editing::ImportMode mode,
boost::shared_ptr<ARDOUR::Track>& existing_track);
@ -1217,7 +1215,7 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
/* to support this ... */
void import_audio (bool as_tracks);
void do_import (std::vector<Glib::ustring> paths, bool split, bool as_tracks);
void do_import (std::vector<std::string> paths, bool split, bool as_tracks);
void move_to_start ();
void move_to_end ();
@ -1722,46 +1720,46 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
/* Drag-n-Drop */
int convert_drop_to_paths (
std::vector<Glib::ustring>& paths,
const Glib::RefPtr<Gdk::DragContext>& context,
gint x,
gint y,
const Gtk::SelectionData& data,
guint info,
guint time);
std::vector<std::string>& paths,
const Glib::RefPtr<Gdk::DragContext>& context,
gint x,
gint y,
const Gtk::SelectionData& data,
guint info,
guint time);
void track_canvas_drag_data_received (
const Glib::RefPtr<Gdk::DragContext>& context,
gint x,
gint y,
const Gtk::SelectionData& data,
guint info,
guint time);
const Glib::RefPtr<Gdk::DragContext>& context,
gint x,
gint y,
const Gtk::SelectionData& data,
guint info,
guint time);
void drop_paths (
const Glib::RefPtr<Gdk::DragContext>& context,
gint x,
gint y,
const Gtk::SelectionData& data,
guint info,
guint time);
const Glib::RefPtr<Gdk::DragContext>& context,
gint x,
gint y,
const Gtk::SelectionData& data,
guint info,
guint time);
void drop_regions (
const Glib::RefPtr<Gdk::DragContext>& context,
gint x,
gint y,
const Gtk::SelectionData& data,
guint info,
guint time);
const Glib::RefPtr<Gdk::DragContext>& context,
gint x,
gint y,
const Gtk::SelectionData& data,
guint info,
guint time);
void drop_routes (
const Glib::RefPtr<Gdk::DragContext>& context,
gint x,
gint y,
const Gtk::SelectionData& data,
guint info,
guint time);
const Glib::RefPtr<Gdk::DragContext>& context,
gint x,
gint y,
const Gtk::SelectionData& data,
guint info,
guint time);
/* audio export */
int write_region_selection(RegionSelection&);

View file

@ -24,6 +24,8 @@
#include <unistd.h>
#include <algorithm>
#include <glibmm/ustring.h>
#include <sndfile.h>
#include "pbd/pthread_utils.h"
@ -94,7 +96,7 @@ Editor::add_external_audio_action (ImportMode mode_hint)
void
Editor::external_audio_dialog ()
{
vector<Glib::ustring> paths;
vector<string> paths;
uint32_t track_cnt;
if (_session == 0) {
@ -148,8 +150,11 @@ Editor::external_audio_dialog ()
/* lets do it */
paths = sfbrowser->get_paths ();
vector<ustring> upaths = sfbrowser->get_paths ();
for (vector<ustring>::iterator x = upaths.begin(); x != upaths.end(); ++x) {
paths.push_back (*x);
}
ImportPosition pos = sfbrowser->get_position ();
ImportMode mode = sfbrowser->get_mode ();
ImportDisposition chns = sfbrowser->get_channel_disposition ();
@ -322,10 +327,10 @@ Editor::get_nth_selected_midi_track (int nth) const
}
void
Editor::do_import (vector<ustring> paths, ImportDisposition chns, ImportMode mode, SrcQuality quality, nframes64_t& pos)
Editor::do_import (vector<string> paths, ImportDisposition chns, ImportMode mode, SrcQuality quality, nframes64_t& pos)
{
boost::shared_ptr<Track> track;
vector<ustring> to_import;
vector<string> to_import;
int nth = 0;
bool use_timestamp = (pos == -1);
@ -342,7 +347,7 @@ Editor::do_import (vector<ustring> paths, ImportDisposition chns, ImportMode mod
*/
bool cancel = false;
for (vector<ustring>::iterator a = paths.begin(); a != paths.end(); ++a) {
for (vector<string>::iterator a = paths.begin(); a != paths.end(); ++a) {
int check = check_whether_and_how_to_import(*a, false);
if (check == 2) {
cancel = true;
@ -359,7 +364,7 @@ Editor::do_import (vector<ustring> paths, ImportDisposition chns, ImportMode mod
bool replace = false;
bool ok = true;
for (vector<ustring>::iterator a = paths.begin(); a != paths.end(); ++a) {
for (vector<string>::iterator a = paths.begin(); a != paths.end(); ++a) {
const int check = check_whether_and_how_to_import (*a, true);
@ -423,18 +428,18 @@ Editor::do_import (vector<ustring> paths, ImportDisposition chns, ImportMode mod
}
void
Editor::do_embed (vector<ustring> paths, ImportDisposition chns, ImportMode mode, nframes64_t& pos)
Editor::do_embed (vector<string> paths, ImportDisposition chns, ImportMode mode, nframes64_t& pos)
{
boost::shared_ptr<Track> track;
bool check_sample_rate = true;
bool ok = false;
vector<ustring> to_embed;
vector<string> to_embed;
bool multi = paths.size() > 1;
int nth = 0;
switch (chns) {
case Editing::ImportDistinctFiles:
for (vector<ustring>::iterator a = paths.begin(); a != paths.end(); ++a) {
for (vector<string>::iterator a = paths.begin(); a != paths.end(); ++a) {
to_embed.clear ();
to_embed.push_back (*a);
@ -450,7 +455,7 @@ Editor::do_embed (vector<ustring> paths, ImportDisposition chns, ImportMode mode
break;
case Editing::ImportDistinctChannels:
for (vector<ustring>::iterator a = paths.begin(); a != paths.end(); ++a) {
for (vector<string>::iterator a = paths.begin(); a != paths.end(); ++a) {
to_embed.clear ();
to_embed.push_back (*a);
@ -468,7 +473,7 @@ Editor::do_embed (vector<ustring> paths, ImportDisposition chns, ImportMode mode
break;
case Editing::ImportSerializeFiles:
for (vector<ustring>::iterator a = paths.begin(); a != paths.end(); ++a) {
for (vector<string>::iterator a = paths.begin(); a != paths.end(); ++a) {
to_embed.clear ();
to_embed.push_back (*a);
@ -489,7 +494,7 @@ Editor::do_embed (vector<ustring> paths, ImportDisposition chns, ImportMode mode
}
int
Editor::import_sndfiles (vector<ustring> paths, ImportMode mode, SrcQuality quality, nframes64_t& pos,
Editor::import_sndfiles (vector<string> paths, ImportMode mode, SrcQuality quality, nframes64_t& pos,
int target_regions, int target_tracks, boost::shared_ptr<Track>& track, bool replace)
{
import_status.paths = paths;
@ -546,7 +551,7 @@ Editor::import_sndfiles (vector<ustring> paths, ImportMode mode, SrcQuality qual
}
int
Editor::embed_sndfiles (vector<Glib::ustring> paths, bool multifile,
Editor::embed_sndfiles (vector<string> paths, bool multifile,
bool& check_sample_rate, ImportMode mode, nframes64_t& pos, int target_regions, int target_tracks,
boost::shared_ptr<Track>& track)
{
@ -555,14 +560,14 @@ Editor::embed_sndfiles (vector<Glib::ustring> paths, bool multifile,
string linked_path;
SoundFileInfo finfo;
int ret = 0;
Glib::ustring path_to_use;
string path_to_use;
track_canvas->get_window()->set_cursor (Gdk::Cursor (Gdk::WATCH));
gdk_flush ();
for (vector<Glib::ustring>::iterator p = paths.begin(); p != paths.end(); ++p) {
for (vector<string>::iterator p = paths.begin(); p != paths.end(); ++p) {
ustring path = *p;
string path = *p;
if (Config->get_try_link_for_embed()) {
@ -714,11 +719,11 @@ Editor::embed_sndfiles (vector<Glib::ustring> paths, bool multifile,
}
int
Editor::add_sources (vector<Glib::ustring> paths, SourceList& sources, nframes64_t& pos, ImportMode mode,
Editor::add_sources (vector<string> paths, SourceList& sources, nframes64_t& pos, ImportMode mode,
int target_regions, int target_tracks, boost::shared_ptr<Track>& track, bool /*add_channel_suffix*/)
{
vector<boost::shared_ptr<Region> > regions;
ustring region_name;
string region_name;
uint32_t input_chan = 0;
uint32_t output_chan = 0;
bool use_timestamp;

View file

@ -443,14 +443,14 @@ Editor::track_canvas_drag_data_received (const RefPtr<Gdk::DragContext>& context
}
bool
Editor::idle_drop_paths (vector<ustring> paths, nframes64_t frame, double ypos)
Editor::idle_drop_paths (vector<string> paths, nframes64_t frame, double ypos)
{
drop_paths_part_two (paths, frame, ypos);
return false;
}
void
Editor::drop_paths_part_two (const vector<ustring>& paths, nframes64_t frame, double ypos)
Editor::drop_paths_part_two (const vector<string>& paths, nframes64_t frame, double ypos)
{
RouteTimeAxisView* tv;
@ -490,7 +490,7 @@ Editor::drop_paths (const RefPtr<Gdk::DragContext>& context,
const SelectionData& data,
guint info, guint time)
{
vector<ustring> paths;
vector<string> paths;
GdkEvent ev;
nframes64_t frame;
double wx;

View file

@ -1119,7 +1119,7 @@ EditorRegions::drag_data_received (const RefPtr<Gdk::DragContext>& context,
const SelectionData& data,
guint info, guint time)
{
vector<ustring> paths;
vector<string> paths;
if (data.get_target() == "GTK_TREE_MODEL_ROW") {
/* something is being dragged over the region list */

View file

@ -33,6 +33,7 @@
using namespace ARDOUR;
using namespace PBD;
using std::string;
ExportDialog::ExportDialog (PublicEditor & editor, Glib::ustring title) :
ArdourDialog (title),
@ -243,18 +244,18 @@ ExportDialog::update_warnings ()
boost::shared_ptr<ExportProfileManager::Warnings> warnings = profile_manager->get_warnings();
for (std::list<Glib::ustring>::iterator it = warnings->errors.begin(); it != warnings->errors.end(); ++it) {
for (std::list<string>::iterator it = warnings->errors.begin(); it != warnings->errors.end(); ++it) {
add_error (*it);
}
for (std::list<Glib::ustring>::iterator it = warnings->warnings.begin(); it != warnings->warnings.end(); ++it) {
for (std::list<string>::iterator it = warnings->warnings.begin(); it != warnings->warnings.end(); ++it) {
add_warning (*it);
}
if (!warnings->conflicting_filenames.empty()) {
list_files_hbox.show ();
for (std::list<Glib::ustring>::iterator it = warnings->conflicting_filenames.begin(); it != warnings->conflicting_filenames.end(); ++it) {
Glib::ustring::size_type pos = it->find_last_of ("/");
for (std::list<string>::iterator it = warnings->conflicting_filenames.begin(); it != warnings->conflicting_filenames.end(); ++it) {
string::size_type pos = it->find_last_of ("/");
list_files_string += "\n" + it->substr (0, pos + 1) + "<b>" + it->substr (pos + 1) + "</b>";
}
}
@ -350,7 +351,7 @@ ExportDialog::progress_timeout ()
}
void
ExportDialog::add_error (Glib::ustring const & text)
ExportDialog::add_error (string const & text)
{
fast_export_button->set_sensitive (false);
//rt_export_button->set_sensitive (false);
@ -365,7 +366,7 @@ ExportDialog::add_error (Glib::ustring const & text)
}
void
ExportDialog::add_warning (Glib::ustring const & text)
ExportDialog::add_warning (string const & text)
{
if (warn_string.empty()) {
warn_string = _("<span color=\"#ffa755\">Warning: ") + text + "</span>";
@ -378,7 +379,7 @@ ExportDialog::add_warning (Glib::ustring const & text)
/*** Dialog specializations ***/
ExportRangeDialog::ExportRangeDialog (PublicEditor & editor, Glib::ustring range_id) :
ExportRangeDialog::ExportRangeDialog (PublicEditor & editor, string range_id) :
ExportDialog (editor, _("Export Range")),
range_id (range_id)
{}
@ -422,7 +423,7 @@ ExportRegionDialog::init_gui ()
void
ExportRegionDialog::init_components ()
{
Glib::ustring loc_id = profile_manager->set_single_range (region.position(), region.position() + region.length(), region.name());
string loc_id = profile_manager->set_single_range (region.position(), region.position() + region.length(), region.name());
preset_selector.reset (new ExportPresetSelector ());
timespan_selector.reset (new ExportTimespanSelectorSingle (_session, profile_manager, loc_id));

View file

@ -22,6 +22,7 @@
#define __export_dialog_h__
#include <boost/scoped_ptr.hpp>
#include <string>
#include "ardour/export_profile_manager.h"
@ -120,8 +121,8 @@ class ExportDialog : public ArdourDialog {
Gtk::Button list_files_button;
Glib::ustring list_files_string;
void add_error (Glib::ustring const & text);
void add_warning (Glib::ustring const & text);
void add_error (std::string const & text);
void add_warning (std::string const & text);
/* Progress bar */
@ -140,12 +141,12 @@ class ExportDialog : public ArdourDialog {
class ExportRangeDialog : public ExportDialog
{
public:
ExportRangeDialog (PublicEditor & editor, Glib::ustring range_id);
ExportRangeDialog (PublicEditor & editor, std::string range_id);
private:
void init_components ();
Glib::ustring range_id;
std::string range_id;
};
class ExportSelectionDialog : public ExportDialog

View file

@ -21,12 +21,12 @@
#ifndef __export_format_selector_h__
#define __export_format_selector_h__
#include "ardour/export_profile_manager.h"
#include <string>
#include <gtkmm.h>
#include <sigc++/signal.h>
#include <boost/shared_ptr.hpp>
#include "ardour/export_profile_manager.h"
#include "ardour/session_handle.h"
namespace ARDOUR {
@ -76,7 +76,7 @@ class ExportFormatSelector : public Gtk::HBox, public ARDOUR::SessionHandlePtr
{
public:
Gtk::TreeModelColumn<FormatPtr> format;
Gtk::TreeModelColumn<Glib::ustring> label;
Gtk::TreeModelColumn<std::string> label;
FormatCols () { add (format); add (label); }
};

View file

@ -37,7 +37,7 @@ using namespace Glib;
/*** MetadataField ***/
MetadataField::MetadataField (ustring const & field_name) :
MetadataField::MetadataField (string const & field_name) :
_name (field_name)
{
}
@ -46,7 +46,7 @@ MetadataField::~MetadataField() { }
/* TextMetadataField */
TextMetadataField::TextMetadataField (Getter getter, Setter setter, ustring const & field_name, guint width ) :
TextMetadataField::TextMetadataField (Getter getter, Setter setter, string const & field_name, guint width ) :
MetadataField (field_name),
getter (getter),
setter (setter),
@ -112,7 +112,7 @@ TextMetadataField::update_value ()
/* NumberMetadataField */
NumberMetadataField::NumberMetadataField (Getter getter, Setter setter, ustring const & field_name, guint numbers, guint width) :
NumberMetadataField::NumberMetadataField (Getter getter, Setter setter, string const & field_name, guint numbers, guint width) :
MetadataField (field_name),
getter (getter),
setter (setter),
@ -183,7 +183,7 @@ NumberMetadataField::edit_widget ()
return *entry;
}
ustring
string
NumberMetadataField::uint_to_str (uint32_t i) const
{
std::ostringstream oss ("");
@ -196,11 +196,11 @@ NumberMetadataField::uint_to_str (uint32_t i) const
}
uint32_t
NumberMetadataField::str_to_uint (ustring const & str) const
NumberMetadataField::str_to_uint (string const & str) const
{
ustring tmp (str);
ustring::size_type i;
while ((i = tmp.find_first_not_of("1234567890")) != ustring::npos) {
string tmp (str);
string::size_type i;
while ((i = tmp.find_first_not_of("1234567890")) != string::npos) {
tmp.erase (i, 1);
}
@ -213,8 +213,8 @@ NumberMetadataField::str_to_uint (ustring const & str) const
/* SessionMetadataSet */
SessionMetadataSet::SessionMetadataSet (ustring const & name) :
name (name)
SessionMetadataSet::SessionMetadataSet (string const & name)
: name (name)
{
}
@ -226,8 +226,8 @@ SessionMetadataSet::add_data_field (MetadataPtr field)
/* SessionMetadataSetEditable */
SessionMetadataSetEditable::SessionMetadataSetEditable (ustring const & name) :
SessionMetadataSet (name)
SessionMetadataSetEditable::SessionMetadataSetEditable (string const & name)
: SessionMetadataSet (name)
{
table.set_row_spacings (6);
table.set_col_spacings (12);
@ -277,9 +277,9 @@ SessionMetadataSetEditable::save_data ()
/* SessionMetadataSetImportable */
SessionMetadataSetImportable::SessionMetadataSetImportable (ustring const & name) :
SessionMetadataSet (name),
session_list (list)
SessionMetadataSetImportable::SessionMetadataSetImportable (string const & name)
: SessionMetadataSet (name)
, session_list (list)
{
tree = Gtk::ListStore::create (tree_cols);
tree_view.set_model (tree);
@ -351,8 +351,8 @@ SessionMetadataSetImportable::load_extra_data (ARDOUR::SessionMetadata const & d
import_field->load_data(data); // hasn't been done yet
// Make string for values TODO get color from somewhere?
ustring values = "<span weight=\"ultralight\" color=\"#777\">" + session_field->value() + "</span>\n"
+ "<span weight=\"bold\">" + import_field->value() + "</span>";
string values = "<span weight=\"ultralight\" color=\"#777\">" + session_field->value() + "</span>\n"
+ "<span weight=\"bold\">" + import_field->value() + "</span>";
Gtk::TreeModel::iterator row_iter = tree->append();
Gtk::TreeModel::Row row = *row_iter;
@ -401,7 +401,7 @@ SessionMetadataSetImportable::select_all ()
}
void
SessionMetadataSetImportable::selection_changed (ustring const & path)
SessionMetadataSetImportable::selection_changed (string const & path)
{
select_all_check.set_inconsistent (true);
@ -413,7 +413,7 @@ SessionMetadataSetImportable::selection_changed (ustring const & path)
/* SessionMetadataDialog */
template <typename DataSet>
SessionMetadataDialog<DataSet>::SessionMetadataDialog (ustring const & name) :
SessionMetadataDialog<DataSet>::SessionMetadataDialog (string const & name) :
ArdourDialog (name, true)
{
cancel_button = add_button (Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
@ -477,7 +477,7 @@ SessionMetadataDialog<DataSet>::end_dialog ()
template <typename DataSet>
void
SessionMetadataDialog<DataSet>::warn_user (ustring const & string)
SessionMetadataDialog<DataSet>::warn_user (string const & string)
{
Gtk::MessageDialog msg (string, false, Gtk::MESSAGE_WARNING, Gtk::BUTTONS_OK, true);
msg.run();

View file

@ -36,15 +36,15 @@ typedef boost::shared_ptr<MetadataField> MetadataPtr;
/// Wraps a metadata field to be used in a GUI
class MetadataField {
public:
MetadataField (Glib::ustring const & field_name);
MetadataField (std::string const & field_name);
virtual ~MetadataField();
virtual MetadataPtr copy () = 0;
virtual void save_data (ARDOUR::SessionMetadata & data) const = 0;
virtual void load_data (ARDOUR::SessionMetadata const & data) = 0;
virtual Glib::ustring name() { return _name; }
virtual Glib::ustring value() { return _value; }
virtual std::string name() { return _name; }
virtual std::string value() { return _value; }
/// Get widget containing name of field
virtual Gtk::Widget & name_widget () = 0;
@ -53,17 +53,17 @@ class MetadataField {
/// Get widget for editing value
virtual Gtk::Widget & edit_widget () = 0;
protected:
Glib::ustring _name;
Glib::ustring _value;
std::string _name;
std::string _value;
};
/// MetadataField that contains text
class TextMetadataField : public MetadataField {
private:
typedef Glib::ustring (ARDOUR::SessionMetadata::*Getter) () const;
typedef void (ARDOUR::SessionMetadata::*Setter) (Glib::ustring const &);
typedef std::string (ARDOUR::SessionMetadata::*Getter) () const;
typedef void (ARDOUR::SessionMetadata::*Setter) (std::string const &);
public:
TextMetadataField (Getter getter, Setter setter, Glib::ustring const & field_name, guint width = 50);
TextMetadataField (Getter getter, Setter setter, std::string const & field_name, guint width = 50);
MetadataPtr copy ();
void save_data (ARDOUR::SessionMetadata & data) const;
@ -91,7 +91,7 @@ class NumberMetadataField : public MetadataField {
typedef uint32_t (ARDOUR::SessionMetadata::*Getter) () const;
typedef void (ARDOUR::SessionMetadata::*Setter) (uint32_t);
public:
NumberMetadataField (Getter getter, Setter setter, Glib::ustring const & field_name, guint numbers, guint width = 50);
NumberMetadataField (Getter getter, Setter setter, std::string const & field_name, guint numbers, guint width = 50);
MetadataPtr copy ();
void save_data (ARDOUR::SessionMetadata & data) const;
@ -102,8 +102,8 @@ class NumberMetadataField : public MetadataField {
Gtk::Widget & edit_widget ();
private:
void update_value ();
Glib::ustring uint_to_str (uint32_t i) const;
uint32_t str_to_uint (Glib::ustring const & str) const;
std::string uint_to_str (uint32_t i) const;
uint32_t str_to_uint (std::string const & str) const;
Getter getter;
Setter setter;
@ -119,7 +119,7 @@ class NumberMetadataField : public MetadataField {
/// Interface for MetadataFields
class SessionMetadataSet : public ARDOUR::SessionHandlePtr {
public:
SessionMetadataSet (Glib::ustring const & name);
SessionMetadataSet (std::string const & name);
virtual ~SessionMetadataSet () {};
void add_data_field (MetadataPtr field);
@ -135,13 +135,13 @@ class SessionMetadataSet : public ARDOUR::SessionHandlePtr {
protected:
typedef std::list<MetadataPtr> DataList;
DataList list;
Glib::ustring name;
std::string name;
};
/// Contains MetadataFields for editing
class SessionMetadataSetEditable : public SessionMetadataSet {
public:
SessionMetadataSetEditable (Glib::ustring const & name);
SessionMetadataSetEditable (std::string const & name);
Gtk::Widget & get_widget () { return vbox; }
Gtk::Widget & get_tab_widget ();
@ -160,7 +160,7 @@ class SessionMetadataSetEditable : public SessionMetadataSet {
/// Contains MetadataFields for importing
class SessionMetadataSetImportable : public SessionMetadataSet {
public:
SessionMetadataSetImportable (Glib::ustring const & name);
SessionMetadataSetImportable (std::string const & name);
Gtk::Widget & get_widget () { return tree_view; }
Gtk::Widget & get_tab_widget ();
@ -178,8 +178,8 @@ class SessionMetadataSetImportable : public SessionMetadataSet {
struct Columns : public Gtk::TreeModel::ColumnRecord
{
public:
Gtk::TreeModelColumn<Glib::ustring> field;
Gtk::TreeModelColumn<Glib::ustring> values;
Gtk::TreeModelColumn<std::string> field;
Gtk::TreeModelColumn<std::string> values;
Gtk::TreeModelColumn<bool> import;
Gtk::TreeModelColumn<MetadataPtr> data;
@ -194,7 +194,7 @@ class SessionMetadataSetImportable : public SessionMetadataSet {
Gtk::CheckButton select_all_check;
void select_all ();
void selection_changed (Glib::ustring const & path);
void selection_changed (std::string const & path);
};
/// Metadata dialog interface
@ -206,7 +206,7 @@ template <typename DataSet>
class SessionMetadataDialog : public ArdourDialog
{
public:
SessionMetadataDialog (Glib::ustring const & name);
SessionMetadataDialog (std::string const & name);
protected:
void init_data ();
@ -217,7 +217,7 @@ class SessionMetadataDialog : public ArdourDialog
virtual void save_and_close ();
virtual void end_dialog ();
void warn_user (Glib::ustring const & string);
void warn_user (std::string const & string);
typedef std::list<Gtk::Widget *> WidgetList;
typedef boost::shared_ptr<WidgetList> WidgetListPtr;

View file

@ -27,6 +27,7 @@
#include "pbd/file_utils.h"
#include "pbd/filesystem.h"
#include "pbd/replace_all.h"
#include "pbd/whitespace.h"
#include "ardour/filesystem_paths.h"
#include "ardour/recent_sessions.h"
@ -207,7 +208,9 @@ ArdourStartup::session_name (bool& should_be_new)
{
if (ic_new_session_button.get_active()) {
should_be_new = true;
return new_name_entry.get_text ();
string val = new_name_entry.get_text ();
strip_whitespace_edges (val);
return val;
} else if (_existing_session_chooser_used) {
/* existing session chosen from file chooser */
should_be_new = false;

View file

@ -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<std::string,AUPluginCachedInfo> CachedInfoMap;
static CachedInfoMap cached_info;

View file

@ -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

View file

@ -26,7 +26,6 @@
#include <time.h>
#include <glibmm/thread.h>
#include <glibmm/ustring.h>
#include <boost/function.hpp>
#include "ardour/source.h"
@ -43,7 +42,7 @@ class AudioSource : virtual public Source,
public boost::enable_shared_from_this<ARDOUR::AudioSource>
{
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,

View file

@ -22,7 +22,7 @@
#define __ardour_export_channel_configuration_h__
#include <list>
#include <glibmm/ustring.h>
#include <string>
#include <boost/enable_shared_from_this.hpp>
#include "ardour/export_channel.h"
@ -62,8 +62,8 @@ class ExportChannelConfiguration : public boost::enable_shared_from_this<ExportC
ChannelList const & get_channels () const { return channels; }
bool all_channels_have_ports () const;
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; }
void set_split (bool value) { split = value; }
bool get_split () const { return split; }
@ -82,7 +82,7 @@ class ExportChannelConfiguration : public boost::enable_shared_from_this<ExportC
ChannelList channels;
bool split; // Split to mono files
Glib::ustring _name;
std::string _name;
};
} // namespace ARDOUR

View file

@ -22,7 +22,7 @@
#define __ardour_export_filename_h__
#include <boost/shared_ptr.hpp>
#include <glibmm/ustring.h>
#include <string>
#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<bool, Glib::ustring> FieldPair;
typedef std::pair<bool, std::string> 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 ();
};

View file

@ -24,7 +24,7 @@
#include <set>
#include <algorithm>
#include <boost/shared_ptr.hpp>
#include <glibmm/ustring.h>
#include <string>
#include <sndfile.h>
#include <samplerate.h>
@ -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,

View file

@ -21,6 +21,7 @@
#ifndef __ardour_export_format_compatibility_h__
#define __ardour_export_format_compatibility_h__
#include <string>
#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);

View file

@ -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);

View file

@ -21,7 +21,7 @@
#ifndef __ardour_export_format_specification_h__
#define __ardour_export_format_specification_h__
#include <glibmm/ustring.h>
#include <string>
#include "pbd/uuid.h"
@ -76,7 +76,7 @@ class ExportFormatSpecification : public ExportFormatBase {
void set_format (boost::shared_ptr<ExportFormat> 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;

View file

@ -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);

View file

@ -25,10 +25,10 @@
#include <vector>
#include <map>
#include <stdexcept>
#include <string>
#include <boost/shared_ptr.hpp>
#include <boost/weak_ptr.hpp>
#include <glibmm/ustring.h>
#include "pbd/uuid.h"
#include "pbd/file_utils.h"
@ -137,7 +137,7 @@ class ExportProfileManager
typedef std::list<TimespanStatePtr> 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<Glib::ustring> errors;
std::list<Glib::ustring> warnings;
std::list<Glib::ustring> conflicting_filenames;
std::list<std::string> errors;
std::list<std::string> warnings;
std::list<std::string> conflicting_filenames;
};
boost::shared_ptr<Warnings> get_warnings ();

View file

@ -23,8 +23,7 @@
#include <map>
#include <list>
#include <glibmm/ustring.h>
#include <string>
#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;
};

View file

@ -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<DataType, Glib::ustring> search_paths;
static std::map<DataType, std::string> search_paths;
};
} // namespace ARDOUR

View file

@ -37,7 +37,7 @@ struct ImportStatus : public InterThreadInfo {
uint32_t total;
SrcQuality quality;
volatile bool freeze;
std::vector<Glib::ustring> paths;
std::vector<std::string> paths;
bool replace_existing_source;
/* result */

View file

@ -21,7 +21,7 @@
#define __ardour_plugin_h__
#include <boost/shared_ptr.hpp>
#include <glibmm/ustring.h>
#include <string>
#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;

View file

@ -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<MidiSource> create_midi_source_for_session (Track*, std::string const &, bool as_stub = false);
boost::shared_ptr<Source> source_by_id (const PBD::ID&);
boost::shared_ptr<Source> source_by_path_and_channel (const Glib::ustring&, uint16_t);
boost::shared_ptr<Source> source_by_path_and_channel (const std::string&, uint16_t);
void add_playlist (boost::shared_ptr<Playlist>, bool unused = false);

View file

@ -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)

View file

@ -21,7 +21,6 @@
#define __ardour_session_metadata_h__
#include <string>
#include <glibmm/ustring.h>
#include <map>
#include <utility>
@ -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;
std::string grouping () const;
std::string title () const;
std::string 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;
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;
Glib::ustring album () const;
Glib::ustring compilation () const;
Glib::ustring disc_subtitle () 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_grouping (const std::string &);
void set_title (const std::string &);
void set_subtitle (const std::string &);
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_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 Glib::ustring &);
void set_compilation (const Glib::ustring &);
void set_disc_subtitle (const Glib::ustring &);
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<Glib::ustring, Glib::ustring> Property;
typedef std::map<Glib::ustring, Glib::ustring> PropertyMap;
typedef std::pair<std::string, std::string> Property;
typedef std::map<std::string, std::string> 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

View file

@ -37,7 +37,7 @@ template<typename T> 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);

View file

@ -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);

View file

@ -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; }

View file

@ -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);

View file

@ -356,7 +356,7 @@ AudioRegionImporter::prepare_sources ()
session.import_audiofiles (status);
// Add imported sources to handlers map
std::vector<Glib::ustring>::iterator file_it = status.paths.begin();
std::vector<string>::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);

View file

@ -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<CAC
frames_processed (0)
{
if (!preset_search_path_initialized) {
Glib::ustring p = Glib::get_home_dir();
string p = Glib::get_home_dir();
p += "/Library/Audio/Presets:";
p += preset_search_path;
preset_search_path = p;
@ -1093,7 +1093,7 @@ AUPlugin::load_preset (const string& preset_label)
#ifdef AU_STATE_SUPPORT
bool ret = false;
CFPropertyListRef propertyList;
Glib::ustring path;
string path;
PresetMap::iterator x = preset_map.find (preset_label);
if (x == preset_map.end()) {
@ -1123,8 +1123,8 @@ AUPlugin::save_preset (string preset_name)
{
#ifdef AU_STATE_SUPPORT
CFPropertyListRef propertyList;
vector<Glib::ustring> v;
Glib::ustring user_preset_path;
vector<string> 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;

View file

@ -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;

View file

@ -68,7 +68,7 @@ using namespace ARDOUR;
using namespace PBD;
using namespace Glib;
ustring AudioFileSource::peak_dir = "";
string AudioFileSource::peak_dir = "";
PBD::Signal0<void> AudioFileSource::HeaderPositionOffsetChanged;
uint64_t AudioFileSource::header_position_offset = 0;
@ -92,7 +92,7 @@ struct SizedSampleBuffer {
Glib::StaticPrivate<SizedSampleBuffer> 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",

View file

@ -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;

View file

@ -18,6 +18,7 @@
*/
#include <string>
#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;

View file

@ -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);
}

View file

@ -512,10 +512,10 @@ ExportFormatSpecification::set_format (boost::shared_ptr<ExportFormat> format)
}
}
Glib::ustring
string
ExportFormatSpecification::description ()
{
Glib::ustring desc;
string desc;
desc = _name + ": ";

View file

@ -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)
{

View file

@ -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_ptr<AudioGrapher::Sndfil
{
unsigned channels = config.channel_config->get_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<T> (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));

View file

@ -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;

View file

@ -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> 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> 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);

View file

@ -52,9 +52,9 @@ using namespace ARDOUR;
using namespace PBD;
using namespace Glib;
map<DataType, ustring> FileSource::search_paths;
map<DataType, string> 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<ustring> dirs;
vector<string> 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<ustring>::iterator i = dirs.begin(); i != dirs.end(); ++i) {
for (vector<string>::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;
}

View file

@ -240,7 +240,7 @@ create_mono_sources_for_writing (const vector<string>& 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<Glib::ustring>::iterator p = status.paths.begin();
for (vector<string>::iterator p = status.paths.begin();
p != status.paths.end() && !status.cancel;
++p)
{

View file

@ -65,7 +65,7 @@ MidiPatchManager::refresh()
assert(is_directory(path_to_patches));
Glib::PatternSpec pattern(Glib::ustring("*.midnam"));
Glib::PatternSpec pattern(string("*.midnam"));
vector<path> result;
find_matching_files_in_directory(path_to_patches, pattern, result);

View file

@ -16,12 +16,14 @@
675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <glibmm/ustring.h>
#include <string>
#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)) {

View file

@ -2719,7 +2719,7 @@ Session::source_by_id (const PBD::ID& id)
}
boost::shared_ptr<Source>
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;

View file

@ -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);
}

View file

@ -2417,7 +2417,7 @@ Session::find_all_sources (string path, set<string>& result)
continue;
}
Glib::ustring found_path;
string found_path;
bool is_new;
uint16_t chan;

View file

@ -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

View file

@ -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;

View file

@ -39,6 +39,7 @@
#include <errno.h>
#include <glibmm/miscutils.h>
#include <glibmm/fileutils.h>
#ifdef HAVE_WORDEXP
#include <wordexp.h>
@ -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<string> posix_dirs;
vector<string> 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<string>::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<string>::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 */

View file

@ -30,7 +30,7 @@
#include <sys/stat.h>
#include <cerrno>
#include <glibmm/ustring.h>
#include <glibmm/string.h>
#include <glibmm/miscutils.h>
#include <lrdf.h>