本文整理汇总了C++中Message::AddString方法的典型用法代码示例。如果您正苦于以下问题:C++ Message::AddString方法的具体用法?C++ Message::AddString怎么用?C++ Message::AddString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Message
的用法示例。
在下文中一共展示了Message::AddString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CreateDesktop
int GUIControl::CreateDesktop( char *name, char *description, int *id )
{
Message *msg = new Message( CREATE );
msg->AddString( "_type", "desktop" );
msg->AddString( "_name", name );
msg->AddString( "_description", description );
Message *reply = Messenger::SendReceiveMessage( "gui_server", 0 , msg );
if ( reply == NULL )
{
delete msg;
return -1;
}
delete msg;
if ( reply->rc() != 0 )
{
if ( msg->error() != NULL )
printf("%s%s\n","error: ", msg->error() );
delete reply;
return -1;
}
if ( reply->FindInt( "_id", id ) != 0 )
{
delete reply;
return -1;
}
delete reply;
return 0;
}
示例2: SaveToArchive
// Idiom: SaveToArchive() saves our current state into the specified Message object
status_t SaveToArchive(Message & msg) const
{
if (msg.AddString("name", _name) != B_NO_ERROR) return B_ERROR;
if (msg.AddString("address", _address) != B_NO_ERROR) return B_ERROR;
if (msg.AddString("city", _city) != B_NO_ERROR) return B_ERROR;
if (msg.AddString("state", _state) != B_NO_ERROR) return B_ERROR;
if (msg.AddInt32("zip_code", _zipCode) != B_NO_ERROR) return B_ERROR;
return B_NO_ERROR; // success!
}
示例3: ProcessFolder
status_t DbxImporter::ProcessFolder( DBX *hDbx )
{
status_t nError = EOK;
DBXFOLDER *psFolder = NULL;
for( int i = hDbx->indexCount-1; i >= 0; i-- )
{
dbx_free( hDbx, psFolder );
psFolder=(DBXFOLDER*)dbx_get( hDbx, i, 0 );
if( dbx_errno != DBX_NOERROR )
{
std::cerr << "failed to read folder" << std::endl;
nError = EIO;
break;
}
if( NULL == psFolder )
continue;
if( psFolder->fname != NULL )
{
String cPath = m_cPath + String( psFolder->fname );
DBX *psChild = dbx_open( cPath.c_str() );
if( NULL == psChild )
{
std::cerr << "failed to open child folder" << std::endl;
continue;
}
if( psChild->type != DBX_TYPE_EMAIL )
{
std::cerr << "Folder " << psFolder->fname << " doesn't contain emails like I expect" << std::endl;
continue;
}
/* Create sub-folder */
String cChild = String( psFolder->name );
String cTarget = m_cFolder + String( "/" ) + cChild;
Message *pcMessage = new Message( M_IMPORT_CREATE_FOLDER );
pcMessage->AddString( "parent", m_cFolder );
pcMessage->AddString( "name", cChild );
m_pcMessenger->SendMessage( pcMessage );
/* Add all messages to the sub-folder */
nError = ProcessMail( psChild, cTarget );
dbx_close( psChild );
if( m_bRun == false )
break;
}
}
return nError;
}
示例4: Register
int Window::Register()
{
Message *msg = new Message(REGISTER);
msg->AddString( "_type", "window" );
msg->AddInt( "_port", Port() );
msg->AddString( "_title", m_title );
msg->AddRect( "_rect", Frame() );
msg->AddBool( "_visible", false );
msg->AddInt( "_flags", m_flags );
Message *reply = Messenger::SendReceiveMessage( "gui_server", 0, msg );
if ( reply == NULL )
{
delete msg;
return -1;
}
delete msg;
if ( reply->rc() != 0 )
{
delete reply;
return -1;
}
// Good reply.. let's get the information.
int bad = 0;
if ( reply->FindInt( "_id", &m_wid ) != 0 ) bad = -1;
if ( reply->FindInt( "_sid", &m_sid ) != 0 ) bad = -1;
if ( reply->FindInt( "_did", &m_did ) != 0 ) bad = -1;
if ( reply->FindRect( "_rect", &m_frame ) != 0 ) bad = -1;
delete reply;
// Accept the GUI memory and everything.
int tmp_pages;
unsigned int tmp_flags;
if ( smk_request_shmem( m_sid, (void**)&m_buffer, &tmp_pages, &tmp_flags ) != 0 )
bad = -1;
// We now have our GUI buffer, size and ID.
if ( bad != 0 ) return -1;
// Registered with desktop port = m_did
return 0;
}
示例5: AddMessage
status_t DbxImporter::AddMessage( String &cMessage, const String &cFolder )
{
if( cMessage != "" )
{
/* Add an RFC2822 terminating sequence */
cMessage += "\r\n.\r\n";
/* Create a Mailmessage and send it back down to the application along with the relevent data */
Mailmessage *pcImport = new Mailmessage( cMessage.c_str(), cMessage.size() );
Message *pcImportMessage = new Message( M_IMPORT_NEW );
pcImportMessage->AddPointer( "message", pcImport );
pcImportMessage->AddString( "folder", cFolder );
m_pcMessenger->SendMessage( pcImportMessage );
/* Update the progress dialog & check if the user canceled */
//float vProgress = ( (double)m_nBytes / (double)m_nSize );
float vProgress = ( (double)m_nTotal / (double)m_nCount );
char zMessage[64] = { '\0' };
snprintf( zMessage, 64, "Importing message #%Ld", m_nTotal++ );
m_pcDialog->Lock();
m_pcDialog->SetMessage( zMessage );
m_pcDialog->SetProgress( vProgress );
m_bRun = !m_pcDialog->IsCancelled();
m_pcDialog->Unlock();
}
cMessage = "";
return EOK;
}
示例6: GetDesktop
int GUIControl::GetDesktop( int *desktop_id )
{
Message *msg = new Message( GET );
msg->AddString( "_type", "desktop" );
Message *reply = Messenger::SendReceiveMessage( "gui_server", 0, msg );
if ( reply == NULL )
{
delete msg;
return -1;
}
delete msg;
int ans = reply->rc();
if ( ans != 0 )
{
if ( msg->error() != NULL )
printf("%s%s\n","error: ", msg->error() );
}
if ( reply->FindInt( "_id", desktop_id ) != 0 )
ans = -1;
delete reply;
return ans;
}
示例7: SetMessage
void HexView::SetMessage(const String &cText)
{
Message *pcMsg = new Message(EV_SHOW_MESSAGE);
pcMsg->AddString(MESSAGE_TEXT_KEY, cText);
Messenger cMnger(m_pcHandler);
cMnger.SendMessage(pcMsg);
}
示例8: SetDesktopDriver
int GUIControl::SetDesktopDriver( int desktop_id, int video_id )
{
Message *msg = new Message( SET );
msg->AddString( "_type", "desktop_driver" );
msg->AddInt( "_id", desktop_id );
msg->AddInt( "_vid", video_id );
Message *reply = Messenger::SendReceiveMessage( "gui_server", 0, msg );
if ( reply == NULL )
{
delete msg;
return -1;
}
delete msg;
int ans = reply->rc();
if ( ans != 0 )
{
if ( msg->error() != NULL )
printf("%s%s\n","error: ", msg->error() );
}
delete reply;
return ans;
}
示例9: DeleteDesktop
int GUIControl::DeleteDesktop( int desktop_id )
{
Message *msg = new Message( DELETE );
msg->AddString( "_type", "desktop" );
msg->AddInt( "_id", desktop_id );
Message *reply = Messenger::SendReceiveMessage( "gui_server", 0, msg );
if ( reply == NULL )
{
delete msg;
return -1;
}
delete msg;
if ( reply->rc() != 0 )
{
if ( msg->error() != NULL )
printf("%s%s\n","error: ", msg->error() );
delete reply;
return -1;
}
delete reply;
return 0;
}
示例10: OkToQuit
bool EditWin::OkToQuit(void)
{
Message *m = new Message( ID_UNLOCK );
m->AddString( "id", m_cID );
m_pcMessenger->SendMessage( m );
return true;
}
示例11: SetMode
int GUIControl::SetMode( int video_id, int width, int height, int mode )
{
Message *msg = new Message( SET );
msg->AddString( "_type", "video_mode" );
msg->AddInt( "_id", video_id );
msg->AddInt( "_width", width );
msg->AddInt( "_height", height );
msg->AddInt( "_mode", mode );
Message *reply = Messenger::SendReceiveMessage( "gui_server", 0, msg );
if ( reply == NULL )
{
delete msg;
return -1;
}
int ans = reply->rc();
if ( ans != 0 )
{
if ( msg->error() != NULL )
printf("%s%s\n","error: ", msg->error() );
}
delete reply;
delete msg;
return ans;
}
示例12: SendCloseMessage
void IFaceWin::SendCloseMessage( void )
{
Messenger cMsnger( m_pcParent );
Message *pcMsg = new Message( CloseInterfaceWindow );
pcMsg->AddString( INTERFACE_NAME_KEY, m_pcIFace->GetName() );
cMsnger.SendMessage( pcMsg );
}
示例13: GetDriverList
int GUIControl::GetDriverList( List *drivers )
{
Message *msg = new Message( GET );
msg->AddString( "_type", "driver_list" );
Message *reply = Messenger::SendReceiveMessage( "gui_server", 0, msg );
if ( reply == NULL )
{
delete msg;
return -1;
}
delete msg;
if ( reply->rc() != 0 )
{
if ( msg->error() != NULL )
printf("%s%s\n","error: ", msg->error() );
delete reply;
return -1;
}
// --------------------------------
int id;
char *name;
char *description;
int count = 0;
while ( (reply->FindInt( "_id", count, &id )) == 0 )
{
if ( reply->FindString( "_description", count, (const char**)&description ) == 0 )
if ( reply->FindString( "_name", count, (const char**)&name ) == 0 )
{
struct video_driver_info *vd = new struct video_driver_info;
vd->id = id;
strncpy( vd->name, name, 1024 );
strncpy( vd->description, description, 1024 );
drivers->add( vd );
free( name );
free( description );
}
else free( description );
count += 1;
}
// --------------------------------
delete reply;
return 0;
}
示例14: GetSupportedModes
int GUIControl::GetSupportedModes( List* modes )
{
Message *msg = new Message( GET );
msg->AddString( "_type", "supported_modes" );
Message *reply = Messenger::SendReceiveMessage( "gui_server", 0, msg );
if ( reply == NULL )
{
delete msg;
return -1;
}
delete msg;
if ( reply->rc() != 0 )
{
if ( msg->error() != NULL )
printf("%s%s\n","error: ", msg->error() );
delete reply;
return -1;
}
// --------------------------------
int id;
int width;
int height;
int mode;
int count = 0;
while ( (reply->FindInt( "_id", count, &id )) == 0 )
{
if ( reply->FindInt( "_width", count, &width ) == 0 )
if ( reply->FindInt( "_height", count, &height ) == 0 )
if ( reply->FindInt( "_mode", count, &mode ) == 0 )
{
struct video_mode *vm = new struct video_mode;
vm->id = id;
vm->width = width;
vm->height = height;
vm->mode = mode;
modes->add( vm );
}
count += 1;
}
// --------------------------------
delete reply;
return 0;
}
示例15: SendRC
/** Convenience method to sends a reply Message with a
* what value of "OK", and the given "rc" and "_error"
* parameters.
*
* \param rc The return code which will be embedded as an Int named "rc".
* \param error The return string to embed as "_error". Nothing is embedded
* if NULL is specified.
*
* \return 0 if the reply was sent successfully.
*/
int Message::SendRC( int rc, char *error )
{
Message *msg = new Message( OK );
msg->AddInt( "rc", rc );
if ( error != NULL ) msg->AddString( "_error", error );
int ans = SendReply( msg );
delete msg;
return ans;
}