2 * This file is part of the PulseView project.
4 * Copyright (C) 2012 Joel Holdsworth <joel@airwebreathe.org.uk>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
24 #include <libsigrokdecode/libsigrokdecode.h>
30 #include <boost/algorithm/string/join.hpp>
33 #include <QApplication>
34 #include <QButtonGroup>
35 #include <QCloseEvent>
36 #include <QFileDialog>
37 #include <QMessageBox>
42 #include <QVBoxLayout>
45 #include "mainwindow.hpp"
47 #include "devicemanager.hpp"
49 #include "data/segment.hpp"
50 #include "devices/hardwaredevice.hpp"
51 #include "devices/inputfile.hpp"
52 #include "devices/sessionfile.hpp"
53 #include "dialogs/about.hpp"
54 #include "dialogs/connect.hpp"
55 #include "dialogs/inputoutputoptions.hpp"
56 #include "dialogs/storeprogress.hpp"
57 #include "toolbars/mainbar.hpp"
58 #include "view/logicsignal.hpp"
59 #include "view/view.hpp"
60 #include "widgets/exportmenu.hpp"
61 #include "widgets/importmenu.hpp"
63 #include "widgets/decodermenu.hpp"
65 #include "widgets/hidingmenubar.hpp"
71 #include <libsigrokcxx/libsigrokcxx.hpp>
78 using std::shared_ptr;
82 using boost::algorithm::join;
85 using sigrok::OutputFormat;
86 using sigrok::InputFormat;
94 const char *MainWindow::SettingOpenDirectory = "MainWindow/OpenDirectory";
95 const char *MainWindow::SettingSaveDirectory = "MainWindow/SaveDirectory";
97 MainWindow::MainWindow(DeviceManager &device_manager,
98 string open_file_name, string open_file_format,
101 device_manager_(device_manager),
102 session_(device_manager),
103 action_open_(new QAction(this)),
104 action_save_as_(new QAction(this)),
105 action_save_selection_as_(new QAction(this)),
106 action_connect_(new QAction(this)),
107 action_quit_(new QAction(this)),
108 action_view_zoom_in_(new QAction(this)),
109 action_view_zoom_out_(new QAction(this)),
110 action_view_zoom_fit_(new QAction(this)),
111 action_view_zoom_one_to_one_(new QAction(this)),
112 action_view_sticky_scrolling_(new QAction(this)),
113 action_view_coloured_bg_(new QAction(this)),
114 action_view_show_cursors_(new QAction(this)),
115 action_about_(new QAction(this))
117 , menu_decoders_add_(new pv::widgets::DecoderMenu(this, true))
120 qRegisterMetaType<util::Timestamp>("util::Timestamp");
123 restore_ui_settings();
124 if (open_file_name.empty())
125 select_init_device();
127 load_init_file(open_file_name, open_file_format);
130 QAction* MainWindow::action_open() const
135 QAction* MainWindow::action_save_as() const
137 return action_save_as_;
140 QAction* MainWindow::action_save_selection_as() const
142 return action_save_selection_as_;
145 QAction* MainWindow::action_connect() const
147 return action_connect_;
150 QAction* MainWindow::action_quit() const
155 QAction* MainWindow::action_view_zoom_in() const
157 return action_view_zoom_in_;
160 QAction* MainWindow::action_view_zoom_out() const
162 return action_view_zoom_out_;
165 QAction* MainWindow::action_view_zoom_fit() const
167 return action_view_zoom_fit_;
170 QAction* MainWindow::action_view_zoom_one_to_one() const
172 return action_view_zoom_one_to_one_;
175 QAction* MainWindow::action_view_sticky_scrolling() const
177 return action_view_sticky_scrolling_;
180 QAction* MainWindow::action_view_show_cursors() const
182 return action_view_show_cursors_;
185 QAction* MainWindow::action_about() const
187 return action_about_;
191 QMenu* MainWindow::menu_decoder_add() const
193 return menu_decoders_add_;
197 void MainWindow::run_stop()
199 switch (session_.get_capture_state()) {
200 case Session::Stopped:
201 session_.start_capture([&](QString message) {
202 session_error("Capture failed", message); });
204 case Session::AwaitingTrigger:
205 case Session::Running:
206 session_.stop_capture();
211 void MainWindow::select_device(shared_ptr<devices::Device> device)
215 session_.set_device(device);
217 session_.set_default_device();
218 } catch (const QString &e) {
219 QMessageBox msg(this);
221 msg.setInformativeText(tr("Failed to Select Device"));
222 msg.setStandardButtons(QMessageBox::Ok);
223 msg.setIcon(QMessageBox::Warning);
228 void MainWindow::export_file(shared_ptr<OutputFormat> format,
231 using pv::dialogs::StoreProgress;
233 // Stop any currently running capture session
234 session_.stop_capture();
237 const QString dir = settings.value(SettingSaveDirectory).toString();
239 std::pair<uint64_t, uint64_t> sample_range;
241 // Selection only? Verify that the cursors are active and fetch their values
242 if (selection_only) {
243 if (!view_->cursors()->enabled()) {
244 show_session_error(tr("Missing Cursors"), tr("You need to set the " \
245 "cursors before you can save the data enclosed by them " \
246 "to a session file (e.g. using ALT-V - Show Cursors)."));
250 const double samplerate = session_.get_samplerate();
252 const pv::util::Timestamp& start_time = view_->cursors()->first()->time();
253 const pv::util::Timestamp& end_time = view_->cursors()->second()->time();
255 const uint64_t start_sample = start_time.convert_to<double>() * samplerate;
256 const uint64_t end_sample = end_time.convert_to<double>() * samplerate;
258 sample_range = std::make_pair(start_sample, end_sample);
260 sample_range = std::make_pair(0, 0);
263 // Construct the filter
264 const vector<string> exts = format->extensions();
265 QString filter = tr("%1 files ").arg(
266 QString::fromStdString(format->description()));
271 filter += QString("(*.%1);;%2 (*.*)").arg(
272 QString::fromStdString(join(exts, ", *."))).arg(
275 // Show the file dialog
276 const QString file_name = QFileDialog::getSaveFileName(
277 this, tr("Save File"), dir, filter);
279 if (file_name.isEmpty())
282 const QString abs_path = QFileInfo(file_name).absolutePath();
283 settings.setValue(SettingSaveDirectory, abs_path);
285 // Show the options dialog
286 map<string, Glib::VariantBase> options;
287 if (!format->options().empty()) {
288 dialogs::InputOutputOptions dlg(
289 tr("Export %1").arg(QString::fromStdString(
290 format->description())),
291 format->options(), this);
294 options = dlg.options();
297 StoreProgress *dlg = new StoreProgress(file_name, format, options,
298 sample_range, session_, this);
302 void MainWindow::import_file(shared_ptr<InputFormat> format)
307 const QString dir = settings.value(SettingOpenDirectory).toString();
309 // Construct the filter
310 const vector<string> exts = format->extensions();
311 const QString filter = exts.empty() ? "" :
312 tr("%1 files (*.%2)").arg(
313 QString::fromStdString(format->description())).arg(
314 QString::fromStdString(join(exts, ", *.")));
316 // Show the file dialog
317 const QString file_name = QFileDialog::getOpenFileName(
318 this, tr("Import File"), dir, tr(
319 "%1 files (*.*);;All Files (*.*)").arg(
320 QString::fromStdString(format->description())));
322 if (file_name.isEmpty())
325 // Show the options dialog
326 map<string, Glib::VariantBase> options;
327 if (!format->options().empty()) {
328 dialogs::InputOutputOptions dlg(
329 tr("Import %1").arg(QString::fromStdString(
330 format->description())),
331 format->options(), this);
334 options = dlg.options();
337 load_file(file_name, format, options);
339 const QString abs_path = QFileInfo(file_name).absolutePath();
340 settings.setValue(SettingOpenDirectory, abs_path);
343 void MainWindow::setup_ui()
345 setObjectName(QString::fromUtf8("MainWindow"));
347 // Set the window icon
349 icon.addFile(QString(":/icons/sigrok-logo-notext.svg"));
352 // Setup the central widget
353 central_widget_ = new QWidget(this);
354 vertical_layout_ = new QVBoxLayout(central_widget_);
355 vertical_layout_->setSpacing(6);
356 vertical_layout_->setContentsMargins(0, 0, 0, 0);
357 setCentralWidget(central_widget_);
359 view_ = new pv::view::View(session_, this);
361 vertical_layout_->addWidget(view_);
363 // Setup the menu bar
364 pv::widgets::HidingMenuBar *const menu_bar =
365 new pv::widgets::HidingMenuBar(this);
368 QMenu *const menu_file = new QMenu;
369 menu_file->setTitle(tr("&File"));
371 action_open_->setText(tr("&Open..."));
372 action_open_->setIcon(QIcon::fromTheme("document-open",
373 QIcon(":/icons/document-open.png")));
374 action_open_->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_O));
375 action_open_->setObjectName(QString::fromUtf8("actionOpen"));
376 menu_file->addAction(action_open_);
378 action_save_as_->setText(tr("&Save As..."));
379 action_save_as_->setIcon(QIcon::fromTheme("document-save-as",
380 QIcon(":/icons/document-save-as.png")));
381 action_save_as_->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_S));
382 action_save_as_->setObjectName(QString::fromUtf8("actionSaveAs"));
383 menu_file->addAction(action_save_as_);
385 action_save_selection_as_->setText(tr("Save Selected &Range As..."));
386 action_save_selection_as_->setIcon(QIcon::fromTheme("document-save-as",
387 QIcon(":/icons/document-save-as.png")));
388 action_save_selection_as_->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_R));
389 action_save_selection_as_->setObjectName(QString::fromUtf8("actionSaveSelectionAs"));
390 menu_file->addAction(action_save_selection_as_);
392 menu_file->addSeparator();
394 widgets::ExportMenu *menu_file_export = new widgets::ExportMenu(this,
395 device_manager_.context());
396 menu_file_export->setTitle(tr("&Export"));
397 connect(menu_file_export,
398 SIGNAL(format_selected(std::shared_ptr<sigrok::OutputFormat>)),
399 this, SLOT(export_file(std::shared_ptr<sigrok::OutputFormat>)));
400 menu_file->addAction(menu_file_export->menuAction());
402 widgets::ImportMenu *menu_file_import = new widgets::ImportMenu(this,
403 device_manager_.context());
404 menu_file_import->setTitle(tr("&Import"));
405 connect(menu_file_import,
406 SIGNAL(format_selected(std::shared_ptr<sigrok::InputFormat>)),
407 this, SLOT(import_file(std::shared_ptr<sigrok::InputFormat>)));
408 menu_file->addAction(menu_file_import->menuAction());
410 menu_file->addSeparator();
412 action_connect_->setText(tr("&Connect to Device..."));
413 action_connect_->setObjectName(QString::fromUtf8("actionConnect"));
414 menu_file->addAction(action_connect_);
416 menu_file->addSeparator();
418 action_quit_->setText(tr("&Quit"));
419 action_quit_->setIcon(QIcon::fromTheme("application-exit",
420 QIcon(":/icons/application-exit.png")));
421 action_quit_->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_Q));
422 action_quit_->setObjectName(QString::fromUtf8("actionQuit"));
423 menu_file->addAction(action_quit_);
426 QMenu *menu_view = new QMenu;
427 menu_view->setTitle(tr("&View"));
429 action_view_zoom_in_->setText(tr("Zoom &In"));
430 action_view_zoom_in_->setIcon(QIcon::fromTheme("zoom-in",
431 QIcon(":/icons/zoom-in.png")));
432 // simply using Qt::Key_Plus shows no + in the menu
433 action_view_zoom_in_->setShortcut(QKeySequence::ZoomIn);
434 action_view_zoom_in_->setObjectName(
435 QString::fromUtf8("actionViewZoomIn"));
436 menu_view->addAction(action_view_zoom_in_);
438 action_view_zoom_out_->setText(tr("Zoom &Out"));
439 action_view_zoom_out_->setIcon(QIcon::fromTheme("zoom-out",
440 QIcon(":/icons/zoom-out.png")));
441 action_view_zoom_out_->setShortcut(QKeySequence::ZoomOut);
442 action_view_zoom_out_->setObjectName(
443 QString::fromUtf8("actionViewZoomOut"));
444 menu_view->addAction(action_view_zoom_out_);
446 action_view_zoom_fit_->setCheckable(true);
447 action_view_zoom_fit_->setText(tr("Zoom to &Fit"));
448 action_view_zoom_fit_->setIcon(QIcon::fromTheme("zoom-fit",
449 QIcon(":/icons/zoom-fit.png")));
450 action_view_zoom_fit_->setShortcut(QKeySequence(Qt::Key_F));
451 action_view_zoom_fit_->setObjectName(
452 QString::fromUtf8("actionViewZoomFit"));
453 menu_view->addAction(action_view_zoom_fit_);
455 action_view_zoom_one_to_one_->setText(tr("Zoom to O&ne-to-One"));
456 action_view_zoom_one_to_one_->setIcon(QIcon::fromTheme("zoom-original",
457 QIcon(":/icons/zoom-original.png")));
458 action_view_zoom_one_to_one_->setShortcut(QKeySequence(Qt::Key_O));
459 action_view_zoom_one_to_one_->setObjectName(
460 QString::fromUtf8("actionViewZoomOneToOne"));
461 menu_view->addAction(action_view_zoom_one_to_one_);
463 menu_view->addSeparator();
465 action_view_sticky_scrolling_->setCheckable(true);
466 action_view_sticky_scrolling_->setChecked(true);
467 action_view_sticky_scrolling_->setShortcut(QKeySequence(Qt::Key_S));
468 action_view_sticky_scrolling_->setObjectName(
469 QString::fromUtf8("actionViewStickyScrolling"));
470 action_view_sticky_scrolling_->setText(tr("&Sticky Scrolling"));
471 menu_view->addAction(action_view_sticky_scrolling_);
473 view_->enable_sticky_scrolling(action_view_sticky_scrolling_->isChecked());
475 menu_view->addSeparator();
477 action_view_coloured_bg_->setCheckable(true);
478 action_view_coloured_bg_->setChecked(true);
479 action_view_coloured_bg_->setShortcut(QKeySequence(Qt::Key_B));
480 action_view_coloured_bg_->setObjectName(
481 QString::fromUtf8("actionViewColouredBg"));
482 action_view_coloured_bg_->setText(tr("Use &coloured backgrounds"));
483 menu_view->addAction(action_view_coloured_bg_);
485 view_->enable_coloured_bg(action_view_coloured_bg_->isChecked());
487 menu_view->addSeparator();
489 action_view_show_cursors_->setCheckable(true);
490 action_view_show_cursors_->setChecked(view_->cursors_shown());
491 action_view_show_cursors_->setIcon(QIcon::fromTheme("show-cursors",
492 QIcon(":/icons/show-cursors.svg")));
493 action_view_show_cursors_->setShortcut(QKeySequence(Qt::Key_C));
494 action_view_show_cursors_->setObjectName(
495 QString::fromUtf8("actionViewShowCursors"));
496 action_view_show_cursors_->setText(tr("Show &Cursors"));
497 menu_view->addAction(action_view_show_cursors_);
501 QMenu *const menu_decoders = new QMenu;
502 menu_decoders->setTitle(tr("&Decoders"));
504 menu_decoders_add_->setTitle(tr("&Add"));
505 connect(menu_decoders_add_, SIGNAL(decoder_selected(srd_decoder*)),
506 this, SLOT(add_decoder(srd_decoder*)));
508 menu_decoders->addMenu(menu_decoders_add_);
512 QMenu *const menu_help = new QMenu;
513 menu_help->setTitle(tr("&Help"));
515 action_about_->setObjectName(QString::fromUtf8("actionAbout"));
516 action_about_->setText(tr("&About..."));
517 menu_help->addAction(action_about_);
519 menu_bar->addAction(menu_file->menuAction());
520 menu_bar->addAction(menu_view->menuAction());
522 menu_bar->addAction(menu_decoders->menuAction());
524 menu_bar->addAction(menu_help->menuAction());
526 setMenuBar(menu_bar);
527 QMetaObject::connectSlotsByName(this);
529 // Also add all actions to the main window for always-enabled hotkeys
530 for (QAction* action : menu_bar->actions())
531 this->addAction(action);
534 main_bar_ = new toolbars::MainBar(session_, *this);
536 // Populate the device list and select the initially selected device
537 update_device_list();
539 addToolBar(main_bar_);
542 setWindowTitle(tr("PulseView"));
544 // Setup session_ events
545 connect(&session_, SIGNAL(capture_state_changed(int)), this,
546 SLOT(capture_state_changed(int)));
547 connect(&session_, SIGNAL(device_selected()), this,
548 SLOT(device_selected()));
549 connect(&session_, SIGNAL(trigger_event(util::Timestamp)), view_,
550 SLOT(trigger_event(util::Timestamp)));
552 // Setup view_ events
553 connect(view_, SIGNAL(sticky_scrolling_changed(bool)), this,
554 SLOT(sticky_scrolling_changed(bool)));
555 connect(view_, SIGNAL(always_zoom_to_fit_changed(bool)), this,
556 SLOT(always_zoom_to_fit_changed(bool)));
560 void MainWindow::select_init_device()
563 map<string, string> dev_info;
564 list<string> key_list;
566 // Re-select last used device if possible.
567 settings.beginGroup("Device");
568 key_list.push_back("vendor");
569 key_list.push_back("model");
570 key_list.push_back("version");
571 key_list.push_back("serial_num");
572 key_list.push_back("connection_id");
574 for (string key : key_list) {
575 const QString k = QString::fromStdString(key);
576 if (!settings.contains(k))
579 const string value = settings.value(k).toString().toStdString();
581 dev_info.insert(std::make_pair(key, value));
584 const shared_ptr<devices::HardwareDevice> device =
585 device_manager_.find_device_from_info(dev_info);
586 select_device(device);
587 update_device_list();
592 void MainWindow::load_init_file(const std::string &file_name,
593 const std::string &format)
595 shared_ptr<InputFormat> input_format;
597 if (!format.empty()) {
598 const map<string, shared_ptr<InputFormat> > formats =
599 device_manager_.context()->input_formats();
600 const auto iter = find_if(formats.begin(), formats.end(),
601 [&](const pair<string, shared_ptr<InputFormat> > f) {
602 return f.first == format; });
603 if (iter == formats.end()) {
604 cerr << "Unexpected input format: " << format << endl;
608 input_format = (*iter).second;
611 load_file(QString::fromStdString(file_name), input_format);
615 void MainWindow::save_ui_settings()
619 map<string, string> dev_info;
620 list<string> key_list;
622 settings.beginGroup("MainWindow");
623 settings.setValue("state", saveState());
624 settings.setValue("geometry", saveGeometry());
627 if (session_.device()) {
628 settings.beginGroup("Device");
629 key_list.push_back("vendor");
630 key_list.push_back("model");
631 key_list.push_back("version");
632 key_list.push_back("serial_num");
633 key_list.push_back("connection_id");
635 dev_info = device_manager_.get_device_info(
638 for (string key : key_list) {
639 if (dev_info.count(key))
640 settings.setValue(QString::fromUtf8(key.c_str()),
641 QString::fromUtf8(dev_info.at(key).c_str()));
643 settings.remove(QString::fromUtf8(key.c_str()));
650 void MainWindow::restore_ui_settings()
654 settings.beginGroup("MainWindow");
656 if (settings.contains("geometry")) {
657 restoreGeometry(settings.value("geometry").toByteArray());
658 restoreState(settings.value("state").toByteArray());
665 void MainWindow::session_error(
666 const QString text, const QString info_text)
668 QMetaObject::invokeMethod(this, "show_session_error",
669 Qt::QueuedConnection, Q_ARG(QString, text),
670 Q_ARG(QString, info_text));
673 void MainWindow::update_device_list()
675 main_bar_->update_device_list();
678 void MainWindow::load_file(QString file_name,
679 std::shared_ptr<sigrok::InputFormat> format,
680 const std::map<std::string, Glib::VariantBase> &options)
682 const QString errorMessage(
683 QString("Failed to load file %1").arg(file_name));
687 session_.set_device(shared_ptr<devices::Device>(
688 new devices::InputFile(
689 device_manager_.context(),
690 file_name.toStdString(),
693 session_.set_device(shared_ptr<devices::Device>(
694 new devices::SessionFile(
695 device_manager_.context(),
696 file_name.toStdString())));
698 show_session_error(tr("Failed to load ") + file_name, e.what());
699 session_.set_default_device();
700 update_device_list();
704 update_device_list();
706 session_.start_capture([&, errorMessage](QString infoMessage) {
707 session_error(errorMessage, infoMessage); });
710 void MainWindow::closeEvent(QCloseEvent *event)
716 void MainWindow::keyReleaseEvent(QKeyEvent *event)
718 if (event->key() == Qt::Key_Alt) {
719 menuBar()->setHidden(!menuBar()->isHidden());
720 menuBar()->setFocus();
722 QMainWindow::keyReleaseEvent(event);
725 void MainWindow::show_session_error(
726 const QString text, const QString info_text)
728 QMessageBox msg(this);
730 msg.setInformativeText(info_text);
731 msg.setStandardButtons(QMessageBox::Ok);
732 msg.setIcon(QMessageBox::Warning);
736 void MainWindow::on_actionOpen_triggered()
739 const QString dir = settings.value(SettingOpenDirectory).toString();
742 const QString file_name = QFileDialog::getOpenFileName(
743 this, tr("Open File"), dir, tr(
744 "Sigrok Sessions (*.sr);;"
747 if (!file_name.isEmpty()) {
748 load_file(file_name);
750 const QString abs_path = QFileInfo(file_name).absolutePath();
751 settings.setValue(SettingOpenDirectory, abs_path);
755 void MainWindow::on_actionSaveAs_triggered()
757 export_file(device_manager_.context()->output_formats()["srzip"]);
760 void MainWindow::on_actionSaveSelectionAs_triggered()
762 export_file(device_manager_.context()->output_formats()["srzip"], true);
765 void MainWindow::on_actionConnect_triggered()
767 // Stop any currently running capture session
768 session_.stop_capture();
770 dialogs::Connect dlg(this, device_manager_);
772 // If the user selected a device, select it in the device list. Select the
773 // current device otherwise.
775 select_device(dlg.get_selected_device());
777 update_device_list();
780 void MainWindow::on_actionQuit_triggered()
785 void MainWindow::on_actionViewZoomIn_triggered()
790 void MainWindow::on_actionViewZoomOut_triggered()
795 void MainWindow::on_actionViewZoomFit_triggered()
797 view_->zoom_fit(action_view_zoom_fit_->isChecked());
800 void MainWindow::on_actionViewZoomOneToOne_triggered()
802 view_->zoom_one_to_one();
805 void MainWindow::on_actionViewStickyScrolling_triggered()
807 view_->enable_sticky_scrolling(action_view_sticky_scrolling_->isChecked());
810 void MainWindow::on_actionViewColouredBg_triggered()
812 view_->enable_coloured_bg(action_view_coloured_bg_->isChecked());
815 void MainWindow::on_actionViewShowCursors_triggered()
819 const bool show = !view_->cursors_shown();
821 view_->centre_cursors();
823 view_->show_cursors(show);
826 void MainWindow::on_actionAbout_triggered()
828 dialogs::About dlg(device_manager_.context(), this);
832 void MainWindow::sticky_scrolling_changed(bool state)
834 action_view_sticky_scrolling_->setChecked(state);
837 void MainWindow::always_zoom_to_fit_changed(bool state)
839 action_view_zoom_fit_->setChecked(state);
842 void MainWindow::add_decoder(srd_decoder *decoder)
846 session_.add_decoder(decoder);
852 void MainWindow::capture_state_changed(int state)
854 main_bar_->set_capture_state((pv::Session::capture_state)state);
857 void MainWindow::device_selected()
859 // Set the title to include the device/file name
860 const shared_ptr<devices::Device> device = session_.device();
864 const string display_name = device->display_name(device_manager_);
865 setWindowTitle(tr("%1 - PulseView").arg(display_name.c_str()));