本文整理汇总了C++中SimpleString::GetLength方法的典型用法代码示例。如果您正苦于以下问题:C++ SimpleString::GetLength方法的具体用法?C++ SimpleString::GetLength怎么用?C++ SimpleString::GetLength使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SimpleString
的用法示例。
在下文中一共展示了SimpleString::GetLength方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SetSyncLinkData
bool MsgSocket::SetSyncLinkData( SimpleString DataForSL )
{
if ( DataForSL.GetLength() <= 0 )
return false;
SmartLocker SL_protectSend(protectSend);
if ( receivedSyncLinkMsg == true || sendSyncLinkMsg == true )
{
// TOO LATE
#ifdef DEBUG
if ( Debug & DBG_LINKSYNC )
{
fprintf( stderr, "MsgSocket::SetSyncLinkData: connexion already open. Can not set SyncLink data.\n" );
}
#endif
return false;
}
// Copy data and set Length
SyncLinkData = DataForSL;
return true;
}
示例2: GenerateHeaderDescription
void Attribute::GenerateHeaderDescription(const SimpleString& type,
const SimpleString& name,
SimpleString& str,
bool end)
{
// "<"+ type + " name=\"" + name + "\"/>" at max
TemporaryMemoryBuffer MemBuff( 1 + type.GetLength() + 7 + name.GetLength() + 4 );
if ( end == true )
{
snprintf( (char*)MemBuff, MemBuff.GetLength(), "<%s name=\"%s\"/>", type.GetStr(), name.GetStr() );
}
else
{
snprintf( (char*)MemBuff, MemBuff.GetLength(), "<%s name=\"%s\">", type.GetStr(), name.GetStr() );
}
str += (char*)MemBuff;
//str = str + "<"+ type + " name=\"" + name;
//if(end) str = str + "\"/>";
//else str = str + "\">";
}
示例3: ProcessAMessage
//.........这里部分代码省略.........
}
bool ReplyAnAnswer = true; // default
SimpleString str;
if ( node->children == NULL )
{
//global description
GenerateGlobalShortDescription(str);
}
else
{
// more precise request
xmlNodePtr cur_node = node->children;
for(; cur_node; cur_node = cur_node->next)
{
SimpleString name = (const char*)(cur_node->name);
//std::cerr << "tag name="<<(*it)->name <<"\n";
if( name == InOutputAttribute::input_str.GetStr() ||
name == InOutputAttribute::output_str.GetStr() ||
name == InOutputAttribute::inoutput_str.GetStr() )
{
// OmiscidTrace( " process io : %s \n", (*it)->name.GetStr());
ProcessInOutputQuery(cur_node, str);
}
else if( name == VariableAttribute::VariableStr )
{
ProcessVariableQuery(cur_node, msg->pid, str);
}
else if( name == "connect" )
{
ProcessConnectQuery(cur_node, str);
}
else if( name == "subscribe" )
{
ProcessSubscribeQuery(cur_node, msg->pid, true, str);
}
else if( name == "unsubscribe" )
{
ReplyAnAnswer = false;
ProcessSubscribeQuery(cur_node, msg->pid, false, str);
}
else if( name == "lock" )
{
ProcessLockQuery(cur_node, msg->pid, true, str);
}
else if( name == "unlock" )
{
ProcessLockQuery(cur_node, msg->pid, false, str);
}
else if( name == "fullDescription" )
{
ProcessFullDescriptionQuery(cur_node, str);
}
else
{
// Should not appear
OmiscidError( "unknown tag : %s\n", name.GetStr() );
}
}
// OmiscidError( "Send : %s \n", str.GetStr());
}
if ( ReplyAnAnswer == true )
{
str = "<controlAnswer id=\""+id+"\">"
+ str
+ "</controlAnswer>";
#ifdef DEBUG
SL_AutoProtect.Lock();
if ( ControlAnswerValidator.ValidateDoc( str ) == false )
{
OmiscidError( "ControlServer::ProcessAMessage: bad ControlAnswer sent.\n" );
}
SL_AutoProtect.Unlock();
#endif
SmartLocker SL_TcpServer_listConnections(TcpServer::listConnections);
MsgSocket* ms = FindClientFromId( msg->pid );
if( ms != (MsgSocket*)NULL )
{
try
{
ms->Send((int)str.GetLength(), str.GetStr());
}
catch( SocketException& e )
{
OmiscidError( "Error when responding to a client request : %s (%d)\n", e.msg.GetStr(), e.err );
}
}
}
}
else
{
OmiscidError( "waited : controlQuery, received='%s'\n", node->name);
msg->Display(stderr);
}
}
示例4: ControlClient
ServiceProxy::ServiceProxy( unsigned int PeerId, SimpleString eHostName, int eControlPort, ServiceProperties& ServiceProps )
: ControlClient(PeerId)
{
SimpleString TmpString;
VariableAttribute * VarAtt;
InOutputAttribute * IOAtt;
int Pos;
unsigned int Port;
HostName = eHostName;
ControlPort = eControlPort;
FullDescription = false;
// Is the description
TmpString = ServiceProps["desc"].GetValue();
//if ( ServiceProps.IsDefined( "name" ) )
//{
// OmiscidError( "Warning, forced fallback for '%s' (%s).\n",
// ServiceProps[NameString].GetValue().GetStr(), ServiceProps["id"].GetValue().GetStr() );
//}
//else
//{
// OmiscidError( "Warning, forced fallback for %8.8x.\n", PeerId );
//}
//if ( TmpString == "forced fallback" )
// OmiscidTrace( "Working on'%s' (%s).\n",
// ServiceProps[ControlServer::NameString].GetValue().GetStr(), ServiceProps["id"].GetValue().GetStr() );
if ( TmpString == "full" )
{
FullDescription = true;
}
for( Pos = 0; Pos < ServiceProps.GetNumberOfProperties(); Pos++ )
{
ServiceProperty& LocalProp = ServiceProps.GetProperty(Pos);
if ( LocalProp.GetName() == "desc" )
{
continue;
}
// SimpleString TmpName = LocalProp.GetName();
// Parse property
TmpString = LocalProp.GetValue();
char * TmpChar = (char*)TmpString.GetStr();
switch( TmpString[0] )
{
// Work on Variables
case 'c':
if ( TmpString.GetLength() <= 2 || TmpString[1] != '/' )
{
FullDescription = false;
continue;
}
// Ok, something like c/...
VarAtt = new OMISCID_TLM VariableAttribute( LocalProp.GetName() );
if ( VarAtt == NULL )
{
FullDescription = false;
continue;
}
VarAtt->SetValue( TmpChar+2 );
VarAtt->SetAccessConstant();
listVariableName.Add( LocalProp.GetName() );
listVariableAttr.Add( VarAtt );
break;
case 'r':
if ( TmpString.GetLength() != 1 )
{
FullDescription = false;
continue;
}
// Ok, something like r/...
VarAtt = new OMISCID_TLM VariableAttribute( LocalProp.GetName() );
if ( VarAtt == NULL )
{
FullDescription = false;
continue;
}
VarAtt->SetAccessRead();
listVariableName.Add( LocalProp.GetName() );
listVariableAttr.Add( VarAtt );
break;
case 'w':
if ( TmpString.GetLength() != 1 )
{
FullDescription = false;
continue;
}
// Ok, something like w/...
VarAtt = new OMISCID_TLM VariableAttribute( LocalProp.GetName() );
if ( VarAtt == NULL )
{
//.........这里部分代码省略.........