Cortex: remove use of deprecated C++ features
Change-Id: I174bf8a5224b53370c3dd5f7dc152885ff0ec985 Reviewed-on: https://review.haiku-os.org/c/haiku/+/6800 Reviewed-by: Fredrik Holmqvist <fredrik.holmqvist@gmail.com> Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
This commit is contained in:
parent
6308236831
commit
7b2f246e69
@ -632,10 +632,14 @@ status_t NodeGroup::setTimeSource(
|
||||
for_each(
|
||||
m_nodes.begin(),
|
||||
m_nodes.end(),
|
||||
#if __GNUC__ <= 2
|
||||
bind2nd(
|
||||
mem_fun(&NodeRef::_setTimeSource),
|
||||
m_timeSource.node
|
||||
)
|
||||
#else
|
||||
[this](NodeRef* nodeRef) { nodeRef->_setTimeSource(m_timeSource.node); }
|
||||
#endif
|
||||
);
|
||||
|
||||
// // try to set as sync node
|
||||
@ -680,10 +684,14 @@ status_t NodeGroup::setRunMode(BMediaNode::run_mode mode) {
|
||||
for_each(
|
||||
m_nodes.begin(),
|
||||
m_nodes.end(),
|
||||
#if __GNUC__ <= 2
|
||||
bind2nd(
|
||||
mem_fun(&NodeRef::_setRunModeAuto),
|
||||
m_runMode
|
||||
)
|
||||
#else
|
||||
[this](NodeRef* ref) { ref->_setRunModeAuto(this->m_runMode); }
|
||||
#endif
|
||||
// bound_method(
|
||||
// *this,
|
||||
// &NodeGroup::setRunModeFor)
|
||||
@ -1260,7 +1268,11 @@ status_t NodeGroup::_stop() {
|
||||
for_each(
|
||||
m_nodes.begin(),
|
||||
m_nodes.end(),
|
||||
#if __GNUC__ <= 2
|
||||
mem_fun(&NodeRef::_stop)
|
||||
#else
|
||||
[](NodeRef* ref) { ref->_stop(); }
|
||||
#endif
|
||||
);
|
||||
|
||||
// update transport state
|
||||
|
@ -782,69 +782,43 @@ NodeGroup* NodeManager::groupAt(
|
||||
// look up a group by unique ID; returns B_BAD_VALUE if no
|
||||
// matching group was found
|
||||
|
||||
class match_group_by_id :
|
||||
public binary_function<const NodeGroup*, uint32, bool> {
|
||||
public:
|
||||
bool operator()(const NodeGroup* group, uint32 id) const {
|
||||
return group->id() == id;
|
||||
}
|
||||
};
|
||||
|
||||
status_t NodeManager::findGroup(
|
||||
uint32 id,
|
||||
NodeGroup** outGroup) const {
|
||||
status_t NodeManager::findGroup(uint32 id, NodeGroup** outGroup) const
|
||||
{
|
||||
Autolock _l(this);
|
||||
D_METHOD((
|
||||
"NodeManager::findGroup(id)\n"));
|
||||
D_METHOD(("NodeManager::findGroup(id)\n"));
|
||||
|
||||
node_group_set::const_iterator it =
|
||||
find_if(
|
||||
m_nodeGroupSet.begin(),
|
||||
m_nodeGroupSet.end(),
|
||||
bind2nd(match_group_by_id(), id)
|
||||
);
|
||||
|
||||
if(it == m_nodeGroupSet.end()) {
|
||||
*outGroup = 0;
|
||||
return B_BAD_VALUE;
|
||||
node_group_set::const_iterator it;
|
||||
for (it = m_nodeGroupSet.begin(); it != m_nodeGroupSet.end(); it++)
|
||||
{
|
||||
if ((*it)->id() == id) {
|
||||
*outGroup = *it;
|
||||
return B_OK;
|
||||
}
|
||||
}
|
||||
|
||||
*outGroup = *it;
|
||||
return B_OK;
|
||||
*outGroup = 0;
|
||||
return B_BAD_VALUE;
|
||||
}
|
||||
|
||||
// look up a group by name; returns B_NAME_NOT_FOUND if
|
||||
// no group matching the name was found.
|
||||
|
||||
class match_group_by_name :
|
||||
public binary_function<const NodeGroup*, const char*, bool> {
|
||||
public:
|
||||
bool operator()(const NodeGroup* group, const char* name) const {
|
||||
return !strcmp(group->name(), name);
|
||||
}
|
||||
};
|
||||
|
||||
status_t NodeManager::findGroup(
|
||||
const char* name,
|
||||
NodeGroup** outGroup) const {
|
||||
status_t NodeManager::findGroup(const char* name, NodeGroup** outGroup) const
|
||||
{
|
||||
Autolock _l(this);
|
||||
D_METHOD((
|
||||
"NodeManager::findGroup(name)\n"));
|
||||
D_METHOD(("NodeManager::findGroup(name)\n"));
|
||||
|
||||
node_group_set::const_iterator it =
|
||||
find_if(
|
||||
m_nodeGroupSet.begin(),
|
||||
m_nodeGroupSet.end(),
|
||||
bind2nd(match_group_by_name(), name)
|
||||
);
|
||||
|
||||
if(it == m_nodeGroupSet.end()) {
|
||||
*outGroup = 0;
|
||||
return B_BAD_VALUE;
|
||||
node_group_set::const_iterator it;
|
||||
for (it = m_nodeGroupSet.begin(); it != m_nodeGroupSet.end(); it++)
|
||||
{
|
||||
if (strcmp((*it)->name(), name) == 0) {
|
||||
*outGroup = *it;
|
||||
return B_OK;
|
||||
}
|
||||
}
|
||||
|
||||
*outGroup = *it;
|
||||
return B_OK;
|
||||
*outGroup = 0;
|
||||
return B_BAD_VALUE;
|
||||
}
|
||||
|
||||
// merge the given source group to the given destination;
|
||||
@ -895,8 +869,7 @@ status_t NodeManager::mergeGroups(
|
||||
// was split successfully.
|
||||
|
||||
|
||||
class _changeNodeGroupFn :
|
||||
public unary_function<NodeRef*, void> {
|
||||
class _changeNodeGroupFn {
|
||||
public:
|
||||
NodeGroup* newGroup;
|
||||
|
||||
@ -2527,7 +2500,11 @@ inline void NodeManager::_updateLatenciesFrom(
|
||||
origin,
|
||||
0, // all groups
|
||||
recurse,
|
||||
#if __GNUC__ <= 2
|
||||
mem_fun(&NodeRef::_updateLatency),
|
||||
#else
|
||||
[](NodeRef* node) { return node->_updateLatency(); },
|
||||
#endif
|
||||
&st);
|
||||
|
||||
_unlockAllGroups(); // [e.moon 13oct99]
|
||||
|
@ -814,7 +814,7 @@ status_t NodeRef::findOutput(
|
||||
// endpoint matching (given name and/or format as 'hints')
|
||||
|
||||
template <class T>
|
||||
class match_endpoint_name_format : public unary_function<T, bool> {
|
||||
class match_endpoint_name_format {
|
||||
public:
|
||||
const char* name;
|
||||
const media_format* format;
|
||||
@ -835,7 +835,7 @@ public:
|
||||
};
|
||||
|
||||
template <class T>
|
||||
class match_endpoint_name_type : public unary_function<T, bool> {
|
||||
class match_endpoint_name_type {
|
||||
public:
|
||||
const char* name;
|
||||
media_type type;
|
||||
@ -856,7 +856,7 @@ public:
|
||||
};
|
||||
|
||||
template <class T>
|
||||
class match_endpoint_type : public unary_function<T, bool> {
|
||||
class match_endpoint_type {
|
||||
public:
|
||||
media_type type;
|
||||
|
||||
@ -1053,11 +1053,15 @@ status_t NodeRef::getConnectedInputs(
|
||||
continue;
|
||||
}
|
||||
|
||||
if (count)
|
||||
if (count) {
|
||||
// copy found inputs matching the given type into vector
|
||||
remove_copy_if(inputBuffer, inputBuffer + count,
|
||||
back_inserter(ioInputs),
|
||||
not1(match_endpoint_type<media_input>(filterType)));
|
||||
back_insert_iterator<std::vector<media_input> > inserter = back_inserter(ioInputs);
|
||||
for (int i = 0; i < count; i++) {
|
||||
if (match_endpoint_type<media_input>(filterType)(inputBuffer[i])) {
|
||||
*inserter++ = inputBuffer[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
@ -1140,11 +1144,15 @@ status_t NodeRef::getConnectedOutputs(
|
||||
continue;
|
||||
}
|
||||
|
||||
if (count)
|
||||
if (count) {
|
||||
// copy found outputs matching the given type into vector
|
||||
remove_copy_if(outputBuffer, outputBuffer + count,
|
||||
back_inserter(ioOutputs),
|
||||
not1(match_endpoint_type<media_output>(filterType)));
|
||||
back_insert_iterator<std::vector<media_output> > inserter = back_inserter(ioOutputs);
|
||||
for (int i = 0; i < count; i++) {
|
||||
if (match_endpoint_type<media_output>(filterType)(outputBuffer[i])) {
|
||||
*inserter++ = outputBuffer[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
@ -1530,7 +1538,7 @@ NodeRef::NodeRef(
|
||||
// -------------------------------------------------------- //
|
||||
|
||||
template <class T>
|
||||
class fixEndpointFn : public unary_function<T&, void> {
|
||||
class fixEndpointFn {
|
||||
const media_node& node;
|
||||
public:
|
||||
fixEndpointFn(const media_node& _n) : node(_n) {}
|
||||
|
@ -81,7 +81,7 @@ public:
|
||||
};
|
||||
|
||||
// compare pointers to Mappings by element name
|
||||
struct _mapping_ptr_less : public std::binary_function<XMLElementMapping*,XMLElementMapping*,bool> {
|
||||
struct _mapping_ptr_less {
|
||||
public:
|
||||
bool operator()(const XMLElementMapping* a, const XMLElementMapping* b) const {
|
||||
return a->element < b->element;
|
||||
|
@ -263,7 +263,12 @@ ValControl::AllAttached()
|
||||
pWnd->BeginViewTransaction();
|
||||
|
||||
for_each(fLayoutSet.begin(), fLayoutSet.end(),
|
||||
ptr_fun(&ValCtrlLayoutEntry::InitChildFrame)); // +++++?
|
||||
#if __GNUC__ <= 2
|
||||
ptr_fun(&ValCtrlLayoutEntry::InitChildFrame)
|
||||
#else
|
||||
[](ValCtrlLayoutEntry& entry) { ValCtrlLayoutEntry::InitChildFrame(entry); }
|
||||
#endif
|
||||
);
|
||||
|
||||
pWnd->EndViewTransaction();
|
||||
}
|
||||
|
@ -59,7 +59,7 @@ __BEGIN_CORTEX_NAMESPACE
|
||||
|
||||
// 27jul99: functor adaptor "call a given method of a given object with argument"
|
||||
template<class _retT, class _subjectT, class _objectT>
|
||||
class bound_method_t : public std::unary_function<_objectT*, _retT> {
|
||||
class bound_method_t {
|
||||
public:
|
||||
explicit bound_method_t(
|
||||
// the bound instance on which the method will be called
|
||||
@ -78,7 +78,7 @@ private:
|
||||
|
||||
// 27jul99: functor adaptor "call a given method of a given object with argument"
|
||||
template<class _retT, class _subjectT, class _objectT>
|
||||
class bound_const_method_t : public std::unary_function<const _objectT*, _retT> {
|
||||
class bound_const_method_t {
|
||||
public:
|
||||
explicit bound_const_method_t(
|
||||
// the bound instance on which the method will be called
|
||||
@ -96,7 +96,7 @@ private:
|
||||
};
|
||||
|
||||
template<class _retT, class _subjectT, class _objectT>
|
||||
class bound_method_ref_t : public std::unary_function<_objectT&, _retT> {
|
||||
class bound_method_ref_t {
|
||||
public:
|
||||
explicit bound_method_ref_t(
|
||||
// the bound instance on which the method will be called
|
||||
@ -114,7 +114,7 @@ private:
|
||||
};
|
||||
|
||||
template<class _retT, class _subjectT, class _objectT>
|
||||
class bound_const_method_ref_t : public std::unary_function<const _objectT&, _retT> {
|
||||
class bound_const_method_ref_t {
|
||||
public:
|
||||
explicit bound_const_method_ref_t(
|
||||
// the bound instance on which the method will be called
|
||||
@ -136,7 +136,7 @@ private:
|
||||
// 27jul99: functor adaptor "call a given method of a given object with argument"
|
||||
// + an additional argument
|
||||
template<class _retT, class _subjectT, class _objectT, class _arg1T>
|
||||
class bound_method1_t : public std::binary_function<_objectT*,_arg1T,_retT> {
|
||||
class bound_method1_t {
|
||||
public:
|
||||
explicit bound_method1_t(
|
||||
// the bound instance on which the method will be called
|
||||
@ -156,7 +156,7 @@ private:
|
||||
|
||||
// 27jul99: functor adaptor "call a given method of a given object with argument"
|
||||
template<class _retT, class _subjectT, class _objectT, class _arg1T>
|
||||
class bound_const_method1_t : public std::binary_function<const _objectT*,_arg1T,_retT> {
|
||||
class bound_const_method1_t {
|
||||
public:
|
||||
explicit bound_const_method1_t(
|
||||
// the bound instance on which the method will be called
|
||||
@ -174,7 +174,7 @@ private:
|
||||
};
|
||||
|
||||
template<class _retT, class _subjectT, class _objectT, class _arg1T>
|
||||
class bound_method_ref1_t : public std::binary_function<_objectT&,_arg1T,_retT> {
|
||||
class bound_method_ref1_t {
|
||||
public:
|
||||
explicit bound_method_ref1_t(
|
||||
// the bound instance on which the method will be called
|
||||
@ -192,7 +192,7 @@ private:
|
||||
};
|
||||
|
||||
template<class _retT, class _subjectT, class _objectT, class _arg1T>
|
||||
class bound_const_method_ref1_t : public std::binary_function<const _objectT&,_arg1T,_retT> {
|
||||
class bound_const_method_ref1_t {
|
||||
public:
|
||||
explicit bound_const_method_ref1_t(
|
||||
// the bound instance on which the method will be called
|
||||
|
@ -67,9 +67,8 @@ void ptr_map_delete(iter begin, iter end) {
|
||||
|
||||
// a simple equality-test functor for maps
|
||||
template<class key, class value>
|
||||
class map_value_equal_to :
|
||||
public std::binary_function<std::pair<key,value>, value, bool> {
|
||||
|
||||
class map_value_equal_to
|
||||
{
|
||||
public:
|
||||
bool operator()(const std::pair<key,value>& p, const value& v) const {
|
||||
return p.second == v;
|
||||
@ -109,8 +108,8 @@ void map_value_copy(input_iter begin, input_iter end, output_iter to) {
|
||||
|
||||
// adapt a unary functor to a map (eek)
|
||||
template <class pairT, class opT>
|
||||
class unary_map_function_t :
|
||||
public std::unary_function<typename opT::argument_type, typename opT::result_type> {
|
||||
class unary_map_function_t
|
||||
{
|
||||
|
||||
opT f;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user