From 8ba83e91bf8457fd9cf3110538fc278c426c0dc0 Mon Sep 17 00:00:00 2001 From: Dave Reisner Date: Mon, 6 Jun 2016 08:19:27 -0400 Subject: get rid of using std::* statements in headers --- pulse.cc | 45 ++++++++++++++++++++++----------------------- 1 file changed, 22 insertions(+), 23 deletions(-) (limited to 'pulse.cc') diff --git a/pulse.cc b/pulse.cc index fc450ae..ab3f3cf 100644 --- a/pulse.cc +++ b/pulse.cc @@ -8,7 +8,6 @@ #include // C++ -#include #include #include @@ -39,7 +38,7 @@ static void card_info_cb(pa_context* context, } if (!eol) { - vector* cards = static_cast*>(raw); + std::vector* cards = static_cast*>(raw); cards->push_back(info); } } @@ -56,7 +55,7 @@ static void device_info_cb(pa_context* context, } if (!eol) { - vector* devices_ = static_cast*>(raw); + std::vector* devices_ = static_cast*>(raw); devices_->push_back(info); } } @@ -91,7 +90,7 @@ static int xstrtol(const char *str, long *out) { } // anonymous namespace -PulseClient::PulseClient(string client_name) : +PulseClient::PulseClient(std::string client_name) : client_name_(client_name), volume_range_(0, 150), balance_range_(-100, 100), @@ -145,7 +144,7 @@ Card* PulseClient::GetCard(const uint32_t index) { return nullptr; } -Card* PulseClient::GetCard(const string& name) { +Card* PulseClient::GetCard(const std::string& name) { long val; if (xstrtol(name.c_str(), &val) == 0) { return GetCard(val); @@ -161,7 +160,7 @@ Card* PulseClient::GetCard(const Device& device) { return nullptr; } -Device* PulseClient::get_device(vector& devices, +Device* PulseClient::get_device(std::vector& devices, const uint32_t index) { for (Device& device : devices) { if (device.index_ == index) return &device; @@ -169,7 +168,7 @@ Device* PulseClient::get_device(vector& devices, return nullptr; } -Device* PulseClient::get_device(vector& devices, const string& name) { +Device* PulseClient::get_device(std::vector& devices, const std::string& name) { long val; if (xstrtol(name.c_str(), &val) == 0) { return get_device(devices, val); @@ -193,7 +192,7 @@ Device* PulseClient::GetDevice(const uint32_t index, enum DeviceType type) { throw unreachable(); } -Device* PulseClient::GetDevice(const string& name, enum DeviceType type) { +Device* PulseClient::GetDevice(const std::string& name, enum DeviceType type) { switch (type) { case DEVTYPE_SINK: return GetSink(name); @@ -208,7 +207,7 @@ Device* PulseClient::GetDevice(const string& name, enum DeviceType type) { throw unreachable(); } -const vector& PulseClient::GetDevices(enum DeviceType type) const { +const std::vector& PulseClient::GetDevices(enum DeviceType type) const { switch (type) { case DEVTYPE_SINK: return GetSinks(); @@ -227,7 +226,7 @@ Device* PulseClient::GetSink(const uint32_t index) { return get_device(sinks_, index); } -Device* PulseClient::GetSink(const string& name) { +Device* PulseClient::GetSink(const std::string& name) { return get_device(sinks_, name); } @@ -235,7 +234,7 @@ Device* PulseClient::GetSource(const uint32_t index) { return get_device(sources_, index); } -Device* PulseClient::GetSource(const string& name) { +Device* PulseClient::GetSource(const std::string& name) { return get_device(sources_, name); } @@ -243,7 +242,7 @@ Device* PulseClient::GetSinkInput(const uint32_t index) { return get_device(sink_inputs_, index); } -Device* PulseClient::GetSinkInput(const string& name) { +Device* PulseClient::GetSinkInput(const std::string& name) { return get_device(sink_inputs_, name); } @@ -251,7 +250,7 @@ Device* PulseClient::GetSourceOutput(const uint32_t index) { return get_device(source_outputs_, index); } -Device* PulseClient::GetSourceOutput(const string& name) { +Device* PulseClient::GetSourceOutput(const std::string& name) { return get_device(source_outputs_, name); } @@ -263,11 +262,11 @@ void PulseClient::mainloop_iterate(pa_operation* op) { } template -T* PulseClient::find_fuzzy(vector& haystack, const string& needle) { - vector res; +T* PulseClient::find_fuzzy(std::vector& haystack, const std::string& needle) { + std::vector res; for (T& item : haystack) { - if (item.name_.find(needle) != string::npos) res.push_back(&item); + if (item.name_.find(needle) != std::string::npos) res.push_back(&item); } switch (res.size()) { @@ -283,7 +282,7 @@ T* PulseClient::find_fuzzy(vector& haystack, const string& needle) { } void PulseClient::populate_cards() { - vector cards; + std::vector cards; pa_operation* op = pa_context_get_card_info_list(context_, card_info_cb, static_cast(&cards)); @@ -303,13 +302,13 @@ void PulseClient::populate_server_info() { } void PulseClient::populate_sinks() { - vector sinks; + std::vector sinks; pa_operation* op = pa_context_get_sink_info_list( context_, device_info_cb, static_cast(&sinks)); mainloop_iterate(op); pa_operation_unref(op); - vector sink_inputs; + std::vector sink_inputs; op = pa_context_get_sink_input_info_list( context_, device_info_cb, static_cast(&sink_inputs)); mainloop_iterate(op); @@ -321,13 +320,13 @@ void PulseClient::populate_sinks() { } void PulseClient::populate_sources() { - vector sources; + std::vector sources; pa_operation* op = pa_context_get_source_info_list( context_, device_info_cb, static_cast(&sources)); mainloop_iterate(op); pa_operation_unref(op); - vector source_outputs; + std::vector source_outputs; op = pa_context_get_source_output_info_list( context_, device_info_cb, static_cast(&source_outputs)); mainloop_iterate(op); @@ -441,7 +440,7 @@ int PulseClient::GetBalance(const Device& device) const { return device.Balance(); } -bool PulseClient::SetProfile(Card& card, const string& profile) { +bool PulseClient::SetProfile(Card& card, const std::string& profile) { int success; pa_operation* op = pa_context_set_card_profile_by_index(context_, @@ -537,7 +536,7 @@ bool PulseClient::SetDefault(Device& device) { } void PulseClient::remove_device(Device& device) { - vector* devlist; + std::vector* devlist; switch (device.type_) { case DEVTYPE_SINK: -- cgit v1.2.3