Commit 9891f892 authored by Hugo Beauzée-Luyssen's avatar Hugo Beauzée-Luyssen

Use emplace_back instead of push_back

parent 7602f030
......@@ -222,7 +222,7 @@ public:
std::vector<ModuleDescription> res;
while ( p != NULL )
{
res.push_back( ModuleDescription( p ) );
res.emplace_back( p );
p = p->p_next;
}
return res;
......@@ -250,7 +250,7 @@ public:
std::vector<ModuleDescription> res;
while ( p != NULL )
{
res.push_back( ModuleDescription( p ) );
res.emplace_back( p );
p = p->p_next;
}
return res;
......@@ -274,7 +274,7 @@ public:
libvlc_audio_output_t* p = result;
while ( p != NULL )
{
res.push_back( AudioOutputDescription( p ) );
res.emplace_back( p );
p = p->p_next;
}
libvlc_audio_output_list_release(result);
......@@ -310,7 +310,7 @@ public:
if ( devices == NULL )
return res;
for ( libvlc_audio_output_device_t* p = devices; p != NULL; p = p->p_next )
res.push_back( AudioOutputDeviceDescription( p ) );
res.emplace_back( p );
libvlc_audio_output_device_list_release( devices );
return res;
}
......
......@@ -425,7 +425,7 @@ public:
return res;
for ( uint32_t i = 0; i < nbTracks; ++i )
res.push_back( MediaTrack(tracks[i]));
res.emplace_back( tracks[i] );
libvlc_media_tracks_release( tracks, nbTracks );
return res;
}
......
......@@ -816,8 +816,8 @@ public:
std::vector<AudioOutputDeviceDescription> res;
if ( devices == NULL )
return res;
for ( libvlc_audio_output_device_t* p = devices; p != NULL; p = p->p_next )
res.push_back( AudioOutputDeviceDescription( p ) );
for ( auto* p = devices; p != NULL; p = p->p_next )
res.emplace_back( p );
libvlc_audio_output_device_list_release( devices );
return res;
}
......@@ -1643,7 +1643,7 @@ private:
libvlc_track_description_t* p = tracks;
while ( p != NULL )
{
result.push_back( TrackDescription( p ) );
result.emplace_back( p );
p = p->p_next;
}
libvlc_track_description_list_release(tracks);
......
......@@ -28,12 +28,12 @@
#include "common.hpp"
//FIXME:
//Should we make the constructors private again and implement our own vector allocator?
namespace VLC
{
class Instance;
class Media;
class ModuleDescription
{
public:
......@@ -57,7 +57,6 @@ public:
return m_help;
}
private:
explicit ModuleDescription( libvlc_module_description_t* c )
{
if ( c->psz_name != NULL )
......@@ -70,12 +69,11 @@ private:
m_help = c->psz_help;
}
private:
std::string m_name;
std::string m_shortname;
std::string m_longname;
std::string m_help;
friend class Instance;
};
......@@ -183,7 +181,6 @@ public:
return m_encoding;
}
private:
explicit MediaTrack(libvlc_media_track_t* c)
: m_codec( c->i_codec )
, m_originalFourcc( c->i_original_fourcc )
......@@ -224,6 +221,7 @@ private:
}
}
private:
uint32_t m_codec;
uint32_t m_originalFourcc;
uint32_t m_id;
......@@ -245,8 +243,6 @@ private:
uint32_t m_fpsDen;
// Subtitles
std::string m_encoding;
friend class Media;
};
......@@ -263,8 +259,7 @@ public:
return m_description;
}
private:
AudioOutputDescription( libvlc_audio_output_t* c )
explicit AudioOutputDescription( libvlc_audio_output_t* c )
{
if ( c->psz_name != NULL )
m_name = c->psz_name;
......@@ -272,10 +267,9 @@ private:
m_description = c->psz_description;
}
private:
std::string m_name;
std::string m_description;
friend class Instance;
};
class AudioOutputDeviceDescription
......@@ -293,7 +287,6 @@ class AudioOutputDeviceDescription
return m_description;
}
private:
explicit AudioOutputDeviceDescription( libvlc_audio_output_device_t* d )
{
if ( d->psz_device != NULL )
......@@ -302,11 +295,9 @@ class AudioOutputDeviceDescription
m_device = d->psz_description;
}
private:
std::string m_device;
std::string m_description;
friend class Instance;
friend class MediaPlayer;
};
class TrackDescription
......@@ -322,17 +313,16 @@ public:
return m_name;
}
private:
explicit TrackDescription( libvlc_track_description_t* c )
: m_id( c->i_id )
{
if ( c->psz_name != nullptr )
m_name = c->psz_name;
}
private:
int m_id;
std::string m_name;
friend class MediaPlayer;
};
} // namespace VLC
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment