本文整理汇总了C++中StringVec::append方法的典型用法代码示例。如果您正苦于以下问题:C++ StringVec::append方法的具体用法?C++ StringVec::append怎么用?C++ StringVec::append使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StringVec
的用法示例。
在下文中一共展示了StringVec::append方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: handle
/****************************************************************************
**
** Author: Marc Bowes
** Author: Tim Sjoberg
**
** Extracts variable information from the login packet
** FIXME: Poll data looks fishy
**
****************************************************************************/
VariableHash Login::handle(const QByteArray &packet)
{
/*
== PACKET FORMAT
***************************************************************************
**
** 1\0
** errorCode[\1errorMessage]\0
** sesid\0
** deprecated\1loginname\1dateTime\1URL\1
** maxSupportedVer\1pricePlan\1flags
** [\0Poll data]
**
***************************************************************************
== DEFINITIONS
***************************************************************************
**
** sesid the session ID (>1 for HTTP connections and 0 for
** TCP connections)
** deprecated deprecated functionality (expect an empty string)
** loginname the user's loginname
** dateTime the date and time in number of seconds since
** 1 January 1970 (UTC)
** URL is the URL of the proxy handling your current
** session. Use this URL to reconnect to if
** disconnected.
** maxSupportedVer maximum protocol version supported by the server
** (major*10+minor)
** pricePlan the price plan the user is on:
** 1 - free
** 2 - premium
** flags contains specific flags for this user. At the
** moment only indicates if session is encrypted or not.
** poll data if getContacts was set to 1, this will contain the
** user's contacts as well as their presence information
** and all new messages;
**
***************************************************************************
== ERRORS
***************************************************************************
**
** 3 Invalid password
** 16 Redirect[1] to new proxy
** 99 Something went wrong
**
***************************************************************************
== NOTES
***************************************************************************
**
** [1] Redirect
** The client is requested to redirect to the URL specified in the
** errorMessage field. The URL will be in the following format:
** protocol://host:port;type[;msg]
**
***************************************************************************
*/
/* setup */
StringVec variables;
/* first break up packet by \0 into variable sections */
variables.append("sesid"); /* sesid\0 */
variables.append("data"); /* deprecated..flags\0 */
/* extract \0 seperated values */
VariableHash pass1 = hashVariables(packet, variables, '\0');
/* need to expand data section */
variables.clear();
variables.append("deprecated");
variables.append("loginname");
variables.append("dateTime");
variables.append("URL");
variables.append("maxSuppertedVer");
variables.append("pricePlan");
variables.append("flags");
/* extract \1 seperated values */
VariableHash pass2 = hashVariables(pass1["data"], variables, '\1');
/* no clean-up needed, just return the variables */
return pass1.unite(pass2);
}
示例2: handle
/****************************************************************************
**
** Author: Tim Sjoberg
**
** Extracts variable information from the register packet
**
****************************************************************************/
VariableHash Register::handle(const QByteArray &packet)
{
/*
== PACKET FORMAT
***************************************************************************
**
** 11 \0
** errorCode [ \1 errorMessage ] \0
** sesid \0
** deprecated \1 loginname \1 timeStamp \1 serverIP \1 maxSupportedVer \1 pricePlan \1
** flags \0
** hiddenLoginname
** [ \0 Poll data ]
**
***************************************************************************
== DEFINITIONS
***************************************************************************
**
** errorCode see 1. Login
** deprecated deprecated functionality (expect an empty string)
** loginname is the user's loginname
** timeStamp the number of seconds since 1 January 1970 (UTC)
** serverIP the IP address of the server
** maxSupportedVer maximum protocol version supported by the server
** (major*10+minor)
** pricePlan the price plan the user is on:
** 1 - free
** 2 - premium
** flags specific flags for this user
** hiddenLoginname specifies whether the user's loginname should be
** hidden when inviting a contact:
** 0 - not hidden
** 1 - hidden
** poll data this will contain the user's contacts as well as
** their presence information and all new messages.
**
***************************************************************************
*/
StringVec variables;
/* first break up packet by \0 into variable sections */
variables.append("sesid"); /* sesid\0 */
variables.append("data"); /* deprecated..flags\0 */
variables.append("hiddenLoginname");
/* extract \0 seperated values */
VariableHash pass1 = hashVariables(packet, variables, '\0');
/* need to expand data section */
variables.clear();
variables.append("deprecated");
variables.append("loginname");
variables.append("dateTime");
variables.append("URL");
variables.append("maxSuppertedVer");
variables.append("pricePlan");
variables.append("flags");
/* extract \1 seperated values */
VariableHash pass2 = hashVariables(pass1["data"], variables, '\1');
/* no clean-up needed, just return the variables */
return pass1.unite(pass2);
return VariableHash();
}