• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ getUsage函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中getUsage函数的典型用法代码示例。如果您正苦于以下问题:C++ getUsage函数的具体用法?C++ getUsage怎么用?C++ getUsage使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了getUsage函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: parseCommandLine

static int
parseCommandLine( int argc, const char ** argv )
{
    int c;
    const char * optarg;

    while(( c = tr_getopt( getUsage( ), argc, argv, options, &optarg )))
    {
        switch( c )
        {
            case 'a': add = optarg;
                      break;
            case 'd': deleteme = optarg;
                      break;
            case 'r': replace[0] = optarg;
                      c = tr_getopt( getUsage( ), argc, argv, options, &optarg );
                      if( c != TR_OPT_UNK ) return 1;
                      replace[1] = optarg;
                      break;
            case TR_OPT_UNK: files[fileCount++] = optarg; break;
            default: return 1;
        }
    }

    return 0;
}
开发者ID:Longinus00,项目名称:transmission,代码行数:26,代码来源:edit.c


示例2: main

int main(int argc, char *argv[])
{
	try
	{
		libmaus2::util::ArgInfo const arginfo(argc,argv);
		libmaus2::util::ArgParser const arg(argc,argv);

		if ( arg.argPresent("h") || arg.argPresent("help") )
		{
			std::cerr << getUsage(arg);
			return EXIT_SUCCESS;
		}
		else if ( arg.argPresent("version") )
		{
			std::cerr << "This is " << PACKAGE_NAME << " version " << PACKAGE_VERSION << std::endl;
			return EXIT_SUCCESS;
		}
		else if ( arg.size() < 2 )
		{
			std::cerr << getUsage(arg);
			return EXIT_FAILURE;
		}

		return lassort(arg,arginfo);
	}
	catch(std::exception const & ex)
	{
		std::cerr << ex.what() << std::endl;
		return EXIT_FAILURE;
	}
}
开发者ID:gt1,项目名称:lastools,代码行数:31,代码来源:lasmarkprimary.cpp


示例3: glBufferData

void GLBuffer::unmapStream()
{
	// "orphan" current buffer to avoid implicit synchronisation on the GPU:
	// http://www.seas.upenn.edu/~pcozzi/OpenGLInsights/OpenGLInsights-AsynchronousBufferTransfers.pdf
	glBufferData(getTarget(), (GLsizeiptr) getSize(), nullptr,    getUsage());
	glBufferData(getTarget(), (GLsizeiptr) getSize(), memory_map, getUsage());
}
开发者ID:neonmori,项目名称:sdlpalX,代码行数:7,代码来源:GLBuffer.cpp


示例4: getUsage

const std::string& CmdWriteOSGFile::execute( const std::vector< std::string >& arguments )
{
    bool hasinputfile = false;
    if ( arguments.size() < 1 )
    {
        _cmdResult = getUsage();
        return _cmdResult;
    }
    else if ( ( arguments.size() > 2 ) && ( arguments[ 0 ] == "-i" ) )
    {
        hasinputfile = true;
    }
    else
    {
        _cmdResult = getUsage();
        return _cmdResult;
    }

    EnConsole* p_console = static_cast< EnConsole* >( yaf3d::EntityManager::get()->findEntity( ENTITY_NAME_CONSOLE ) );
    assert( p_console && "CmdWriteOSGFile::execute: console entity could not be found!" );
    std::string cwd = yaf3d::Application::get()->getMediaPath() + p_console->getCWD() + "/";
    if ( !hasinputfile )
    {
        osg::Group* grp = yaf3d::Application::get()->getSceneRootNode();
        if ( grp )
        {
            _cmdResult = "writing scene to osg file '" + arguments[ 0 ] + "\n";
            std::string filename = cwd + arguments[ 0 ];

            if ( !osgDB::writeNodeFile( *grp, filename ) )
            {
                _cmdResult += " warning: problem writing file '" + filename + "\n";
            }
        }
    }
    else
    {
        _cmdResult = "reading scene file " + arguments[ 1 ] + " ...\n";
        std::string infilename = cwd + arguments[ 1 ];
        osg::ref_ptr< osg::Node > node = osgDB::readNodeFile( infilename );
        if ( node.get() )
        {
            std::string outfilename = cwd + arguments[ 2 ];
            _cmdResult += "writing scene to file " + outfilename + "\n";

            if ( !osgDB::writeNodeFile( *( node.get() ), outfilename ) )
            {
                _cmdResult += " warning: problem writing file " + outfilename + "\n";
            }
        }
        else
        {
            _cmdResult += "cannot read scene file " + infilename + "\n";
        }
    }

    return _cmdResult;
}
开发者ID:BackupTheBerlios,项目名称:yag2002-svn,代码行数:58,代码来源:vrc_cmdwriteosgfile.cpp


示例5: glBufferDataARB

void VBO::unmap()
{
	if (!is_mapped)
		return;

	// "orphan" current buffer to avoid implicit synchronisation on the gpu:
	// http://www.seas.upenn.edu/~pcozzi/OpenGLInsights/OpenGLInsights-AsynchronousBufferTransfers.pdf
	glBufferDataARB(getTarget(), getSize(), NULL,       getUsage());
	glBufferDataARB(getTarget(), getSize(), memory_map, getUsage());
	is_mapped = false;
}
开发者ID:ascetic85,项目名称:love2d,代码行数:11,代码来源:VertexBuffer.cpp


示例6: if

int RespondTemplate::execute(int argc, char* argv[])
{
        int status = CommandProcessor::COMMAND_FAILED;
        UtlString usage;

        //printf("no operation command with %d arguments\n", argc);
        if(argc == 1)
        {
                status = CommandProcessor::COMMAND_SUCCESS;
                messageProcessor->stopResponding();
        }
        else if(argc == 2)
        {

                {
                        UtlString fileName;

                        fileName = argv[1];

                        messageProcessor->startResponding(fileName.data(), -1 );
                        status = CommandProcessor::COMMAND_SUCCESS;
                }

        }
        else
        {
                UtlString usage;
                getUsage(argv[0], &usage);
                printf("%s", usage.data());
                status = CommandProcessor::COMMAND_BAD_SYNTAX;
        }

        return(status);
}
开发者ID:chemeris,项目名称:sipxecs,代码行数:34,代码来源:RespondTemplate.cpp


示例7: CHECK_GL_ERROR

void nuVertexBuffer::update(void)
{
  if(!isInitialized()) {
    CHECK_GL_ERROR(glGenBuffers(1, &mVertexBufferID));
    NU_ASSERT(mVertexBufferID != 0, "Cannot generate vertex buffer object.\n");

    CHECK_GL_ERROR(glBindBuffer(GL_ARRAY_BUFFER, mVertexBufferID));
    CHECK_GL_ERROR(glBufferData(GL_ARRAY_BUFFER, mSize, mpBuffer, getResourceUsage()));
    
    if(getUsage() == nuGResource::STATIC_RESOURCE)
      releaseBuffer();

    mCommitSize = 0;
    setInitialized(true);
  } else {
    CHECK_GL_ERROR(glBindBuffer(GL_ARRAY_BUFFER, mVertexBufferID));

    if(mCommitSize > VERTEX_BUFFER_MAP_THRESHOLD) {
      void* p_buffer;
      CHECK_GL_ERROR(p_buffer = glMapBuffer(GL_ARRAY_BUFFER, GL_WRITE_ONLY));
      memcpy(p_buffer, mpBuffer, mCommitSize);
      CHECK_GL_ERROR(glUnmapBuffer(GL_ARRAY_BUFFER));
    } else {
      CHECK_GL_ERROR(glBufferSubData(GL_ARRAY_BUFFER, 0, mCommitSize, mpBuffer));
    }

    mCommitSize = 0;
  }
}
开发者ID:SaintNus,项目名称:nuDE,代码行数:29,代码来源:nuVertexBuffer.cpp


示例8: end

string Clocker::readResetDetailed() {
    ostringstream str;
    long dsec, usec;
    double utime, stime;
    end();
    double diff = getTimediff();
    unsigned long usage = getUsage();
    double timeUsed = usage / 1E6;

    dsec = r_usageEnd.ru_utime.tv_sec - r_usageStart.ru_utime.tv_sec;
    usec = r_usageEnd.ru_utime.tv_usec - r_usageStart.ru_utime.tv_usec;
    utime = (1000000* dsec + usec) / 1E6;

    dsec = r_usageEnd.ru_stime.tv_sec - r_usageStart.ru_stime.tv_sec;
    usec = r_usageEnd.ru_stime.tv_usec - r_usageStart.ru_stime.tv_usec;
    stime = (1000000* dsec + usec) / 1E6;

    long maxrss = r_usageEnd.ru_maxrss;
    long nvcsw = r_usageEnd.ru_nvcsw ;
    long nivcsw = r_usageEnd.ru_nivcsw;

    str << ":: " << now << " :: " << setfill('0') << setprecision(6) << setw(10) << diff << " sec elapsed";
    str << " (since " << since << ")" << endl;
    str << ":: " << now << " :: time(user) " << setfill(' ') << setprecision(4) << utime;
    str << " :: time(system) " << setfill(' ') << setprecision(4) << stime;
    str << " :: time(total) " << setfill(' ') << setprecision(4) << timeUsed;
    str << "\n:: " << now
    << " :: maxRss=" << maxrss
    << " :: cntxSwitch(user)=" << nvcsw
    << " :: cntxSwitch(forc)=" << nivcsw;

    begin();
    return str.str();
}
开发者ID:zhaoshin,项目名称:tileboard,代码行数:34,代码来源:Clocker.cpp


示例9: getUsage

void Options::parseFromCommandLine(int argc, char **argv) {
    po::variables_map options;
    po::command_line_parser parser { argc, argv };

    auto usage = getUsage();
    auto positional = getPositional();
    try {
        po::store(
            parser.options(usage)
                  .positional(positional)
                  .run(),
            options
        );
        if (options.count("help")) {
            std::cerr << usage << std::endl;
            exit(0);
        }
        po::notify(options);
    }
    catch (const po::error & exception) {
        std::cerr << exception.what() << std::endl << std::endl;
        std::cerr << usage << std::endl;
        exit(1);
    }
}
开发者ID:Globidev,项目名称:N-Puzzle,代码行数:25,代码来源:Options.cpp


示例10: parseCommandLine

static int
parseCommandLine( int argc, const char ** argv )
{
    int c;
    const char * optarg;

    while(( c = tr_getopt( getUsage( ), argc, argv, options, &optarg )))
    {
        switch( c )
        {
            case 'p': isPrivate = TRUE; break;
            case 'o': outfile = optarg; break;
            case 'c': comment = optarg; break;
            case 't': if( trackerCount + 1 < MAX_TRACKERS ) {
                          trackers[trackerCount].tier = trackerCount;
                          trackers[trackerCount].announce = (char*) optarg;
                          ++trackerCount;
                      }
                      break;
            case TR_OPT_UNK: infile = optarg; break;
            default: return 1;
        }
    }

    return 0;
}
开发者ID:Longinus00,项目名称:transmission,代码行数:26,代码来源:create.c


示例11: getUsage

const std::string& CmdEntityAttributeSet::execute( const std::vector< std::string >& arguments )
{
    _cmdResult = "";
    if ( arguments.size() < 3 )
    {
        _cmdResult = getUsage();
        return _cmdResult;
    }

    yaf3d::BaseEntity* p_entity = yaf3d::EntityManager::get()->findInstance( arguments[ 0 ] );
    if ( ! p_entity )
    {
        _cmdResult = "* entity instance '" + arguments[ 0 ] + "' does not exist";
        return _cmdResult;
    }

    // set attribute value using value string
    if ( !p_entity->getAttributeManager().setAttributeValueByString( arguments[ 1 ], arguments[ 2 ] ) )
    {
        _cmdResult = "* error setting attribute value, check the value format!";
    }
    else
    {
        // now send out a notification to the entity this way letting it know that we changed an attribute value
        //  the entity can decide itself if an appropriate action is necessary in this case
        yaf3d::EntityNotification notification( YAF3D_NOTIFY_ENTITY_ATTRIBUTE_CHANGED );
        yaf3d::EntityManager::get()->sendNotification( notification, p_entity );
    }

    return _cmdResult;
}
开发者ID:BackupTheBerlios,项目名称:yag2002-svn,代码行数:31,代码来源:vrc_cmdentityattrset.cpp


示例12: dbgf

HRESULT IDirect3DDevice9New::CreateIndexBuffer(UINT Length,DWORD Usage,D3DFORMAT Format,D3DPOOL Pool,IDirect3DIndexBuffer9** ppIndexBuffer,HANDLE* pSharedHandle) 
{
  dbgf("dev: CreateIndexBuffer %s %s", getUsage(Usage), getPool(Pool));

  if(config.debug.compatibleIB)
  {
    // Compatible index buffer mode - do not use emulated IB, set dynamic memory instead
    if(Pool == D3DPOOL_MANAGED)
    {
      ONCE dbg("DEBUG: using compatible index buffers (manage-emulation disabled)");
      Pool = D3DPOOL_DEFAULT;
      Usage |= D3DUSAGE_DYNAMIC;
    }
    return dev->CreateIndexBuffer(Length, Usage, Format, Pool, ppIndexBuffer, pSharedHandle);
  }

#if USE_D3DEX || MANAGE_DEBUG_IB
  /*if(Pool == D3DPOOL_MANAGED && Usage == D3DUSAGE_WRITEONLY)
    Pool = D3DPOOL_DEFAULT; // No need for manage-emulation for writeonly buffers, just set pool to default*/

  if(Pool == D3DPOOL_MANAGED)
  {
    *ppIndexBuffer = new IDirect3DIndexBuffer9Managed((IDirect3DDevice9Ex*)dev, this, Length, Usage, Format, Pool, pSharedHandle);
    // TODO: check for failure
    return D3D_OK;
  }
#endif
  return dev->CreateIndexBuffer(Length, Usage, Format, Pool, ppIndexBuffer, pSharedHandle);
}
开发者ID:SummersReign,项目名称:SoftTH,代码行数:29,代码来源:d3d.cpp


示例13: printf

int KeyCommand::execute(int argc, char* argv[])
{
	int commandStatus = CommandProcessor::COMMAND_FAILED;
	if(argc == 1)
	{
		printf("\t\t\t  Shortcut Keys\n");
		printf("al ---------> addline\t\t\taacc ---------> autoaccept\n");
		printf("aans ---------> autoanswer\t\tarej ---------> autoreject\n");
		printf("cacc ---------> callaccept\t\tcans ---------> callanswer\n");
		printf("cco ---------> callconnect\t\tccr --------->callcreate\n");
		printf("cd ---------> calldestroy\t\tch ---------> callhold\n");
		printf("pf ---------> callplayfile\t\tcr ---------> callredirect\n");
		printf("si ---------> callsendinfo\t\tst ---------> callstarttone\n");
		printf("csub ---------> callsubscribe\t\tcu ---------> callunhold\n");
		printf("cfa ---------> conferenceadd\t\tcfcr ---------> conferencecreate\n");
		printf("cfd ---------> conferencedestroy\tcfgc ---------> conferencegetcalls\n");
		printf("cfh ---------> conferencehold\t\tcfj ---------> conferencejoin\n");
		printf("cfu ---------> conferenceunhold\t\tcp ---------> createpublisher\n");
		printf("dp ---------> destroypublisher\t\tup ---------> updatepublisher\n");
		printf("es ---------> enablestun\t\ter ---------> enablerport\n");
		printf("\t\t\thi ---------> history\n");
	}
	else
	{
		UtlString usage;
        getUsage(argv[0], &usage);
        printf("%s", usage.data());
        commandStatus = CommandProcessor::COMMAND_BAD_SYNTAX;
	}
	return commandStatus;
}
开发者ID:ATHLSolutions,项目名称:sipxecs,代码行数:31,代码来源:KeyCommand.cpp


示例14: getUsage

const std::string& CmdEntityAttributeList::execute( const std::vector< std::string >& arguments )
{
    if ( arguments.size() < 1 )
    {
        _cmdResult = getUsage();
        return _cmdResult;
    }

    _cmdResult = "list of entity attributes:\n";

    yaf3d::BaseEntity* p_entity = yaf3d::EntityManager::get()->findInstance( arguments[ 0 ] );
    if ( ! p_entity )
    {
        _cmdResult = "* entity instance '" + arguments[ 0 ] + "' does not exist";
        return _cmdResult;
    }

    std::vector< std::vector< std::string > > attributes;
    p_entity->getAttributeManager().getAttributesAsString( attributes );

    std::string info;
    std::vector< std::vector< std::string > >::iterator p_beg = attributes.begin(), p_end = attributes.end();
    for ( ; p_beg != p_end; ++p_beg )
    {
        info += ( *p_beg )[ 0 ] + "  [  " + ( *p_beg )[ 1 ] + "  ] \n";
    }
    _cmdResult = info;

    return _cmdResult;
}
开发者ID:BackupTheBerlios,项目名称:yag2002-svn,代码行数:30,代码来源:vrc_cmdentityattrlist.cpp


示例15: getConfigDir

static char const* getConfigDir(int argc, char const* const* argv)
{
    int c;
    char const* configDir = NULL;
    char const* optarg;
    int const ind = tr_optind;

    while ((c = tr_getopt(getUsage(), argc, argv, options, &optarg)) != TR_OPT_DONE)
    {
        if (c == 'g')
        {
            configDir = optarg;
            break;
        }
    }

    tr_optind = ind;

    if (configDir == NULL)
    {
        configDir = tr_getDefaultConfigDir(MY_NAME);
    }

    return configDir;
}
开发者ID:t-richards,项目名称:transmission,代码行数:25,代码来源:daemon.c


示例16: TextureStorage9

TextureStorage9_2D::TextureStorage9_2D(Renderer *renderer, GLenum internalformat, bool renderTarget, GLsizei width, GLsizei height, int levels)
    : TextureStorage9(renderer, GetTextureUsage(internalformat, renderTarget))
{
    mTexture = NULL;
    mRenderTarget = NULL;
    // if the width or height is not positive this should be treated as an incomplete texture
    // we handle that here by skipping the d3d texture creation
    if (width > 0 && height > 0)
    {
        IDirect3DDevice9 *device = mRenderer->getDevice();
        const d3d9::TextureFormat &d3dFormatInfo = d3d9::GetTextureFormatInfo(internalformat);
        d3d9::MakeValidSize(false, d3dFormatInfo.texFormat, &width, &height, &mTopLevel);
        UINT creationLevels = (levels == 0) ? 0 : mTopLevel + levels;

        HRESULT result = device->CreateTexture(width, height, creationLevels, getUsage(), d3dFormatInfo.texFormat, getPool(), &mTexture, NULL);

        if (FAILED(result))
        {
            ASSERT(result == D3DERR_OUTOFVIDEOMEMORY || result == E_OUTOFMEMORY);
            gl::error(GL_OUT_OF_MEMORY);
        }
    }

    initializeRenderTarget();
}
开发者ID:L2-D2,项目名称:gecko-dev,代码行数:25,代码来源:TextureStorage9.cpp


示例17: getUsage

const std::string& CmdServerStart::execute( const std::vector< std::string >& arguments )
{
    _cmdResult = "";
    if ( arguments.size() < 1 )
    {
        _cmdResult = getUsage();
        return _cmdResult;
    }

    // get the full binary path
    std::string cmd = yaf3d::Application::get()->getFullBinPath();
    std::string levelfile = arguments[ 0 ];
    std::string arg1( "-server" );
    std::string arg2( "-level" );
    std::string arg3( levelfile );

    // use utility function to start the server
    std::string args = arg1 + "  " + arg2 + "  " + arg3;
    YAF3D_SPAWN_PROC_ID serverProcHandle = yaf3d::spawnApplication( cmd, args );

    if ( serverProcHandle )
        _cmdResult = "trying to start server with level file '" + levelfile + "'.";
    else
        _cmdResult = "* error starting server with level file '" + levelfile + "'.";

    return _cmdResult;
}
开发者ID:BackupTheBerlios,项目名称:yag2002-svn,代码行数:27,代码来源:vrc_cmdserverstart.cpp


示例18: printf

int CallSubscribeCommand::execute(int argc, char* argv[])
{
	int commandStatus = CommandProcessor::COMMAND_FAILED;
	if(argc == 4)
	{
		if(sipxCallSubscribe(atoi(argv[1]), argv[2], argv[3], subHandle)
			== SIPX_RESULT_SUCCESS)
		{
			printf("Subscription successful with call id: %d and subscription id: %d\n",
				 atoi(argv[1]), *subHandle);
		}
		else
		{
			printf("Subscription unsuccessful.\n");
		}
	}
	else
	{
		UtlString usage;
        getUsage(argv[0], &usage);
        printf("%s", usage.data());
        commandStatus = CommandProcessor::COMMAND_BAD_SYNTAX;
	}
	return commandStatus;
}
开发者ID:mranga,项目名称:sipxecs,代码行数:25,代码来源:CallSubscribeCommand.cpp


示例19: parseCommandLine

static int
parseCommandLine (int argc, const char * const * argv)
{
  int c;
  const char * optarg;

  while ((c = tr_getopt (getUsage (), argc, argv, options, &optarg)))
    {
      switch (c)
        {
          case 'm':
            magnetFlag = true;
            break;

          case 's':
            scrapeFlag = true;
            break;

          case 'V':
            showVersion = true;
            break;

          case TR_OPT_UNK:
            filename = optarg;
            break;

          default:
            return 1;
        }
    }

    return 0;
}
开发者ID:Javierortizc,项目名称:transmission,代码行数:33,代码来源:show.c


示例20: logOperations

int SipLogCommand::execute(int argc, char* argv[])
{
        //printf("no operation command with %d arguments\n", argc);
        //printf("exiting with status: %d\n", CommandProcessor::COMMAND_SUCCESS_EXIT);

        int commandStatus = CommandProcessor::COMMAND_FAILED;

        if(argc == 2)
        {
                UtlString logOperations(argv[1]);
        commandStatus = CommandProcessor::COMMAND_SUCCESS;

        if(logOperations.compareTo("stop") == 0)
        {
            mSipUserAgent->stopMessageLog();
            osPrintf("SIP logging Stopped\n");
        }

        else if(logOperations.compareTo("start") == 0)
        {
            mSipUserAgent->clearMessageLog();
            mSipUserAgent->startMessageLog();
            osPrintf("SIP logging Started\n");
        }

        else if(logOperations.compareTo("dump") == 0)
        {
            UtlString log;
            mSipUserAgent->getMessageLog(log);
            osPrintf("\n============>\n%s\n============>\n", log.data());
        }

        else if(logOperations.compareTo("clear") == 0)
        {
            mSipUserAgent->clearMessageLog();
            osPrintf("SIP log cleared\n");
        }

        else
        {
            argc = 1;
        }


        }

        if(argc != 2)
        {
                UtlString usage;
                getUsage(argv[0], &usage);
                printf("%s", usage.data());
                commandStatus = CommandProcessor::COMMAND_BAD_SYNTAX;
        }
        else
        {

        }

        return(commandStatus);
}
开发者ID:Jaroslav23,项目名称:sipxtapi,代码行数:60,代码来源:SipLogCommand.cpp



注:本文中的getUsage函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ gss_release_oid_set函数代码示例发布时间:2022-05-30
下一篇:
C++ g_list_copy函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap