C++11 tidying.
authorCarl Hetherington <cth@carlh.net>
Thu, 4 Nov 2021 23:43:00 +0000 (00:43 +0100)
committerCarl Hetherington <cth@carlh.net>
Thu, 4 Nov 2021 23:43:00 +0000 (00:43 +0100)
26 files changed:
src/lib/audio_content.cc
src/lib/audio_ring_buffers.h
src/lib/check_content_change_job.cc
src/lib/cinema.h
src/lib/config.h
src/lib/cross.h
src/lib/ffmpeg_decoder.h
src/lib/ffmpeg_encoder.h
src/lib/player.h
src/lib/render_text.h
src/lib/send_kdm_email_job.cc
src/lib/subtitle_encoder.h
src/lib/text_content.h
src/lib/video_content.cc
src/tools/dcpomatic_create.cc
src/wx/content_panel.cc
src/wx/content_properties_dialog.h
src/wx/content_widget.h
src/wx/text_panel.cc
src/wx/timeline.cc
src/wx/timeline_content_view.cc
src/wx/timeline_time_axis_view.cc
src/wx/timeline_time_axis_view.h
src/wx/wx_util.cc
src/wx/wx_util.h
test/create_cli_test.cc

index 748cbb7d0d6403b487ec540abd2ab2e8768b3d66..f2510b494ea3c75149603013a140b68bcf77f620 100644 (file)
@@ -98,7 +98,7 @@ AudioContent::AudioContent (Content* parent, cxml::ConstNodePtr node)
 }
 
 
-AudioContent::AudioContent (Content* parent, vector<shared_ptr<Content> > c)
+AudioContent::AudioContent (Content* parent, vector<shared_ptr<Content>> c)
        : ContentPart (parent)
 {
        auto ref = c[0]->audio;
index 4c90ed7911d4137d3acd3e5de96591f5a234bbc3..6fb84e0d76dc8684757827742d183943e7b62a51 100644 (file)
@@ -48,7 +48,7 @@ public:
 
 private:
        mutable boost::mutex _mutex;
-       std::list<std::pair<std::shared_ptr<const AudioBuffers>, dcpomatic::DCPTime> > _buffers;
+       std::list<std::pair<std::shared_ptr<const AudioBuffers>, dcpomatic::DCPTime>> _buffers;
        int _used_in_head = 0;
 };
 
index c4d050c0e19ea09b7dc6d7e6c8d42568d8876a7f..216cf3e51cf6ae8a809666c25a800369df5b0484 100644 (file)
 
 */
 
+
 #include "check_content_change_job.h"
-#include "job_manager.h"
-#include "examine_content_job.h"
 #include "content.h"
+#include "examine_content_job.h"
 #include "film.h"
+#include "job_manager.h"
 #include <iostream>
 
 #include "i18n.h"
 
-using std::string;
-using std::list;
+
 using std::cout;
+using std::list;
+using std::make_shared;
 using std::shared_ptr;
+using std::string;
+
 
 /** @param gui true if we are running this job from the GUI, false if it's the CLI */
 CheckContentChangeJob::CheckContentChangeJob (shared_ptr<const Film> film, shared_ptr<Job> following, bool gui)
@@ -63,7 +67,7 @@ CheckContentChangeJob::run ()
 {
        set_progress_unknown ();
 
-       list<shared_ptr<Content> > changed;
+       list<shared_ptr<Content>> changed;
 
        for (auto i: _film->content()) {
                bool ic = false;
@@ -84,7 +88,7 @@ CheckContentChangeJob::run ()
        if (!changed.empty()) {
                if (_gui) {
                        for (auto i: changed) {
-                               JobManager::instance()->add(shared_ptr<Job>(new ExamineContentJob(_film, i)));
+                               JobManager::instance()->add(make_shared<ExamineContentJob>(_film, i));
                        }
                        string m = _("Some files have been changed since they were added to the project.\n\nThese files will now be re-examined, so you may need to check their settings.");
                        if (_following) {
index a89408f3f28f94610f9f6470beacb5f83856e87c..c17454db980f957aff708857ed4d4bcab76f85bd 100644 (file)
@@ -76,7 +76,7 @@ public:
                return _utc_offset_minute;
        }
 
-       std::list<std::shared_ptr<dcpomatic::Screen> > screens () const {
+       std::list<std::shared_ptr<dcpomatic::Screen>> screens () const {
                return _screens;
        }
 
index c9206b139fce004f83c63a5840b3c6083be7e918..d927b3b198f6b68448c240d51eb2feb5fa70d259 100644 (file)
@@ -140,11 +140,11 @@ public:
                return _tms_password;
        }
 
-       std::list<std::shared_ptr<Cinema> > cinemas () const {
+       std::list<std::shared_ptr<Cinema>> cinemas () const {
                return _cinemas;
        }
 
-       std::list<std::shared_ptr<DKDMRecipient> > dkdm_recipients () const {
+       std::list<std::shared_ptr<DKDMRecipient>> dkdm_recipients () const {
                return _dkdm_recipients;
        }
 
@@ -1194,8 +1194,8 @@ private:
        */
        boost::optional<boost::filesystem::path> _default_kdm_directory;
        bool _upload_after_make_dcp;
-       std::list<std::shared_ptr<Cinema> > _cinemas;
-       std::list<std::shared_ptr<DKDMRecipient> > _dkdm_recipients;
+       std::list<std::shared_ptr<Cinema>> _cinemas;
+       std::list<std::shared_ptr<DKDMRecipient>> _dkdm_recipients;
        std::string _mail_server;
        int _mail_port;
        EmailProtocol _mail_protocol;
index ed1d0c8e780836cc3281d89a314e5fc16580bb34..1f06822b01dad60a8ca223e330373b271aa73a0a 100644 (file)
@@ -43,7 +43,7 @@ extern void dcpomatic_sleep_seconds (int);
 extern void dcpomatic_sleep_milliseconds (int);
 extern std::string cpu_info ();
 extern void run_ffprobe (boost::filesystem::path, boost::filesystem::path);
-extern std::list<std::pair<std::string, std::string> > mount_info ();
+extern std::list<std::pair<std::string, std::string>> mount_info ();
 extern boost::filesystem::path openssl_path ();
 extern void make_foreground_application ();
 #ifdef DCPOMATIC_DISK
index fce3fcae92230da92b955000e8ffdfe4b9498c89..264733c70130dc57cef0a0d06a84be08ddba0d4b 100644 (file)
@@ -71,7 +71,7 @@ private:
 
        void maybe_add_subtitle ();
 
-       std::list<std::shared_ptr<VideoFilterGraph> > _filter_graphs;
+       std::list<std::shared_ptr<VideoFilterGraph>> _filter_graphs;
        boost::mutex _filter_graphs_mutex;
 
        dcpomatic::ContentTime _pts_offset;
index f450c8022de62e53f05540a3060a392b9799c05e..393a6d72eaa58bd1d09670015315a43a18097824 100644 (file)
@@ -73,7 +73,7 @@ private:
                void audio (std::shared_ptr<AudioBuffers>);
 
        private:
-               std::map<Eyes, std::shared_ptr<FFmpegFileEncoder> > _encoders;
+               std::map<Eyes, std::shared_ptr<FFmpegFileEncoder>> _encoders;
        };
 
        int _output_audio_channels;
index 51c30e864fc34b25a79528f95b13b746be2c493b..14fb8d0ee06b50d495268411b827b283ca8fabfa 100644 (file)
@@ -174,7 +174,7 @@ private:
 
        /** > 0 if we are suspended (i.e. pass() and seek() do nothing) */
        boost::atomic<int> _suspended;
-       std::list<std::shared_ptr<Piece> > _pieces;
+       std::list<std::shared_ptr<Piece>> _pieces;
 
        /** Size of the image we are rendering to; this may be the DCP frame size, or
         *  the size of preview in a window.
@@ -208,7 +208,7 @@ private:
 
        AudioMerger _audio_merger;
        std::unique_ptr<Shuffler> _shuffler;
-       std::list<std::pair<std::shared_ptr<PlayerVideo>, dcpomatic::DCPTime> > _delay;
+       std::list<std::pair<std::shared_ptr<PlayerVideo>, dcpomatic::DCPTime>> _delay;
 
        class StreamState
        {
index 07a97bb4047ca90ca6fe5559b7b964e7f50e3a3c..b7846654b8c2a6cf52db1a27c4fa0b0c53989cb6 100644 (file)
@@ -29,5 +29,5 @@ namespace dcpomatic {
 
 std::string marked_up (std::list<StringText> subtitles, int target_height, float fade_factor, std::string font_name);
 std::list<PositionImage> render_text (
-       std::list<StringText>, std::list<std::shared_ptr<dcpomatic::Font> > fonts, dcp::Size, dcpomatic::DCPTime, int
+       std::list<StringText>, std::list<std::shared_ptr<dcpomatic::Font>> fonts, dcp::Size, dcpomatic::DCPTime, int
        );
index 67ddd0eef540d055a2eeeb10285b662c393758be..a0d65508d9e131071b31acb1edbad01b59f51920 100644 (file)
@@ -60,7 +60,7 @@ SendKDMEmailJob::SendKDMEmailJob (
  *  @param cpl_name Name of the CPL that the KDMs are for.
  */
 SendKDMEmailJob::SendKDMEmailJob (
-       list<list<KDMWithMetadataPtr> > kdms,
+       list<list<KDMWithMetadataPtr>> kdms,
        dcp::NameFormat container_name_format,
        dcp::NameFormat filename_format,
        string cpl_name
index b43cc268389e1ddbecfe19649692058d4a1b2dc5..a10e4ba47e09e27e5cb16296c9c1bc0ffde8804e 100644 (file)
@@ -54,7 +54,7 @@ public:
 private:
        void text (PlayerText subs, TextType type, boost::optional<DCPTextTrack> track, dcpomatic::DCPTimePeriod period);
 
-       std::vector<std::pair<std::shared_ptr<dcp::SubtitleAsset>, boost::filesystem::path> > _assets;
+       std::vector<std::pair<std::shared_ptr<dcp::SubtitleAsset>, boost::filesystem::path>> _assets;
        std::vector<dcpomatic::DCPTimePeriod> _reels;
        bool _split_reels;
        bool _include_font;
index d3e9b564b389fcb8787397ff43cefd6660ae1382..66bedecf51007c9e030cf3f01d3261ecc5eb5dfa 100644 (file)
@@ -132,7 +132,7 @@ public:
                return _y_scale;
        }
 
-       std::list<std::shared_ptr<dcpomatic::Font> > fonts () const {
+       std::list<std::shared_ptr<dcpomatic::Font>> fonts () const {
                boost::mutex::scoped_lock lm (_mutex);
                return _fonts;
        }
@@ -221,7 +221,7 @@ private:
        double _x_scale;
        /** y scale factor to apply to subtitles */
        double _y_scale;
-       std::list<std::shared_ptr<dcpomatic::Font> > _fonts;
+       std::list<std::shared_ptr<dcpomatic::Font>> _fonts;
        boost::optional<dcp::Colour> _colour;
        boost::optional<dcp::Effect> _effect;
        boost::optional<dcp::Colour> _effect_colour;
index 9ff35ffdf891c783b9efa2fffc6e332aea04e3cf..c6574fce3e24db0dcf815b7005191492c01af5f3 100644 (file)
@@ -196,7 +196,7 @@ VideoContent::VideoContent (Content* parent, cxml::ConstNodePtr node, int versio
 }
 
 
-VideoContent::VideoContent (Content* parent, vector<shared_ptr<Content> > c)
+VideoContent::VideoContent (Content* parent, vector<shared_ptr<Content>> c)
        : ContentPart (parent)
        , _length (0)
        , _yuv (false)
index 14eae6b3ed643b547d8ee7f3c18754ca3db91e6f..e4e674fbf4e7e3f94459ae3edf4e2aad25e82b63 100644 (file)
@@ -111,8 +111,8 @@ main (int argc, char* argv[])
                }
 
                for (auto i: cc.content) {
-                       boost::filesystem::path const can = boost::filesystem::canonical (i.path);
-                       list<shared_ptr<Content> > content;
+                       auto const can = boost::filesystem::canonical (i.path);
+                       list<shared_ptr<Content>> content;
 
                        if (boost::filesystem::exists (can / "ASSETMAP") || (boost::filesystem::exists (can / "ASSETMAP.xml"))) {
                                content.push_back (shared_ptr<DCPContent>(new DCPContent(can)));
index ceebd6e14282f846d8f174fd323abad7509c3a2c..b2b72b216a1f626c628f136b3b9b1a3c491f4380 100644 (file)
@@ -473,7 +473,7 @@ ContentPanel::add_folder_clicked ()
                return;
        }
 
-       list<shared_ptr<Content> > content;
+       list<shared_ptr<Content>> content;
 
        try {
                content = content_factory (path);
index c7efa4497c91cbdfd0f5af133a56f9fb224be355..f8e8eaf2f280b38e920bd868ef86579f45f17baf 100644 (file)
@@ -36,5 +36,5 @@ public:
        ContentPropertiesDialog (wxWindow* parent, std::shared_ptr<const Film> film, std::shared_ptr<Content> content);
 
 private:
-       void maybe_add_group (std::map<UserProperty::Category, std::list<UserProperty> > const & groups, UserProperty::Category category);
+       void maybe_add_group (std::map<UserProperty::Category, std::list<UserProperty>> const & groups, UserProperty::Category category);
 };
index 34755e4b5a7e1707b710f45487bc9cdf4934dfd3..782b339a784ad0fd40bf8a4d2e6ac38c02fac975 100644 (file)
@@ -92,13 +92,13 @@ public:
                return _wrapped;
        }
 
-       typedef std::vector<std::shared_ptr<Content> > List;
+       typedef std::vector<std::shared_ptr<Content>> List;
 
        /** Set the content that this control is working on (i.e. the selected content) */
        void set_content (List content)
        {
-               for (typename std::list<boost::signals2::connection>::iterator i = _connections.begin(); i != _connections.end(); ++i) {
-                       i->disconnect ();
+               for (auto& i: _connections) {
+                       i.disconnect ();
                }
 
                _connections.clear ();
@@ -109,11 +109,11 @@ public:
 
                update_from_model ();
 
-               for (typename List::iterator i = _content.begin(); i != _content.end(); ++i) {
+               for (auto i: _content) {
 #if BOOST_VERSION >= 106100
-                       _connections.push_back ((*i)->Change.connect (boost::bind (&ContentWidget::model_changed, this, boost::placeholders::_1, boost::placeholders::_3)));
+                       _connections.push_back (i->Change.connect(boost::bind(&ContentWidget::model_changed, this, boost::placeholders::_1, boost::placeholders::_3)));
 #else
-                       _connections.push_back ((*i)->Change.connect (boost::bind (&ContentWidget::model_changed, this, _1, _3)));
+                       _connections.push_back (i->Change.connect(boost::bind(&ContentWidget::model_changed, this, _1, _3)));
 #endif
                }
        }
@@ -135,7 +135,7 @@ public:
                        return;
                }
 
-               typename List::iterator i = _content.begin ();
+               auto i = _content.begin ();
                U const v = boost::bind (_model_getter, _part(_content.front().get()).get())();
                while (i != _content.end() && boost::bind (_model_getter, _part(i->get()).get())() == v) {
                        ++i;
index 7bbead30ccb91926004e34e4cf49a1c557ae55b3..715503b6a1d38462576c0c652b3bdb5eb006afa6 100644 (file)
@@ -874,7 +874,7 @@ TextPanel::update_outline_subtitles_in_viewer ()
                }
                fv->set_outline_subtitles (rect);
        } else {
-               fv->set_outline_subtitles (optional<dcpomatic::Rect<double> >());
+               fv->set_outline_subtitles ({});
        }
 }
 
index 359de9bf9f1b93d65e64e2045487ad120f6d6071..1c5937ae0252350ec6ff2cc915dcfa5579cc7ce4 100644 (file)
@@ -152,7 +152,7 @@ Timeline::paint_labels ()
        _labels_canvas->GetViewStart (&vsx, &vsy);
        gc->Translate (-vsx * _x_scroll_rate, -vsy * _y_scroll_rate + tracks_y_offset());
 
-       _labels_view->paint (gc, list<dcpomatic::Rect<int> >());
+       _labels_view->paint (gc, {});
 
        delete gc;
 }
index 677b83bdde27a4dc7cd5176cb92cfcbf2fdc5fa9..481e8100d2b77037c6e854b181a1ccaef0069a7b 100644 (file)
@@ -95,7 +95,7 @@ TimelineContentView::track () const
 }
 
 void
-TimelineContentView::do_paint (wxGraphicsContext* gc, list<dcpomatic::Rect<int> > overlaps)
+TimelineContentView::do_paint (wxGraphicsContext* gc, list<dcpomatic::Rect<int>> overlaps)
 {
        DCPOMATIC_ASSERT (_track);
 
@@ -105,8 +105,8 @@ TimelineContentView::do_paint (wxGraphicsContext* gc, list<dcpomatic::Rect<int>
                return;
        }
 
-       DCPTime const position = cont->position ();
-       DCPTime const len = cont->length_after_trim (film);
+       auto const position = cont->position ();
+       auto const len = cont->length_after_trim (film);
 
        wxColour selected (background_colour().Red() / 2, background_colour().Green() / 2, background_colour().Blue() / 2);
 
index e9de1b542fab6b1777993b09a920009d420903bc..cd0b97d193fdc21c1d8e8b2c35dc2d43221559a6 100644 (file)
@@ -50,7 +50,7 @@ TimelineTimeAxisView::set_y (int y)
 }
 
 void
-TimelineTimeAxisView::do_paint (wxGraphicsContext* gc, list<dcpomatic::Rect<int> >)
+TimelineTimeAxisView::do_paint (wxGraphicsContext* gc, list<dcpomatic::Rect<int>>)
 {
        if (!_timeline.pixels_per_second()) {
                return;
index 5477e61f13cfaf660f5c95af1ab480e0383a0d32..100228ae8b634f124a9d16ca2ca8d5950fa9dea2 100644 (file)
@@ -29,7 +29,7 @@ public:
        void set_y (int y);
 
 private:
-       void do_paint (wxGraphicsContext* gc, std::list<dcpomatic::Rect<int> > overlaps);
+       void do_paint (wxGraphicsContext* gc, std::list<dcpomatic::Rect<int>> overlaps);
 
        int _y; ///< y position in tracks (not pixels)
 };
index a0beb8f72d0f4e7ac92b7be74e2b06ae52b756af..47b381562aa375a93e02bcc2b731b9099f8023e2 100644 (file)
@@ -297,7 +297,7 @@ checked_set (wxChoice* widget, string value)
 
 
 void
-checked_set (wxChoice* widget, vector<pair<string, string> > items)
+checked_set (wxChoice* widget, vector<pair<string, string>> items)
 {
        vector<pair<string, string>> current;
        for (unsigned int i = 0; i < widget->GetCount(); ++i) {
index 585a30611ec82f462ac0f129ce8c32f668a06956..3fa2ebe258b4426e0ff9b5e44b26c856054eb756 100644 (file)
@@ -144,7 +144,7 @@ extern void checked_set (wxSpinCtrl* widget, int value);
 extern void checked_set (wxSpinCtrlDouble* widget, double value);
 extern void checked_set (wxChoice* widget, int value);
 extern void checked_set (wxChoice* widget, std::string value);
-extern void checked_set (wxChoice* widget, std::vector<std::pair<std::string, std::string> > items);
+extern void checked_set (wxChoice* widget, std::vector<std::pair<std::string, std::string>> items);
 extern void checked_set (wxTextCtrl* widget, std::string value);
 extern void checked_set (wxTextCtrl* widget, wxString value);
 extern void checked_set (PasswordEntry* widget, std::string value);
index ad794226f8adc47640b9eb5ebadf7cc0f47e5377..b5663f81c252f46ac5e1739bfdf77497f592f3ba 100644 (file)
@@ -35,13 +35,13 @@ run (string cmd)
        /* This approximates the logic which splits command lines up into argc/argv */
 
        boost::escaped_list_separator<char> els ("", " ", "\"\'");
-       boost::tokenizer<boost::escaped_list_separator<char> > tok (cmd, els);
+       boost::tokenizer<boost::escaped_list_separator<char>> tok (cmd, els);
 
        std::vector<char*> argv(256);
        int argc = 0;
 
-       for (boost::tokenizer<boost::escaped_list_separator<char> >::iterator i = tok.begin(); i != tok.end(); ++i) {
-               argv[argc++] = strdup (i->c_str());
+       for (auto i: tok) {
+               argv[argc++] = strdup (i.c_str());
        }
 
        CreateCLI cc (argc, argv.data());