当前位置: 首页>>代码示例>>C++>>正文


C++ StrPtr类代码示例

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


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

示例1:

//
// Gets a protocol value
//
int P4ClientAPI::GetProtocol( const char * var ) 
{
    StrPtr *pv = client.GetProtocol( var );
    if ( pv ) {
		lua_pushstring( L, pv->Text() );
		return 1;
    }
    return 0;
}
开发者ID:scw000000,项目名称:Engine,代码行数:12,代码来源:p4clientapi.cpp

示例2: lock

    StrPtr Connection::read() {
        boost::mutex::scoped_lock lock(bufferLock);

        StrPtr result;
        if (!this->buffer.empty()) {
            result.reset(this->buffer.front()->getContent());
            this->buffer.pop();
        } else if (!this->isOpened) {
            //TODO: throw exception
        }

        return result;
    }
开发者ID:asoukhoruchko,项目名称:CppClientServer,代码行数:13,代码来源:Connection.cpp

示例3: do_write

  void do_write(const chat_message& msg)
  {
	StrPtr s = std::make_shared<std::string>(msg.data(), msg.length());
    auto self(shared_from_this());
    boost::asio::async_write(socket_,
        boost::asio::buffer(s->data(),
          s->length()),
        [this, self, s](boost::system::error_code ec, std::size_t /*length*/)
        {
          if (ec)
          {
            room_.leave(shared_from_this());
          }
        });
  }
开发者ID:Gremory,项目名称:hpcourse,代码行数:15,代码来源:chat_server.cpp

示例4:

P4MergeData::P4MergeData( lua_State *_L, ClientUser *ui, ClientMerge *m, StrPtr &hint )
{
	this->L = _L;
    this->debug = 0;
    this->ui = ui;
    this->merger = m;
    this->hint = hint;

    // Extract (forcibly) the paths from the RPC buffer.
    StrPtr *t;
    if( ( t = ui->varList->GetVar( "baseName" ) ) ) base = t->Text();
    if( ( t = ui->varList->GetVar( "yourName" ) ) ) yours = t->Text();
    if( ( t = ui->varList->GetVar( "theirName" ) ) ) theirs = t->Text();
    
}
开发者ID:Malaar,项目名称:luaplus51-all,代码行数:15,代码来源:p4mergedata.cpp

示例5: HELIUM_ASSERT

void SubmitCommand::OutputStat( StrDict* dict )
{
  if ( m_Changeset == NULL )
  {
    return;
  }

  StrPtr* submittedChange = dict->GetVar( g_SubmittedChangeTag );
  if ( submittedChange )
  {
    m_Changeset->m_Id = submittedChange->Atoi();
  }

  uint32_t numFiles = 0;
  StrPtr* openFiles = dict->GetVar( g_OpenFilesTag );
  if ( openFiles )
  {
    numFiles = openFiles->Atoi();
  }

  for( uint32_t i = 0; i < numFiles; ++i )
  {
    RCS::FilePtr file = new RCS::File();

    StrPtr* depotFile = dict->GetVar( g_DepotFileTag, i );
    if ( depotFile )
    {
        bool converted = Helium::ConvertString( depotFile->Text(), file->m_DepotPath );
        HELIUM_ASSERT( converted );
    }

    StrPtr* revision = dict->GetVar( g_RevisionTag );
    if ( revision )
    {
      file->m_LocalRevision = revision->Atoi();
    }

    StrPtr* action = dict->GetVar( g_ActionTag );
    if ( action )
    {
        tstring actionString;
        bool converted = Helium::ConvertString( action->Text(), actionString );
        HELIUM_ASSERT( converted );

        file->m_Operation = GetOperationEnum( actionString );
    }
  }
}
开发者ID:,项目名称:,代码行数:48,代码来源:

示例6: OnPrompt

void CCmd_Password::OnPrompt( const StrPtr &msg, StrBuf &rsp, int noEcho, Error *e )
{
	CString message = CharToCString(msg.Text());
	CString *csp;
	csp = (message.Find(_T("old")) != -1) ? &m_OldPwd : &m_NewPwd;
	rsp.Set(CharFromCString(*csp));
}
开发者ID:danieljennings,项目名称:p4win,代码行数:7,代码来源:Cmd_Password.cpp

示例7: Prompt

	// Entering password
	void Prompt( const StrPtr &msg, StrBuf &buf, int noEcho ,Error *e )
	{
		Conn().Log().Info() << "Prompted for password by server" << Endl;
		Conn().Log().Debug() << "Prompt: " << msg.Text() << Endl;
		buf.Set(m_Password.c_str());
		Conn().VerboseLine("Prompted for password");
	}
开发者ID:syscobra,项目名称:VersionControlPlugins,代码行数:8,代码来源:P4LoginCommand.cpp

示例8:

//
// RunCmd is a private function to work around an obscure protocol
// bug in 2000.[12] servers. Running a "p4 -Ztag client -o" messes up the
// protocol so if they're running this command then we disconnect and
// reconnect to refresh it. For efficiency, we only do this if the
// server2 protocol is either 9 or 10 as other versions aren't affected.
//
void
P4ClientApi::RunCmd( const char *cmd, ClientUser *ui, int argc, char * const *argv, int table )
{
	client.SetProg( &prog );
	if( version.Length() )
		client.SetVersion( &version );

	if( mode & M_TAGGED )
		client.SetVar( "tag" );

	// If maxresults or maxscanrows is set, enforce them now
	if( maxResults  )	client.SetVar( "maxResults",  maxResults  );
	if( maxScanRows )	client.SetVar( "maxScanRows", maxScanRows );
	if( maxLockTime )	client.SetVar( "maxLockTime", maxLockTime );

	client.SetBreak( &cb );
	client.SetArgv( argc, argv );
	client.Run( cmd, ui );

	// Have to request server2 protocol *after* a command has been run. I
	// don't know why, but that's the way it is.

	if ( ! server2 )
	{
		StrPtr *pv = client.GetProtocol( "server2" );
		if ( pv )
			server2 = pv->Atoi();
	}

	if ( IS_TAGGED(mode) && StrRef( cmd ) == "client" &&
		server2 >= 9    && server2 <= 10  )
	{
		if ( argc && ( StrRef( argv[ 0 ] ) == "-o" ) )
		{
			if ( P4LUADEBUG_COMMANDS )
				printf( "Resetting client to avoid 2000.[12] protocol bug\n" );

			Error e;
			client.Final( &e );
			client.Init( &e );

			// Pass any errors down to the UI, so they'll get picked up.
			if ( e.Test() )
				ui->HandleError( &e );
		}
	}
}
开发者ID:Malaar,项目名称:luaplus51-all,代码行数:54,代码来源:p4clientapi.cpp

示例9: SetCmdRun

void P4ClientAPI::RunCmd( const char *cmd, ClientUser *ui, int argc, char * const *argv )
{
// #if P4APIVER_ID >= 513026
    // ClientApi::SetProg() was introduced in 2004.2
	client.SetProg( &prog );
// #endif

// #if P4APIVER_ID >= 513282
    // ClientApi::SetVersion() was introduced in 2005.2
	if( version.Length() )
		client.SetVersion( &version );
// #endif

    if( IsTag() )
		client.SetVar( "tag" );

    if( IsStreamsMode() && apiLevel >= 70 )
		client.SetVar( "enableStreams" );

    // If maxresults or maxscanrows is set, enforce them now
    if( maxResults  )	client.SetVar( "maxResults",  maxResults  );
    if( maxScanRows )	client.SetVar( "maxScanRows", maxScanRows );
    if( maxLockTime )	client.SetVar( "maxLockTime", maxLockTime );

//	client.SetBreak( &cb );
	client.SetArgv( argc, argv );
	client.Run( cmd, ui );

	// Have to request server2 protocol *after* a command has been run. I
	// don't know why, but that's the way it is.

    if ( ! IsCmdRun() )
    {
		StrPtr *pv = client.GetProtocol( "server2" );
		if ( pv )
			server2 = pv->Atoi();

		pv = client.GetProtocol( P4Tag::v_nocase );
		if ( pv ) 
			SetCaseFold();
	    
		pv = client.GetProtocol( P4Tag::v_unicode );
		if ( pv && pv->Atoi() )
			SetUnicode();
    }
    SetCmdRun();
}
开发者ID:scw000000,项目名称:Engine,代码行数:47,代码来源:p4clientapi.cpp

示例10: Prompt

/*
* In a script we don't really want the user to see a prompt, so we
* (ab)use the SetInput() function to allow the caller to supply the
* answer before the question is asked.
*/
void
ClientUserLua::Prompt( const StrPtr &msg, StrBuf &rsp, int noEcho, Error *e )
{
	if ( P4LUADEBUG_CALLS )
		fprintf( stderr, "[P4] Prompt(): %s\n", msg.Text() );

	InputData( &rsp, e );
}
开发者ID:Malaar,项目名称:luaplus51-all,代码行数:13,代码来源:clientuserlua.cpp

示例11: VRemoveVar

	virtual void VRemoveVar(const StrPtr& var) override
	{
		auto found = stats_.find(var.Text());
		if (found != stats_.end())
		{
			stats_.erase(found);
		}
	}
开发者ID:Aidanboneham,项目名称:wgtf,代码行数:8,代码来源:perforce_depot_view.cpp

示例12: Prompt

/*
 * In a script we don't really want the user to see a prompt, so we
 * (ab)use P4.input= to allow the caller to supply the
 * answer before the question is asked.
 */
void PythonClientUser::Prompt( const StrPtr &msg, StrBuf &rsp, int noEcho, Error *e )
{
    EnsurePythonLock guard;
    
    if ( P4PYDBG_CALLS )
	cerr << "[P4] Prompt(): " << msg.Text() << endl;

    InputData( &rsp, e );
}
开发者ID:azakk,项目名称:p4python,代码行数:14,代码来源:PythonClientUser.cpp

示例13: fprintf

void
ClientUserLua::InputData( StrBuf *strbuf, Error *e )
{
	if ( P4LUADEBUG_CALLS )
		fprintf( stderr, "[P4] InputData(). Using supplied input\n" );

	lua_rawgeti( L, LUA_REGISTRYINDEX, inputRef );		// input

	// Is it an array?
	if (lua_type( L, -1 ) == LUA_TTABLE ) {
		lua_rawgeti( L, -1, 1 );							// input input[1]
		if ( !lua_isnil( L, -1 ) ) {
			lua_getglobal( L, "table" );					// input input[1] table
			lua_getfield( L, -1, "remove" );				// input input[1] table remove
			lua_pushvalue( L, -4 );							// input input[1] table remove input
			lua_pushnumber( L, 1 );							// input input[1] table remove input 1
			lua_call( L, 2, 0 );							// input input[1] table
			lua_pop( L, 1 );								// input input[1]
		} else {
			lua_pop( L, 1 );
		}
	}

	if ( lua_isnil( L, -1 ) )
	{
//		rb_warn( "[P4] Expected user input, found none. "
//			"Missing call to P4#input()?" );
		lua_pop( L, 2 );
		return;
	}

	if ( lua_istable( L, -1 ) )
	{
		StrPtr * 	specDef = varList->GetVar( "specdef" );

		specMgr->AddSpecDef( cmd.Text(), specDef->Text() );
		specMgr->SpecToString( cmd.Text(), lua_gettop( L ), *strbuf, e );
		return;
	}

	// Convert whatever's left into a string
	strbuf->Set( lua_tostring( L, -1 ) );
}
开发者ID:Malaar,项目名称:luaplus51-all,代码行数:43,代码来源:clientuserlua.cpp

示例14: InputData

void PythonClientUser::InputData( StrBuf *strbuf, Error *e )
{
    EnsurePythonLock guard;
    
    if ( P4PYDBG_CALLS )
	cerr << "[P4] InputData(). Using supplied input" << endl;

    PyObject * inval = input;

    if( PyTuple_Check(input) )
    {
	inval = PyTuple_GetItem(input, 0);
	input = PyTuple_GetSlice(input, 1, PyTuple_Size(input));
    }
    else if ( PyList_Check(input) )
    {
    	inval = PyList_GetItem(input, 0);
	input = PyList_GetSlice(input, 1, PyList_Size(input));
    }
    
    if( inval == Py_None )
    {
	PyErr_WarnEx( PyExc_UserWarning, 
		"[P4] Expected user input, found none. "
		"Missing call to P4.input ?", 1 );
	return;
    }

    if ( PyDict_Check( inval ) )
    {
	StrPtr * specDef = varList->GetVar( "specdef" );

	specMgr->AddSpecDef( cmd.Text(), specDef->Text() );
	specMgr->SpecToString( cmd.Text(), inval, *strbuf, e );
	return;
    }
    
    // Convert whatever's left into a string
    PyObject * str = PyObject_Str(inval);
    strbuf->Set( GetPythonString(str) );
    Py_XDECREF(str);
}
开发者ID:azakk,项目名称:p4python,代码行数:42,代码来源:PythonClientUser.cpp

示例15: VSetVar

	virtual void VSetVar(const StrPtr& var, const StrPtr& val) override
	{
		stats_[var.Text()] = val;
	}
开发者ID:Aidanboneham,项目名称:wgtf,代码行数:4,代码来源:perforce_depot_view.cpp


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