The Q3NetworkOperation class provides common operations for network protocols. 更多...
| 头: | #include <Q3NetworkOperation> |
| 继承: | QObject |
| Q3NetworkOperation (Q3NetworkProtocol::Operation operation , const QString & arg0 , const QString & arg1 , const QString & arg2 ) | |
| Q3NetworkOperation (Q3NetworkProtocol::Operation operation , const QByteArray & arg0 , const QByteArray & arg1 , const QByteArray & arg2 ) | |
| ~Q3NetworkOperation () | |
| QString | arg (int num ) const |
| int | errorCode () const |
| void | free () |
| Q3NetworkProtocol::Operation | operation () const |
| QString | protocolDetail () const |
| QByteArray | rawArg (int num ) const |
| void | setArg (int num , const QString & arg ) |
| void | setErrorCode (int ec ) |
| void | setProtocolDetail (const QString & detail ) |
| void | setRawArg (int num , const QByteArray & arg ) |
| void | setState (Q3NetworkProtocol::State state ) |
| Q3NetworkProtocol::State | state () const |
The Q3NetworkOperation class provides common operations for network protocols.
An object is created to describe the operation and the current state for each operation that a network protocol should process.
另请参阅 Q3NetworkProtocol .
Constructs a network operation object. operation is the type of the operation, and arg0 , arg1 and arg2 are the first three arguments of the operation. The state is initialized to Q3NetworkProtocol::StWaiting .
另请参阅 Q3NetworkProtocol::Operation and Q3NetworkProtocol::State .
Constructs a network operation object. operation is the type of the operation, and arg0 , arg1 and arg2 are the first three raw data arguments of the operation. The state is initialized to Q3NetworkProtocol::StWaiting .
另请参阅 Q3NetworkProtocol::Operation and Q3NetworkProtocol::State .
析构函数。
Returns the operation's num -th argument. If this argument was not already set, an empty string is returned.
另请参阅 setArg ().
Returns the error code for the last error that occurred.
另请参阅 setErrorCode ().
Sets this object to delete itself when it hasn't been used for one second.
因为 Q3NetworkOperation pointers are passed around a lot the Q3NetworkProtocol generally does not have enough knowledge to delete these at the correct time. If a Q3NetworkProtocol doesn't need an operation any more it will call this function instead.
Note: you should never need to call the method yourself.
Returns the type of the operation.
Returns a detailed error message for the last error. This must have been set using setProtocolDetail ().
另请参阅 setProtocolDetail ().
Returns the operation's num -th raw data argument. If this argument was not already set, an empty bytearray is returned.
另请参阅 setRawArg ().
Sets the network operation's num -th argument to arg .
另请参阅 arg ().
Sets the error code to ec .
If the operation failed, the protocol should set an error code to describe the error in more detail. If possible, one of the error codes defined in Q3NetworkProtocol should be used.
另请参阅 errorCode (), setProtocolDetail (),和 Q3NetworkProtocol::Error .
If the operation failed, the error message can be specified as detail .
另请参阅 protocolDetail ().
Sets the network operation's num -th raw data argument to arg .
另请参阅 rawArg ().
设置 state of the operation object. This should be done by the network protocol during processing; at the end it should be set to Q3NetworkProtocol::StDone or Q3NetworkProtocol::StFailed , depending on success or failure.
另请参阅 state () 和 Q3NetworkProtocol::State .
Returns the state of the operation. You can determine whether an operation is still waiting to be processed, is being processed, has been processed successfully, or failed.
另请参阅 setState ().