本文整理汇总了C++中StrPtr::Text方法的典型用法代码示例。如果您正苦于以下问题:C++ StrPtr::Text方法的具体用法?C++ StrPtr::Text怎么用?C++ StrPtr::Text使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StrPtr
的用法示例。
在下文中一共展示了StrPtr::Text方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
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();
}
示例2: OutputStat
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 );
}
}
}
示例3: 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");
}
示例4: 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));
}
示例5: 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 );
}
示例6: VRemoveVar
virtual void VRemoveVar(const StrPtr& var) override
{
auto found = stats_.find(var.Text());
if (found != stats_.end())
{
stats_.erase(found);
}
}
示例7:
//
// 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;
}
示例8: 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 );
}
示例9: InputData
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 ) );
}
示例10: 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);
}
示例11: Conn
void P4Command::Prompt( const StrPtr &msg, StrBuf &buf, int noEcho ,Error *e )
{
Conn().VerboseLine("Prompting...");
Conn().Log().Info() << "Default ClientUser Prompt(" << msg.Text() << ")\n";
}
示例12: s
void
ClientUserLua::OutputStat( StrDict *values )
{
StrPtr * spec = values->GetVar( "specdef" );
StrPtr * data = values->GetVar( "data" );
StrPtr * sf = values->GetVar( "specFormatted" );
StrDict * dict = values;
SpecDataTable specData;
Error e;
//
// Determine whether or not the data we've got contains a spec in one form
// or another. 2000.1 -> 2005.1 servers supplied the form in a data variable
// and we use the spec variable to parse the form. 2005.2 and later servers
// supply the spec ready-parsed but set the 'specFormatted' variable to tell
// the client what's going on. Either way, we need the specdef variable set
// to enable spec parsing.
//
int isspec = spec && ( sf || data );
//
// Save the spec definition for later
//
if( spec )
specMgr->AddSpecDef( cmd.Text(), spec->Text() );
//
// Parse any form supplied in the 'data' variable and convert it into a
// dictionary.
//
if( spec && data )
{
// 2000.1 -> 2005.1 server's handle tagged form output by supplying the form
// as text in the 'data' variable. We need to convert it to a dictionary
// using the supplied spec.
if( P4LUADEBUG_CALLS )
fprintf( stderr, "[P4] OutputStat() - parsing form\n" );
// Parse the form. Use the ParseNoValid() interface to prevent
// errors caused by the use of invalid defaults for select items in
// jobspecs.
//#if P4APIVER_ID >= 513538
Spec s( spec->Text(), "", &e );
//#else
//Spec s( spec->Text(), "" );
//#endif
if( !e.Test() ) s.ParseNoValid( data->Text(), &specData, &e );
if( e.Test() )
{
HandleError( &e );
return;
}
dict = specData.Dict();
}
//
// If what we've got is a parsed form, then we'll convert it to a P4::Spec
// object. Otherwise it's a plain hash.
//
if( isspec )
{
if( P4LUADEBUG_CALLS )
fprintf(stderr ,"[P4] OutputStat() - Converting to P4::Spec object\n");
results.AddOutput( specMgr->StrDictToSpec( dict, spec ) );
lua_pop( L, 1 );
}
else
{
if( P4LUADEBUG_CALLS )
fprintf(stderr ,"[P4] OutputStat() - Converting to hash\n");
results.AddOutput( specMgr->StrDictToHash( dict ) );
lua_pop( L, 1 );
}
}
示例13: VSetVar
virtual void VSetVar(const StrPtr& var, const StrPtr& val) override
{
stats_[var.Text()] = val;
}
示例14: OutputStat
void PythonClientUser::OutputStat( StrDict *values )
{
EnsurePythonLock guard;
StrPtr * spec = values->GetVar( "specdef" );
StrPtr * data = values->GetVar( "data" );
StrPtr * sf = values->GetVar( "specFormatted" );
StrDict * dict = values;
SpecDataTable specData;
Error e;
//
// Determine whether or not the data we've got contains a spec in one form
// or another. 2000.1 -> 2005.1 servers supplied the form in a data variable
// and we use the spec variable to parse the form. 2005.2 and later servers
// supply the spec ready-parsed but set the 'specFormatted' variable to tell
// the client what's going on. Either way, we need the specdef variable set
// to enable spec parsing.
//
int isspec = spec && ( sf || data );
//
// Save the spec definition for later
//
if( spec )
specMgr->AddSpecDef( cmd.Text(), spec->Text() );
//
// Parse any form supplied in the 'data' variable and convert it into a
// dictionary.
//
if( spec && data )
{
// 2000.1 -> 2005.1 server's handle tagged form output by supplying the form
// as text in the 'data' variable. We need to convert it to a dictionary
// using the supplied spec.
if( P4PYDBG_CALLS )
cerr << "[P4] OutputStat() - parsing form" << endl;
// Parse the form. Use the ParseNoValid() interface to prevent
// errors caused by the use of invalid defaults for select items in
// jobspecs.
Spec s( spec->Text(), "", &e );
if( !e.Test() ) s.ParseNoValid( data->Text(), &specData, &e );
if( e.Test() )
{
HandleError( &e );
return;
}
dict = specData.Dict();
}
//
// If what we've got is a parsed form, then we'll convert it to a P4::Spec
// object. Otherwise it's a plain dict.
//
PyObject * r = 0;
if( isspec )
{
if( P4PYDBG_CALLS )
cerr << "[P4] OutputStat() - Converting to P4::Spec object" << endl;
r = specMgr->StrDictToSpec( dict, spec );
}
else
{
if( P4PYDBG_CALLS )
cerr << "[P4] OutputStat() - Converting to dict" << endl;
r = specMgr->StrDictToDict( dict );
}
ProcessOutput("outputStat", r );
}