Qt 4.8
Public Functions | Public Variables | List of all members
QWSProtocolItem Struct Reference

#include <qwsprotocolitem_qws.h>

Inheritance diagram for QWSProtocolItem:
QWSCommand QWSEvent QWSAddPropertyCommand QWSChangeAltitudeCommand QWSConvertSelectionCommand QWSCreateCommand QWSDefineCursorCommand QWSEmbedCommand QWSFontCommand QWSGetPropertyCommand QWSGrabKeyboardCommand QWSGrabMouseCommand QWSIdentifyCommand QWSIMMouseCommand QWSIMResponseCommand QWSIMUpdateCommand QWSPlaySoundCommand QWSPositionCursorCommand QWSQCopRegisterChannelCommand QWSQCopSendCommand QWSRegionCommand QWSRegionDestroyCommand QWSRegionMoveCommand QWSRegionNameCommand QWSRemovePropertyCommand QWSRepaintRegionCommand QWSRequestFocusCommand QWSScreenTransformCommand QWSSelectCursorCommand QWSSetOpacityCommand QWSSetPropertyCommand QWSSetSelectionOwnerCommand QWSConnectedEvent QWSCreationEvent QWSEmbedEvent QWSFocusEvent QWSFontEvent QWSIMEvent QWSIMInitEvent QWSIMQueryEvent QWSKeyEvent QWSMaxWindowRectEvent QWSMouseEvent QWSPropertyNotifyEvent QWSPropertyReplyEvent QWSQCopMessageEvent QWSRegionEvent QWSScreenTransformationEvent QWSSelectionClearEvent QWSSelectionNotifyEvent QWSSelectionRequestEvent QWSWindowOperationEvent

Public Functions

void copyFrom (const QWSProtocolItem *item)
 
 QWSProtocolItem (int t, int len, char *ptr)
 
bool read (QIODevice *s)
 
virtual void setData (const char *data, int len, bool allocateMem=true)
 
void write (QIODevice *s)
 
virtual ~QWSProtocolItem ()
 

Public Variables

int bytesRead
 
bool deleteRaw
 
char * rawDataPtr
 
int rawLen
 
char * simpleDataPtr
 
int simpleLen
 
int type
 

Detailed Description

Definition at line 61 of file qwsprotocolitem_qws.h.

Constructors and Destructors

◆ QWSProtocolItem()

QWSProtocolItem::QWSProtocolItem ( int  t,
int  len,
char *  ptr 
)
inline

Definition at line 64 of file qwsprotocolitem_qws.h.

◆ ~QWSProtocolItem()

QWSProtocolItem::~QWSProtocolItem ( )
virtual

Definition at line 432 of file qwscommand_qws.cpp.

Referenced by QWSProtocolItem().

432  {
433  if (deleteRaw)
434  delete []rawDataPtr;
435 }

Functions

◆ copyFrom()

void QWSProtocolItem::copyFrom ( const QWSProtocolItem item)

Definition at line 472 of file qwscommand_qws.cpp.

Referenced by qt_client_enqueue(), and qt_server_enqueue().

472  {
473  if (this == item)
474  return;
475  simpleLen = item->simpleLen;
476  memcpy(simpleDataPtr, item->simpleDataPtr, simpleLen);
477  setData(item->rawDataPtr, item->rawLen);
478 }
virtual void setData(const char *data, int len, bool allocateMem=true)

◆ read()

bool QWSProtocolItem::read ( QIODevice s)

Definition at line 448 of file qwscommand_qws.cpp.

Referenced by RequestAnalyzer::analyze().

448  {
449 #ifdef QWSCOMMAND_DEBUG
450  QLatin1String reread( (rawLen == -1) ? "" : "REREAD");
451  if (qwsServer)
452  qDebug() << "QWSProtocolItem::read reading type " << static_cast<QWSCommand::Type>(type) << reread;
453  else
454  qDebug() << "QWSProtocolItem::read reading event " << (type < N_EVENTS ? eventNames[type] : "unknown") << reread;
455  //qDebug("QWSProtocolItem::read reading event %s", type < N_EVENTS ? eventNames[type] : "unknown");
456 #endif
458  if (b) {
459  setData(rawDataPtr, rawLen, false);
460  deleteRaw = true;
461  }
462 #ifdef QWSCOMMAND_DEBUG
463  else
464  {
465  qDebug() << "error in reading command " << static_cast<QWSCommand::Type>(type);
466  }
467 #endif
468  return b;
469 }
bool qws_read_command(QIODevice *socket, char *&simpleData, int &simpleLen, char *&rawData, int &rawLen, int &bytesRead)
virtual void setData(const char *data, int len, bool allocateMem=true)
Q_CORE_EXPORT void qDebug(const char *,...)
The QLatin1String class provides a thin wrapper around an US-ASCII/Latin-1 encoded string literal...
Definition: qstring.h:654
QWSServer Q_GUI_EXPORT * qwsServer

◆ setData()

void QWSProtocolItem::setData ( const char *  data,
int  len,
bool  allocateMem = true 
)
virtual

Reimplemented in QWSFontCommand, QWSEmbedCommand, QWSIMResponseCommand, QWSQCopSendCommand, QWSQCopRegisterChannelCommand, QWSPlaySoundCommand, QWSDefineCursorCommand, QWSFontEvent, QWSRepaintRegionCommand, QWSSetPropertyCommand, QWSIMInitEvent, QWSIMEvent, QWSQCopMessageEvent, QWSPropertyReplyEvent, QWSEmbedEvent, QWSRegionCommand, QWSRegionEvent, QWSRegionNameCommand, QWSIdentifyCommand, and QWSConnectedEvent.

Definition at line 480 of file qwscommand_qws.cpp.

Referenced by QWSQCopRegisterChannelCommand::setChannel(), QWSConnectedEvent::setData(), QWSIdentifyCommand::setData(), QWSRegionNameCommand::setData(), QWSRegionEvent::setData(), QWSRegionCommand::setData(), QWSEmbedEvent::setData(), QWSPropertyReplyEvent::setData(), QWSQCopMessageEvent::setData(), QWSIMEvent::setData(), QWSIMInitEvent::setData(), QWSSetPropertyCommand::setData(), QWSRepaintRegionCommand::setData(), QWSFontEvent::setData(), QWSDefineCursorCommand::setData(), QWSPlaySoundCommand::setData(), QWSQCopRegisterChannelCommand::setData(), QWSQCopSendCommand::setData(), QWSIMResponseCommand::setData(), QWSEmbedCommand::setData(), QWSFontCommand::setData(), QWSQCopMessageEvent::setDataDirect(), QWSPlaySoundCommand::setFileName(), QWSFontCommand::setFontName(), QWSIdentifyCommand::setId(), QWSQCopSendCommand::setMessage(), QWSRegionNameCommand::setName(), and QWSIMResponseCommand::setResult().

480  {
481  if (deleteRaw)
482  delete [] rawDataPtr;
483  if (!data || len <= 0) {
484  rawDataPtr = 0;
485  rawLen = 0;
486  return;
487  }
488  if (allocateMem) {
489  rawDataPtr = new char[len];
490  memcpy(rawDataPtr, data, len);
491  deleteRaw = true;
492  } else {
493  rawDataPtr = const_cast<char *>(data);
494  deleteRaw = false;
495  }
496  rawLen = len;
497 }
static const char * data(const QByteArray &arr)

◆ write()

void QWSProtocolItem::write ( QIODevice s)

Definition at line 438 of file qwscommand_qws.cpp.

Referenced by QWSDisplay::Data::init(), QWSDisplay::Data::reinit(), QWSDisplay::Data::sendCommand(), QWSDisplay::Data::sendSynchronousCommand(), and QWSDisplay::Data::~Data().

438  {
439 #ifdef QWSCOMMAND_DEBUG
440  if (!qwsServer)
441  qDebug() << "QWSProtocolItem::write sending type " << static_cast<QWSCommand::Type>(type);
442  else
443  qDebug() << "QWSProtocolItem::write sending event " << (type < N_EVENTS ? eventNames[type] : "unknown");
444 #endif
446 }
Q_CORE_EXPORT void qDebug(const char *,...)
void qws_write_command(QIODevice *socket, int type, char *simpleData, int simpleLen, char *rawData, int rawLen)
QWSServer Q_GUI_EXPORT * qwsServer

Properties

◆ bytesRead

int QWSProtocolItem::bytesRead

Definition at line 87 of file qwsprotocolitem_qws.h.

◆ deleteRaw

bool QWSProtocolItem::deleteRaw

◆ rawDataPtr

char* QWSProtocolItem::rawDataPtr

◆ rawLen

int QWSProtocolItem::rawLen

◆ simpleDataPtr

char* QWSProtocolItem::simpleDataPtr

◆ simpleLen

int QWSProtocolItem::simpleLen

Definition at line 71 of file qwsprotocolitem_qws.h.

Referenced by copyFrom(), and QWSDisplay::Data::flush().

◆ type

int QWSProtocolItem::type

The documentation for this struct was generated from the following files: