⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 tsmbmusicaplibfunctional.h

📁 索爱手机代码
💻 H
📖 第 1 页 / 共 2 页
字号:
/* Copyright (C) 2006 Sony Ericsson Mobile Communications Japan, Inc. */
/*--------------------------------------------------------------------*/
// FileName:
//	TSmbMusicAPLibFunctional.h
//
// Description:
//	PTX810 Music傾僾儕 儈儏乕僕僢僋傾僾儕儔僀僽儔儕
/*--------------------------------------------------------------------*/
//曄峏棜楌
//擔晅			|曄峏幰			|撪梕
//--------------+---------------+--------------------------------------
//2006/09/23	|SEMC崃绮		|僼傽僀儖僔僗僥儉嫟捠儔僀僽儔儕偐傜愗傝弌偟

/** @file TSmbMusicAPLibFunctional.h
 *  STL 偺 @<functional@> 憡摉丅
 *
 *  $Revision: 1.2 $ $Date: 2006/04/05 17:21:27 $
 */

#ifndef __TSMBMUSICAPLIB_FUNCTIONAL_H__
#define __TSMBMUSICAPLIB_FUNCTIONAL_H__

#include    "SmbMusicAPLibConfig.h"

SEMCJ_NAMESPACE_BEGIN
MUSICAPLIB_NAMESPACE_BEGIN

/**
 *  扨崁娭悢僆僽僕僃僋僩嶌惉梡偺婎掙僋儔僗丅
 *
 *  @param[in]  Arg     堷悢偺宆
 *  @param[in]  Result  栠傝抣偺宆
 */
template<typename Arg, typename Result>
struct TSmbMusicAPLib_unary_function
    {
    typedef Arg     argument_type;  /**< 堷悢偺宆 */
    typedef Result  result_type;    /**< 栠傝抣偺宆 */
    };  // end of struct TSmbMusicAPLib_unary_function

/**
 *  擇崁娭悢僆僽僕僃僋僩嶌惉梡偺婎掙僋儔僗丅
 *
 *  @param[in]  Arg1    堷悢侾偺宆
 *  @param[in]  Arg2    堷悢俀偺宆
 *  @param[in]  Result  栠傝抣偺宆
 */
template<typename Arg1, typename Arg2, typename Result>
struct TSmbMusicAPLib_binary_function
    {
    typedef Arg1    first_argument_type;    /**< 堷悢侾偺宆 */
    typedef Arg2    second_argument_type;   /**< 堷悢俀偺宆 */
    typedef Result  result_type;            /**< 栠傝抣偺宆 */
    };  // end of struct TSmbMusicAPLib_binary_function




/**
 *  @a a1 + @a a2 傪曉偡丅
 */
template <class T>
struct TSmbMusicAPLib_plus : public TSmbMusicAPLib_binary_function<T, T, T>
    {
    T operator()( const T& a1, const T& a2 ) const
        {
        return a1 + a2;
        }
    };

/**
 *  @a a1 - @a a2 傪曉偡丅
 */
template <class T>
struct TSmbMusicAPLib_minus : public TSmbMusicAPLib_binary_function<T, T, T>
    {
    T operator()( const T& a1, const T& a2 ) const
        {
        return a1 - a2;
        }
    };

/**
 *  @a a1 * @a a2 傪曉偡丅
 */
template <class T>
struct TSmbMusicAPLib_multiplies : public TSmbMusicAPLib_binary_function<T, T, T>
    {
    T operator()( const T& a1, const T& a2 ) const
        {
        return a1 * a2;
        }
    };

/**
 *  @a a1 / @a a2 傪曉偡丅
 */
template <class T>
struct TSmbMusicAPLib_divides : public TSmbMusicAPLib_binary_function<T, T, T>
    {
    T operator()( const T& a1, const T& a2 ) const
        {
        return a1 / a2;
        }
    };

/**
 *  @a a1 % @a a2 傪曉偡丅
 */
template <class T>
struct TSmbMusicAPLib_modulus : public TSmbMusicAPLib_binary_function<T, T, T>
    {
    T operator()( const T& a1, const T& a2 ) const
        {
        return a1 % a2;
        }
    };

/**
 *  - @a a1 傪曉偡丅
 */
template <class T>
struct TSmbMusicAPLib_negate : public TSmbMusicAPLib_unary_function<T, T>
    {
    T operator()( const T& a1 ) const
        {
        return -a1;
        }
    };




/**
 *  @a a1 == @a a2 傪曉偡丅
 */
template<class T>
struct TSmbMusicAPLib_equal_to : public TSmbMusicAPLib_binary_function<T, T, TBool>
    {
    TBool operator()( const T& a1, const T& a2 ) const
        {
        return a1 == a2;
        }
    };

/**
 *  @a a1 != @a a2 傪曉偡丅
 */
template<class T>
struct TSmbMusicAPLib_not_equal_to : public TSmbMusicAPLib_binary_function<T, T, TBool>
    {
    TBool operator()( const T& a1, const T& a2 ) const
        {
        return a1 != a2;
        }
    };

/**
 *  @a a1 > @a a2 傪曉偡丅
 */
template<class T>
struct TSmbMusicAPLib_greater : public TSmbMusicAPLib_binary_function<T, T, TBool>
    {
    TBool operator()( const T& a1, const T& a2 ) const
        {
        return a1 > a2;
        }
    };

/**
 *  @a a1 < @a a2 傪曉偡丅
 */
template<class T>
struct TSmbMusicAPLib_less : public TSmbMusicAPLib_binary_function<T, T, TBool>
    {
    TBool operator()( const T& a1, const T& a2 ) const
        {
        return a1 < a2;
        }
    };

/**
 *  @a a1 >= @a a2 傪曉偡丅
 */
template<class T>
struct TSmbMusicAPLib_greater_equal : public TSmbMusicAPLib_binary_function<T, T, TBool>
    {
    TBool operator()( const T& a1, const T& a2 ) const
        {
        return a1 >= a2;
        }
    };

/**
 *  @a a1 <= @a a2 傪曉偡丅
 */
template<class T>
struct TSmbMusicAPLib_less_equal : public TSmbMusicAPLib_binary_function<T, T, TBool>
    {
    TBool operator()( const T& a1, const T& a2 ) const
        {
        return a1 <= a2;
        }
    };

/**
 *  @a a1 && @a a2 傪曉偡丅
 */
template<class T>
struct TSmbMusicAPLib_logical_and : public TSmbMusicAPLib_binary_function<T, T, TBool>
    {
    TBool operator()( const T& a1, const T& a2 ) const
        {
        return a1 && a2;
        }
    };

/**
 *  @a a1 || @a a2 傪曉偡丅
 */
template<class T>
struct TSmbMusicAPLib_logical_or : public TSmbMusicAPLib_binary_function<T, T, TBool>
    {
    TBool operator()( const T& a1, const T& a2 ) const
        {
        return a1 || a2;
        }
    };

/**
 *  @a !a1 傪曉偡丅
 */
template<class T>
struct TSmbMusicAPLib_logical_not : public TSmbMusicAPLib_unary_function<T, TBool>
    {
    TBool operator()( const T& a1 ) const
        {
        return !a1;
        }
    };




/**
 *  扨崁弎岅偺寢壥傪斀揮偝偣傞僱僎乕僞丅
 */
template <class Predicate>
class TSmbMusicAPLib_unary_negate : public TSmbMusicAPLib_unary_function<typename Predicate::argument_type, TBool>
    {
public:
    explicit TSmbMusicAPLib_unary_negate( const Predicate& aPred ) : iPred(aPred) {}
    TBool operator()( const typename Predicate::argument_type& a1 ) const
        {
        return !iPred(a1);
        }
protected:
    Predicate iPred;
    };
/**
 *  僱僎乕僞傪曉偡僿儖僷乕丅
 *
 *  @param[in]  aPred   扨崁弎岅丅
 *  @return @a aPred 偺寢壥傪斀揮偝偣傞僱僎乕僞丅
 */
template <class Predicate>
inline TSmbMusicAPLib_unary_negate<Predicate> Not1( const Predicate& aPred )
    {
    return TSmbMusicAPLib_unary_negate<Predicate>( aPred );
    }

/**
 *  擇崁弎岅偺寢壥傪斀揮偝偣傞僱僎乕僞丅
 */
template <class Predicate>
class TSmbMusicAPLib_binary_negate : public TSmbMusicAPLib_binary_function<typename Predicate::first_argument_type, typename Predicate::second_argument_type, TBool>
    {
public:
    explicit TSmbMusicAPLib_binary_negate( const Predicate& aPred ) : iPred(aPred) {}
    TBool operator()( const typename Predicate::first_argument_type& a1, const typename Predicate::second_argument_type& a2 ) const
        {
        return !iPred(a1, a2);
        }
protected:
    Predicate iPred;
    };
/**
 *  僱僎乕僞傪曉偡僿儖僷乕丅
 *
 *  @param[in]  aPred   擇崁弎岅丅
 *  @return @a aPred 偺寢壥傪斀揮偝偣傞僱僎乕僞丅
 */
template <class Predicate>
inline TSmbMusicAPLib_binary_negate<Predicate> Not2( const Predicate& aPred )
    {
    return TSmbMusicAPLib_binary_negate<Predicate>( aPred );
    }




/**
 *  擇崁娭悢偺戞侾堷悢傪巜掕偡傞偨傔偺僶僀儞僟丅
 */
template <class Operation>
class TSmbMusicAPLib_binder1st : public TSmbMusicAPLib_unary_function<typename Operation::second_argument_type, typename Operation::result_type>
    {
public:
    TSmbMusicAPLib_binder1st( const Operation& aOp, const typename Operation::first_argument_type& aArg ) : iOp(aOp), iArg(aArg) {}
    typename Operation::result_type operator()( const typename Operation::second_argument_type& a1 ) const
        {
        return iOp(iArg, a1);
        }
    typename Operation::result_type operator()( typename Operation::second_argument_type& a1 ) const
        {
        return iOp(iArg, a1);
        }
protected:
    Operation iOp;
    typename Operation::first_argument_type iArg;
    };
/**
 *  僶僀儞僟傪曉偡僿儖僷乕丅
 *
 *  @param[in]  aOp 擇崁娭悢丅
 *  @param[in]  aArg   @a aOp 偺戞侾堷悢偵僶僀儞僪偡傞抣丅
 *  @return @a aOp 傪扨崁娭悢偱偁傞偐偺傛偆偵尒偣傞僶僀儞僟丅
 */
template <class Operation, class T>
inline TSmbMusicAPLib_binder1st<Operation> Bind1st( const Operation& aOp, const T& aArg )
    {
    typedef typename Operation::first_argument_type Arg1_type;
    return TSmbMusicAPLib_binder1st<Operation>( aOp, Arg1_type(aArg) );
    }

/**
 *  擇崁娭悢偺戞俀堷悢傪巜掕偡傞偨傔偺僶僀儞僟丅
 */
template <class Operation>
class TSmbMusicAPLib_binder2nd : public TSmbMusicAPLib_unary_function<typename Operation::first_argument_type, typename Operation::result_type>
    {
public:
    TSmbMusicAPLib_binder2nd( const Operation& aOp, const typename Operation::second_argument_type& aArg ) : iOp(aOp), iArg(aArg) {}
    typename Operation::result_type operator()( const typename Operation::first_argument_type& a1 ) const
        {
        return iOp(a1, iArg);
        }
    typename Operation::result_type operator()( typename Operation::first_argument_type& a1 ) const
        {
        return iOp(a1, iArg);
        }
protected:
    Operation iOp;
    typename Operation::second_argument_type iArg;
    };
/**
 *  僶僀儞僟傪曉偡僿儖僷乕丅
 *
 *  @param[in]  aOp 擇崁娭悢丅
 *  @param[in]  aArg   @a aOp 偺戞俀堷悢偵僶僀儞僪偡傞抣丅
 *  @return @a aOp 傪扨崁娭悢偱偁傞偐偺傛偆偵尒偣傞僶僀儞僟丅
 */
template <class Operation, class T>
inline TSmbMusicAPLib_binder2nd<Operation> Bind2nd(const Operation& aOp, const T& aArg )
    {
    typedef typename Operation::second_argument_type Arg2_type;
    return TSmbMusicAPLib_binder2nd<Operation>( aOp, Arg2_type(aArg) );
    }




/**
 *  扨崁娭悢傾僟僾僞丅
 *
 *  偨偩偺娭悢傪丄娭悢僆僽僕僃僋僩偲偟偰巊偊傞傛偆偵揔崌偝偣傞丅
 */
template <class Arg, class Result>
class TSmbMusicAPLib_pointer_to_unary_function : public TSmbMusicAPLib_unary_function<Arg, Result>
    {
public:
    TSmbMusicAPLib_pointer_to_unary_function() : iPtr(NULL) {}
    explicit TSmbMusicAPLib_pointer_to_unary_function( Result (*aPtr)(Arg) ) : iPtr(aPtr) {}
    Result operator()( Arg a1 ) const
        {
        return iPtr(a1);
        }
protected:
    Result (*iPtr)(Arg);
    };
/**
 *  扨崁娭悢傾僟僾僞傪曉偡僿儖僷乕丅
 *
 *  @param[in]  aPtr    扨崁娭悢傊偺億僀儞僞丅
 *  @return @a aPtr 傪娭悢僆僽僕僃僋僩偱偁傞偐偺傛偆偵尒偣傞傾僟僾僞丅
 */
template <class Arg, class Result>
inline TSmbMusicAPLib_pointer_to_unary_function<Arg, Result> Ptr_fun( Result (*aPtr)(Arg) )
    {
    return TSmbMusicAPLib_pointer_to_unary_function<Arg, Result>( aPtr );
    }

/**
 *  擇崁娭悢傾僟僾僞丅
 *
 *  偨偩偺娭悢傪丄娭悢僆僽僕僃僋僩偲偟偰巊偊傞傛偆偵揔崌偝偣傞丅
 */
template <class Arg1, class Arg2, class Result>
class TSmbMusicAPLib_pointer_to_binary_function : public TSmbMusicAPLib_binary_function<Arg1, Arg2, Result>
    {
public:
    TSmbMusicAPLib_pointer_to_binary_function() : iPtr(NULL) {}
    explicit TSmbMusicAPLib_pointer_to_binary_function( Result (*aPtr)(Arg1, Arg2) ) : iPtr(aPtr) {}
    Result operator()( Arg1 a1, Arg2 a2 ) const
        {
        return iPtr(a1, a2);
        }
protected:
    Result (*iPtr)(Arg1, Arg2);
    };
/**
 *  擇崁娭悢傾僟僾僞傪曉偡僿儖僷乕丅
 *
 *  @param[in]  aPtr    擇崁娭悢傊偺億僀儞僞丅
 *  @return @a aPtr 傪娭悢僆僽僕僃僋僩偱偁傞偐偺傛偆偵尒偣傞傾僟僾僞丅
 */
template <class Arg1, class Arg2, class Result>
inline TSmbMusicAPLib_pointer_to_binary_function<Arg1, Arg2, Result> Ptr_fun( Result (*aPtr)(Arg1, Arg2) )
    {
    return TSmbMusicAPLib_pointer_to_binary_function<Arg1, Arg2, Result>( aPtr );
    }




/**
 *  儊儞僶娭悢傾僟僾僞丅
 *
 *  億僀儞僞丒堷悢側偟丒旕const丒栠傝抣偁傝
 */
template <class Result, class T>
class TSmbMusicAPLib_mem_fun_t : public TSmbMusicAPLib_unary_function<T*, Result>
    {
public:
    explicit TSmbMusicAPLib_mem_fun_t( Result (T::*aOp)() ) : iOp(aOp) {}
    Result operator()( T* aPtr ) const
        {
        return (aPtr->*iOp)();
        }
private:
    Result (T::*iOp)();
    };
/**
 *  儊儞僶娭悢傾僟僾僞丅
 *
 *  億僀儞僞丒堷悢側偟丒const丒栠傝抣偁傝
 */
template <class Result, class T>
class TSmbMusicAPLib_const_mem_fun_t : public TSmbMusicAPLib_unary_function<const T*, Result>
    {
public:
    explicit TSmbMusicAPLib_const_mem_fun_t( Result (T::*aOp)() const ) : iOp(aOp) {}
    Result operator()( const T* aPtr ) const
        {
        return (aPtr->*iOp)();
        }
private:
    Result (T::*iOp)() const;
    };

/**

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -