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


C++ endTag函数代码示例

本文整理汇总了C++中endTag函数的典型用法代码示例。如果您正苦于以下问题:C++ endTag函数的具体用法?C++ endTag怎么用?C++ endTag使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了endTag函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: TEST

/* ****************************************************************************
*
* endTag - 
*/
TEST(commonTag, endTag)
{
   std::string      tag    = "TAG";
   std::string      indent = "  ";
   std::string      xml    = "  </TAG>\n";
   std::string      json   = "  }\n";
   std::string      out;

   out = endTag(indent, tag, XML);
   EXPECT_EQ(xml, out);

   out = endTag(indent, tag, JSON);
   EXPECT_EQ(json, out);
}
开发者ID:Aeronbroker,项目名称:fiware-orion,代码行数:18,代码来源:commonTag_test.cpp

示例2: startTag

/* ****************************************************************************
*
* QueryContextResponse::render - 
*/
std::string QueryContextResponse::render(RequestType requestType, Format format, std::string indent)
{
  std::string out = "";
  std::string tag = "queryContextResponse";

  out += startTag(indent, tag, format, false);

  if ((errorCode.code == SccNone) || (errorCode.code == SccOk))
  {
    if (contextElementResponseVector.size() == 0)
    {
      errorCode.fill(SccContextElementNotFound);
      out += errorCode.render(format, indent + "  ");
    }
    else 
    {
      out += contextElementResponseVector.render(QueryContext, format, indent + "  ");
    }
  }
  else
     out += errorCode.render(format, indent + "  ");

  out += endTag(indent, tag, format);

  return out;
}
开发者ID:agallegoc,项目名称:fiware-orion,代码行数:30,代码来源:QueryContextResponse.cpp

示例3: isValueStr

    static bool isValueStr(const STString &str)
    {
        bool ret = false;
        if( str.empty() ) {
            return ret;
        }

        STString valueTag = getFirstTagName(str);
        if ("bool" != valueTag && "int" != valueTag && "string" != valueTag) {
            return ret;
        }
        STString startTag("<" + valueTag + ">");
        STString endTag("</" + valueTag + ">");

        int beginPos = str.find(startTag);
        int endPos = str.find_last_of(endTag);

        if (findError(beginPos) || findError(endPos) ) {
            return ret;
        }
        else {
            ret = true;
        }

        return ret;
    }
开发者ID:szj535849741,项目名称:StoneFramework,代码行数:26,代码来源:STDataItem.cpp

示例4: startTag

/* ****************************************************************************
*
* SubscribeContextRequest::render - 
*/
std::string SubscribeContextRequest::render(RequestType requestType, Format format, const std::string& indent)
{
  std::string  out                             = "";
  std::string  tag                             = "subscribeContextRequest";
  std::string  indent2                         = indent + "  ";

  bool         attributeListRendered           = attributeList.size() != 0;
  bool         referenceRendered               = true;  // Mandatory
  bool         durationRendered                = duration.get() != "";
  bool         restrictionRendered             = restrictions != 0;
  bool         notifyConditionVectorRendered   = notifyConditionVector.size() != 0;
  bool         throttlingRendered              = throttling.get() != "";

  bool         commaAfterThrottling            = false; // Last element;
  bool         commaAfterNotifyConditionVector = throttlingRendered;
  bool         commaAfterRestriction           = notifyConditionVectorRendered || throttlingRendered;
  bool         commaAfterDuration              = restrictionRendered || notifyConditionVectorRendered || throttlingRendered;
  bool         commaAfterReference             = durationRendered || restrictionRendered ||notifyConditionVectorRendered || throttlingRendered;
  bool         commaAfterAttributeList         = referenceRendered || durationRendered || restrictionRendered ||notifyConditionVectorRendered || throttlingRendered;
  bool         commaAfterEntityIdVector        = attributeListRendered || referenceRendered || durationRendered || restrictionRendered ||notifyConditionVectorRendered || throttlingRendered;

  out += startTag(indent, tag, format, false);
  out += entityIdVector.render(format, indent2, commaAfterEntityIdVector);
  out += attributeList.render(format, indent2, commaAfterAttributeList);
  out += reference.render(format, indent2, commaAfterReference);
  out += duration.render(format, indent2, commaAfterDuration);
  out += restriction.render(format, indent2, restrictions, commaAfterRestriction);
  out += notifyConditionVector.render(format, indent2, commaAfterNotifyConditionVector);
  out += throttling.render(format, indent2, commaAfterThrottling);
  out += endTag(indent, tag, format);

  return out;
}
开发者ID:PascaleBorscia,项目名称:fiware-orion,代码行数:37,代码来源:SubscribeContextRequest.cpp

示例5: startTag

/* ****************************************************************************
*
* ContextElementVector::render -
*/
std::string ContextElementVector::render
(
  ConnectionInfo*     ciP,
  RequestType         requestType,
  const std::string&  indent,
  bool                comma
)
{
  std::string  out     = "";
  std::string  xmlTag  = "contextElementList";
  std::string  jsonTag = "contextElements";

  if (vec.size() == 0)
  {
    return "";
  }

  out += startTag(indent, xmlTag, jsonTag, ciP->outFormat, true, true);

  for (unsigned int ix = 0; ix < vec.size(); ++ix)
  {
    out += vec[ix]->render(ciP, requestType, indent + "  ", ix != vec.size() - 1);
  }

  out += endTag(indent, xmlTag, ciP->outFormat, comma, true);

  return out;
}
开发者ID:PascaleBorscia,项目名称:fiware-orion,代码行数:32,代码来源:ContextElementVector.cpp

示例6: startTag

/* ****************************************************************************
*
* UpdateContextResponse::render - 
*/
std::string UpdateContextResponse::render(ConnectionInfo* ciP, RequestType requestType, const std::string& indent)
{
  std::string out = "";
  std::string tag = "updateContextResponse";

  out += startTag(indent, tag, ciP->outFormat, false);

  if ((errorCode.code != SccNone) && (errorCode.code != SccOk))
  {
    out += errorCode.render(ciP->outFormat, indent + "  ");
  }
  else
  {
    if (contextElementResponseVector.size() == 0)
    {
      errorCode.fill(SccContextElementNotFound, errorCode.details);
      out += errorCode.render(ciP->outFormat, indent + "  ");
    }
    else
      out += contextElementResponseVector.render(ciP, RtUpdateContextResponse, indent + "  ", false);
  }
  
  out += endTag(indent, tag, ciP->outFormat);

  return out;
}
开发者ID:fiwareulpgcmirror,项目名称:fiware-orion,代码行数:30,代码来源:UpdateContextResponse.cpp

示例7: startTag

/* ****************************************************************************
*
* EntityTypeVector::render -
*/
std::string EntityTypeVector::render
(
  ConnectionInfo*     ciP,
  const std::string&  indent,
  bool                comma
)
{
  std::string out      = "";
  std::string xmlTag   = "typeEntities";
  std::string jsonTag  = "types";


  if (vec.size() > 0)
  {

    out += startTag(indent, xmlTag, jsonTag, ciP->outFormat, true, true);

    for (unsigned int ix = 0; ix < vec.size(); ++ix)
    {
      out += vec[ix]->render(ciP, indent + "  ", ix != vec.size() - 1);
    }
    out += endTag(indent, xmlTag, ciP->outFormat, comma, true);
  }

  return out;
}
开发者ID:NozomiNetworks,项目名称:fiware-orion,代码行数:30,代码来源:EntityTypeVector.cpp

示例8: startTag

/* ****************************************************************************
*
* DiscoverContextAvailabilityResponse::toJsonV1 -
*/
std::string DiscoverContextAvailabilityResponse::toJsonV1(void)
{
  std::string  out = "";

  //
  // JSON commas:
  // Exactly ONE of responseVector|errorCode is included in the discovery response so,
  // no JSON commas necessary
  //
  out += startTag();
  
  if (responseVector.size() > 0)
  {
    bool commaNeeded = (errorCode.code != SccNone);
    out += responseVector.toJsonV1(commaNeeded);
  }

  if (errorCode.code != SccNone)
  {
    out += errorCode.toJsonV1(false);
  }

  /* Safety check: neither errorCode nor CER vector was filled by mongoBackend */
  if (errorCode.code == SccNone && responseVector.size() == 0)
  {
      errorCode.fill(SccReceiverInternalError, "Both the error-code structure and the response vector were empty");
      out += errorCode.toJsonV1(false);
  }

  out += endTag();

  return out;
}
开发者ID:telefonicaid,项目名称:fiware-orion,代码行数:37,代码来源:DiscoverContextAvailabilityResponse.cpp

示例9: renderAsJsonObject

/* ****************************************************************************
*
* TypeEntityVector::render -
*/
std::string TypeEntityVector::render
(
  ConnectionInfo*     ciP,
  const std::string&  indent,
  bool                comma
)
{
  std::string out      = "";
  std::string xmlTag   = "typeEntities";
  std::string jsonTag  = "types";


  if (vec.size() > 0)
  {
    if ((ciP->uriParam["attributesFormat"] == "object") && (ciP->outFormat == JSON))
    {
      return renderAsJsonObject(ciP, indent, comma);
    }

    out += startTag(indent, xmlTag, jsonTag, ciP->outFormat, true, true);

    for (unsigned int ix = 0; ix < vec.size(); ++ix)
    {
      out += vec[ix]->render(ciP, indent + "  ", ix != vec.size() - 1);
    }
    out += endTag(indent, xmlTag, ciP->outFormat, comma, true);
  }

  return out;
}
开发者ID:AlvaroVega,项目名称:fiware-orion,代码行数:34,代码来源:TypeEntityVector.cpp

示例10: calloc

/* ****************************************************************************
*
* StatusCode::render -
*/
std::string StatusCode::render(Format format, const std::string& indent, bool comma, bool showTag)
{
    std::string  out  = "";

    if (strstr(details.c_str(), "\"") != NULL)
    {
        int    len = details.length() * 2;
        char*  s2    = (char*) calloc(1, len + 1);

        strReplace(s2, len, details.c_str(), "\"", "\\\"");
        details = s2;
        free(s2);
    }

    if (code == SccNone)
    {
        fill(SccReceiverInternalError, "");
        details += " - ZERO code set to 500";
    }

    out += startTag(indent, tag, format, showTag);
    out += valueTag(indent + "  ", "code", code, format, true);
    out += valueTag(indent + "  ", "reasonPhrase", reasonPhrase, format, details != "");

    if (details != "")
    {
        out += valueTag(indent + "  ", "details", details, format, false);
    }

    out += endTag(indent, tag, format, comma);

    return out;
}
开发者ID:d0ugal,项目名称:fiware-orion,代码行数:37,代码来源:StatusCode.cpp

示例11: startTag1

/* ****************************************************************************
*
* render -
*/
std::string UpdateContextElementResponse::render
(
  ConnectionInfo*     ciP,
  RequestType         requestType,
  const std::string&  indent
)
{
  std::string tag = "updateContextElementResponse";
  std::string out = "";

  out += startTag1(indent, tag, false);

  if ((errorCode.code != SccNone) && (errorCode.code != SccOk))
  {
    out += errorCode.render(indent + "  ");
  }
  else
  {
    out += contextAttributeResponseVector.render(ciP, requestType, indent + "  ");
  }

  out += endTag(indent);

  return out;
}
开发者ID:Findeton,项目名称:fiware-orion,代码行数:29,代码来源:UpdateContextElementResponse.cpp

示例12: startTag

/* ****************************************************************************
*
* AppendContextElementResponse::render - 
*/
std::string AppendContextElementResponse::render(ConnectionInfo* ciP, RequestType requestType, std::string indent)
{
  std::string tag = "appendContextElementResponse";
  std::string out = "";

  out += startTag(indent, tag, ciP->outFormat, false);

  if ((errorCode.code != SccNone) && (errorCode.code != SccOk))
  {
    out += errorCode.render(ciP->outFormat, indent + "  ");
  }
  else
  {
    if (entity.id != "")
    {
      out += entity.render(ciP->outFormat, indent + "  ", true);
    }

    out += contextResponseVector.render(ciP, requestType, indent + "  ");
  }

  out += endTag(indent, tag, ciP->outFormat);

  return out;
}
开发者ID:AlvaroVega,项目名称:fiware-orion,代码行数:29,代码来源:AppendContextElementResponse.cpp

示例13: startTag

/* ****************************************************************************
*
* OrionError::render - 
*/
std::string OrionError::render(Format format, const std::string& _indent)
{
  std::string out           = "";
  std::string tag           = "orionError";
  std::string initialIndent = _indent;
  std::string indent        = _indent;

  //
  // OrionError is NEVER part of any other payload, so the JSON start/end braces must be added here
  //

  if (format == JSON)
  {
    out     = initialIndent + "{\n";
    indent += "  ";
  }

  out += startTag(indent, tag, format);
  out += valueTag(indent + "  ", "code",          code,         format, true);
  out += valueTag(indent + "  ", "reasonPhrase",  reasonPhrase, format, details != "");

  if (details != "")
    out += valueTag(indent + "  ", "details",       details,      format);

  out += endTag(indent, tag, format);

  if (format == JSON)
    out += initialIndent + "}\n";

  return out;
}
开发者ID:B-Rich,项目名称:fiware-orion,代码行数:35,代码来源:OrionError.cpp

示例14: parsedUptime

/* ****************************************************************************
*
* versionTreat - 
*/
std::string versionTreat
(
  ConnectionInfo*            ciP,
  int                        components,
  std::vector<std::string>&  compV,
  ParseData*                 parseDataP
)
{
  std::string out     = "";
  std::string tag     = "orion";
  std::string indent  = "";

#ifdef UNIT_TEST
  std::string uptime = "0 d, 0 h, 0 m, 0 s";
#else
  std::string uptime = parsedUptime(getTimer()->getCurrentTime() - startTime);
#endif

  out += startTag1(indent, tag, true, true);
  out += valueTag1(indent + "  ", "version",       versionString,   true);
  out += valueTag1(indent + "  ", "uptime",        uptime,          true);
  out += valueTag1(indent + "  ", "git_hash",      GIT_HASH,        true);
  out += valueTag1(indent + "  ", "compile_time",  COMPILE_TIME,    true);
  out += valueTag1(indent + "  ", "compiled_by",   COMPILED_BY,     true);
  out += valueTag1(indent + "  ", "compiled_in",   COMPILED_IN,     false);
  out += endTag(indent, false, false, true, true);

  ciP->httpStatusCode = SccOk;
  return out;
}
开发者ID:Findeton,项目名称:fiware-orion,代码行数:34,代码来源:versionTreat.cpp

示例15: startTag

/* ****************************************************************************
*
* ContextElement::render - 
*/
std::string ContextElement::render(ConnectionInfo* ciP, RequestType requestType, const std::string& indent, bool comma)
{
  std::string  out                              = "";
  std::string  xmlTag                           = "contextElement";
  std::string  jsonTag                          = "contextElement";
  bool         attributeDomainNameRendered      = attributeDomainName.get() != "";
  bool         contextAttributeVectorRendered   = contextAttributeVector.size() != 0;
  bool         domainMetadataVectorRendered     = domainMetadataVector.size() != 0;

  bool         commaAfterDomainMetadataVector   = false;  // Last element
  bool         commaAfterContextAttributeVector = domainMetadataVectorRendered;
  bool         commaAfterAttributeDomainName    = domainMetadataVectorRendered  || contextAttributeVectorRendered;
  bool         commaAfterEntityId               = commaAfterAttributeDomainName || attributeDomainNameRendered;

  out += startTag(indent, xmlTag, jsonTag, ciP->outFormat, false, true);

  out += entityId.render(ciP->outFormat, indent + "  ", commaAfterEntityId, false);
  out += attributeDomainName.render(ciP->outFormat, indent + "  ", commaAfterAttributeDomainName);
  out += contextAttributeVector.render(ciP, requestType, indent + "  ", commaAfterContextAttributeVector);
  out += domainMetadataVector.render(ciP->outFormat, indent + "  ", commaAfterDomainMetadataVector);

  out += endTag(indent, xmlTag, ciP->outFormat, comma, false);

  return out;
}
开发者ID:dmartr,项目名称:fiware-orion,代码行数:29,代码来源:ContextElement.cpp


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