diff --git a/src/apps/cortex/NodeManager/NodeGroup.cpp b/src/apps/cortex/NodeManager/NodeGroup.cpp index d635a6a6bc..af4e613ccb 100644 --- a/src/apps/cortex/NodeManager/NodeGroup.cpp +++ b/src/apps/cortex/NodeManager/NodeGroup.cpp @@ -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 diff --git a/src/apps/cortex/NodeManager/NodeManager.cpp b/src/apps/cortex/NodeManager/NodeManager.cpp index 9d1a072460..737c150097 100644 --- a/src/apps/cortex/NodeManager/NodeManager.cpp +++ b/src/apps/cortex/NodeManager/NodeManager.cpp @@ -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 { -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 { -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 { +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] diff --git a/src/apps/cortex/NodeManager/NodeRef.cpp b/src/apps/cortex/NodeManager/NodeRef.cpp index 1d696b921c..21926080e8 100644 --- a/src/apps/cortex/NodeManager/NodeRef.cpp +++ b/src/apps/cortex/NodeManager/NodeRef.cpp @@ -814,7 +814,7 @@ status_t NodeRef::findOutput( // endpoint matching (given name and/or format as 'hints') template -class match_endpoint_name_format : public unary_function { +class match_endpoint_name_format { public: const char* name; const media_format* format; @@ -835,7 +835,7 @@ public: }; template -class match_endpoint_name_type : public unary_function { +class match_endpoint_name_type { public: const char* name; media_type type; @@ -856,7 +856,7 @@ public: }; template -class match_endpoint_type : public unary_function { +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(filterType))); + back_insert_iterator > inserter = back_inserter(ioInputs); + for (int i = 0; i < count; i++) { + if (match_endpoint_type(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(filterType))); + back_insert_iterator > inserter = back_inserter(ioOutputs); + for (int i = 0; i < count; i++) { + if (match_endpoint_type(filterType)(outputBuffer[i])) { + *inserter++ = outputBuffer[i]; + } + } + } break; } @@ -1530,7 +1538,7 @@ NodeRef::NodeRef( // -------------------------------------------------------- // template -class fixEndpointFn : public unary_function { +class fixEndpointFn { const media_node& node; public: fixEndpointFn(const media_node& _n) : node(_n) {} diff --git a/src/apps/cortex/Persistence/XMLElementMapping.h b/src/apps/cortex/Persistence/XMLElementMapping.h index ab86771003..c819f0ae88 100644 --- a/src/apps/cortex/Persistence/XMLElementMapping.h +++ b/src/apps/cortex/Persistence/XMLElementMapping.h @@ -81,7 +81,7 @@ public: }; // compare pointers to Mappings by element name -struct _mapping_ptr_less : public std::binary_function { +struct _mapping_ptr_less { public: bool operator()(const XMLElementMapping* a, const XMLElementMapping* b) const { return a->element < b->element; diff --git a/src/apps/cortex/ValControl/ValControl.cpp b/src/apps/cortex/ValControl/ValControl.cpp index cf2c1b0d4f..0526500785 100644 --- a/src/apps/cortex/ValControl/ValControl.cpp +++ b/src/apps/cortex/ValControl/ValControl.cpp @@ -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(); } diff --git a/src/apps/cortex/support/functional_tools.h b/src/apps/cortex/support/functional_tools.h index 39583b0da8..5f1d852adb 100644 --- a/src/apps/cortex/support/functional_tools.h +++ b/src/apps/cortex/support/functional_tools.h @@ -59,7 +59,7 @@ __BEGIN_CORTEX_NAMESPACE // 27jul99: functor adaptor "call a given method of a given object with argument" template -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 bound_const_method_t : public std::unary_function { +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 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 bound_const_method_ref_t : public std::unary_function { +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 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 bound_const_method1_t : public std::binary_function { +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 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 bound_const_method_ref1_t : public std::binary_function { +class bound_const_method_ref1_t { public: explicit bound_const_method_ref1_t( // the bound instance on which the method will be called diff --git a/src/apps/cortex/support/set_tools.h b/src/apps/cortex/support/set_tools.h index 23fce8ee0b..2ad13e291f 100644 --- a/src/apps/cortex/support/set_tools.h +++ b/src/apps/cortex/support/set_tools.h @@ -67,9 +67,8 @@ void ptr_map_delete(iter begin, iter end) { // a simple equality-test functor for maps template -class map_value_equal_to : - public std::binary_function, value, bool> { - +class map_value_equal_to +{ public: bool operator()(const std::pair& 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 unary_map_function_t : - public std::unary_function { +class unary_map_function_t +{ opT f;