当前位置: 首页>>代码示例>>C++>>正文


C++ StringVec::append方法代码示例

本文整理汇总了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);
}
开发者ID:marcbowes,项目名称:mxitc,代码行数:95,代码来源:01_login.cpp

示例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();
}
开发者ID:marcbowes,项目名称:mxitc,代码行数:75,代码来源:11_register.cpp


注:本文中的StringVec::append方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。