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

📄 clangutil.cpp

📁 2009 ROBOCUP 仿真2DSERVER 源码
💻 CPP
字号:
// -*-c++-*-/***************************************************************************                                  clangutil.cc                       Utility classes for clang messages                             -------------------    begin                : 25-FEB-2002    copyright            : (C) 2002 by The RoboCup Soccer Server                           Maintenance Group.    email                : sserver-admin@lists.sourceforge.net***************************************************************************//*************************************************************************** *                                                                         * *   This program is free software; you can redistribute it and/or modify  * *   it under the terms of the GNU LGPL as published by the Free Software  * *   Foundation; either version 2 of the License, or (at your option) any  * *   later version.                                                        * *                                                                         * ***************************************************************************/#include "clangutil.h"#include <string>namespace rcss {namespace clang {const char* BallMove::TOKEN_STRINGS[] =    { "NONE", "p", "d", "c", "s", "ALL" };const int BallMove::TOKEN_MAX = 4;voidBallMove::addToken( const BallMoveToken & t ){    int i = static_cast< int >( t );    if ( i < 1 || i > TOKEN_MAX )    {        return;    }    if ( i == static_cast< int >( BMT_All ) )    {        M_entries = ~0;    }    else    {        M_entries |= ( 1 << (i-1) );    }}voidBallMove::removeToken( const BallMoveToken & t ){    int i = static_cast< int >( t );    if ( i < 1         || i > TOKEN_MAX )    {        return;    }    if ( i == static_cast< int >( BMT_All ) )    {        clear();    }    else    {        M_entries &= ~( 1 << (i-1) );    }}boolBallMove::isMember( const BallMoveToken & t ) const{    int i = static_cast< int >( t );    if ( i < 1 || i > TOKEN_MAX )    {        return false;    }    if ( i == static_cast< int >( BMT_All ) )    {        return (~(((~0) << ((int)TOKEN_MAX)) | M_entries)) == 0;    }    else    {        return !!(M_entries & (1 << (i-1)));    }}std::ostream &BallMove::print( std::ostream & out ) const{    out << "{";    for ( int i = 1; i <= BallMove::TOKEN_MAX; i++ )    {        if ( isMember( static_cast< BallMoveToken >( i ) ) )        {            out << BallMove::TOKEN_STRINGS[ i ];        }    }    out << "}";    return out;}boolUNumSet::contains( const UNum & unum ) const{    if ( unum.isValid() )    {        // return std::find( M_entries.begin(), M_entries.end(), unum ) != M_entries.end();        for ( container::const_iterator i = M_entries.begin();              i != M_entries.end();              ++i )        {            if ( unum == *i )            {                return true;            }        }    }    return false;}}}

⌨️ 快捷键说明

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