• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ AppendToString函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: AppendToString

nsACString&
ThebesLayer::PrintInfo(nsACString& aTo, const char* aPrefix)
{
  Layer::PrintInfo(aTo, aPrefix);
  return mValidRegion.IsEmpty() ?
    aTo : AppendToString(aTo, mValidRegion, " [valid=", "]");
}
开发者ID:lofter2011,项目名称:Icefox,代码行数:7,代码来源:Layers.cpp


示例2: NS_ENSURE_ARG

NS_IMETHODIMP 
nsXMLContentSerializer::AppendCDATASection(nsIDOMCDATASection* aCDATASection,
                                           PRInt32 aStartOffset,
                                           PRInt32 aEndOffset,
                                           nsAString& aStr)
{
  NS_ENSURE_ARG(aCDATASection);
  nsresult rv;

  AppendToString(NS_LITERAL_STRING("<![CDATA["), aStr);
  rv = AppendTextData(aCDATASection, aStartOffset, aEndOffset, aStr, PR_FALSE, PR_TRUE);
  if (NS_FAILED(rv)) return NS_ERROR_FAILURE;  
  AppendToString(NS_LITERAL_STRING("]]>"), aStr);

  return NS_OK;
}
开发者ID:EdgarChen,项目名称:mozilla-cvs-history,代码行数:16,代码来源:nsXMLContentSerializer.cpp


示例3: AppendToString

void
nsHTMLContentSerializer::EndIndentation(nsIAtom* aName,
                                        PRBool aHasDirtyAttr,
                                        nsAString& aStr)
{
    if ((aName == nsGkAtoms::head) ||
            (aName == nsGkAtoms::table) ||
            (aName == nsGkAtoms::tr) ||
            (aName == nsGkAtoms::ul) ||
            (aName == nsGkAtoms::ol) ||
            (aName == nsGkAtoms::dl) ||
            (aName == nsGkAtoms::li) ||
            (aName == nsGkAtoms::tbody) ||
            (aName == nsGkAtoms::form) ||
            (aName == nsGkAtoms::blockquote) ||
            (aName == nsGkAtoms::dt) ||
            (aName == nsGkAtoms::dd) ||
            (aName == nsGkAtoms::frameset)) {
        mIndent--;
    }

    if ((mDoFormat || aHasDirtyAttr) && !mPreLevel && !mColPos) {
        for (PRInt32 i = mIndent; --i >= 0; ) {
            AppendToString(kIndentStr, aStr);
        }
    }
}
开发者ID:rhencke,项目名称:mozilla-cvs-history,代码行数:27,代码来源:nsHTMLContentSerializer.cpp


示例4: NS_ENSURE_TRUE

bool
nsXHTMLContentSerializer::AfterElementStart(nsIContent* aContent,
                                            nsIContent* aOriginalElement,
                                            nsAString& aStr)
{
  nsIAtom *name = aContent->Tag();
  if (aContent->GetNameSpaceID() == kNameSpaceID_XHTML &&
      mRewriteEncodingDeclaration &&
      name == nsGkAtoms::head) {

    // Check if there already are any content-type meta children.
    // If there are, they will be modified to use the correct charset.
    // If there aren't, we'll insert one here.
    bool hasMeta = false;
    for (nsIContent* child = aContent->GetFirstChild();
         child;
         child = child->GetNextSibling()) {
      if (child->IsHTML(nsGkAtoms::meta) &&
          child->HasAttr(kNameSpaceID_None, nsGkAtoms::content)) {
        nsAutoString header;
        child->GetAttr(kNameSpaceID_None, nsGkAtoms::httpEquiv, header);

        if (header.LowerCaseEqualsLiteral("content-type")) {
          hasMeta = true;
          break;
        }
      }
    }

    if (!hasMeta) {
      NS_ENSURE_TRUE(AppendNewLineToString(aStr), false);
      if (mDoFormat) {
        NS_ENSURE_TRUE(AppendIndentation(aStr), false);
      }
      NS_ENSURE_TRUE(AppendToString(NS_LITERAL_STRING("<meta http-equiv=\"content-type\""), aStr), false);
      NS_ENSURE_TRUE(AppendToString(NS_LITERAL_STRING(" content=\"text/html; charset="), aStr), false);
      NS_ENSURE_TRUE(AppendToString(NS_ConvertASCIItoUTF16(mCharset), aStr), false);
      if (mIsHTMLSerializer) {
        NS_ENSURE_TRUE(AppendToString(NS_LITERAL_STRING("\">"), aStr), false);
      } else {
        NS_ENSURE_TRUE(AppendToString(NS_LITERAL_STRING("\" />"), aStr), false);
      }
    }
  }

  return true;
}
开发者ID:AOSC-Dev,项目名称:Pale-Moon,代码行数:47,代码来源:nsXHTMLContentSerializer.cpp


示例5: AppendToString

globle char *AppendStrings(
  void *theEnv,
  char *str1,
  char *str2)
  {
   int pos = 0;
   unsigned max = 0;
   char *theString = NULL;
   void *thePtr;

   theString = AppendToString(theEnv,str1,theString,&pos,&max);
   theString = AppendToString(theEnv,str2,theString,&pos,&max);

   thePtr = EnvAddSymbol(theEnv,theString);
   rm(theEnv,theString,max);
   return(ValueToString(thePtr));
  }
开发者ID:aliverobotics,项目名称:Pumas-SmallSize,代码行数:17,代码来源:utility.c


示例6: PrintInfo

static nsACString&
PrintInfo(nsACString& aTo, LayerComposite* aLayerComposite)
{
  if (!aLayerComposite) {
    return aTo;
  }
  if (const nsIntRect* clipRect = aLayerComposite->GetShadowClipRect()) {
    AppendToString(aTo, *clipRect, " [shadow-clip=", "]");
  }
  if (!aLayerComposite->GetShadowTransform().IsIdentity()) {
    AppendToString(aTo, aLayerComposite->GetShadowTransform(), " [shadow-transform=", "]");
  }
  if (!aLayerComposite->GetShadowVisibleRegion().IsEmpty()) {
    AppendToString(aTo, aLayerComposite->GetShadowVisibleRegion(), " [shadow-visible=", "]");
  }
  return aTo;
}
开发者ID:nightahul,项目名称:gecko-dev,代码行数:17,代码来源:Layers.cpp


示例7: AppendNewLineToString

void
nsXHTMLContentSerializer::AfterElementStart(nsIContent * aContent,
                                            nsIDOMElement *aOriginalElement,
                                            nsAString& aStr)
{
  nsIAtom *name = aContent->Tag();
  if (aContent->GetNameSpaceID() == kNameSpaceID_XHTML &&
      mRewriteEncodingDeclaration &&
      name == nsGkAtoms::head) {

    // Check if there already are any content-type meta children.
    // If there are, they will be modified to use the correct charset.
    // If there aren't, we'll insert one here.
    PRBool hasMeta = PR_FALSE;
    PRUint32 i, childCount = aContent->GetChildCount();
    for (i = 0; i < childCount; ++i) {
      nsIContent* child = aContent->GetChildAt(i);
      if (child->IsHTML() &&
          child->Tag() == nsGkAtoms::meta &&
          child->HasAttr(kNameSpaceID_None, nsGkAtoms::content)) {
        nsAutoString header;
        child->GetAttr(kNameSpaceID_None, nsGkAtoms::httpEquiv, header);

        if (header.LowerCaseEqualsLiteral("content-type")) {
          hasMeta = PR_TRUE;
          break;
        }
      }
    }

    if (!hasMeta) {
      AppendNewLineToString(aStr);
      if (mDoFormat) {
        AppendIndentation(aStr);
      }
      AppendToString(NS_LITERAL_STRING("<meta http-equiv=\"content-type\""),
                    aStr);
      AppendToString(NS_LITERAL_STRING(" content=\"text/html; charset="), aStr);
      AppendToString(NS_ConvertASCIItoUTF16(mCharset), aStr);
      if (mIsHTMLSerializer)
        AppendToString(NS_LITERAL_STRING("\">"), aStr);
      else
        AppendToString(NS_LITERAL_STRING("\" />"), aStr);
    }
  }
}
开发者ID:MozillaOnline,项目名称:gecko-dev,代码行数:46,代码来源:nsXHTMLContentSerializer.cpp


示例8: AppendToString

nsACString&
RefLayer::PrintInfo(nsACString& aTo, const char* aPrefix)
{
  ContainerLayer::PrintInfo(aTo, aPrefix);
  if (0 != mId) {
    AppendToString(aTo, mId, " [id=", "]");
  }
  return aTo;
}
开发者ID:nightahul,项目名称:gecko-dev,代码行数:9,代码来源:Layers.cpp


示例9: PrintErrorCapture

static int PrintErrorCapture(
  char *logicalName,
  char *str)
  {
   if (strcmp(logicalName,WERROR) == 0)
     {
      ErrorString = AppendToString(str,ErrorString,
                                   &ErrorCurrentPosition,
                                   &ErrorMaximumPosition);
     }
   else if (strcmp(logicalName,WWARNING) == 0)
     {
      WarningString = AppendToString(str,WarningString,
                                     &WarningCurrentPosition,
                                     &WarningMaximumPosition);
     }

   return(1);
  }
开发者ID:ahmed-masud,项目名称:FuzzyCLIPS,代码行数:19,代码来源:parsefun.c


示例10: nsPrintfCString

nsACString&
Layer::PrintInfo(nsACString& aTo, const char* aPrefix)
{
  aTo += aPrefix;
  aTo += nsPrintfCString(64, "%s%s (0x%p)", mManager->Name(), Name(), this);

  if (mUseClipRect) {
    AppendToString(aTo, mClipRect, " [clip=", "]");
  }
  if (!mTransform.IsIdentity())
    AppendToString(aTo, mTransform, " [transform=", "]");
  if (!mVisibleRegion.IsEmpty())
    AppendToString(aTo, mVisibleRegion, " [visible=", "]");
  if (1.0 != mOpacity)
    aTo.AppendPrintf(" [opacity=%g]", mOpacity);
  if (IsOpaqueContent())
    aTo += " [opaqueContent]";

  return aTo;
}
开发者ID:lofter2011,项目名称:Icefox,代码行数:20,代码来源:Layers.cpp


示例11: PrintErrorCapture

static int PrintErrorCapture(
  void *theEnv,
  char *logicalName,
  char *str)
  {
   if (strcmp(logicalName,WERROR) == 0)
     {
      ParseFunctionData(theEnv)->ErrorString = AppendToString(theEnv,str,ParseFunctionData(theEnv)->ErrorString,
                                   &ParseFunctionData(theEnv)->ErrorCurrentPosition,
                                   &ParseFunctionData(theEnv)->ErrorMaximumPosition);
     }
   else if (strcmp(logicalName,WWARNING) == 0)
     {
      ParseFunctionData(theEnv)->WarningString = AppendToString(theEnv,str,ParseFunctionData(theEnv)->WarningString,
                                     &ParseFunctionData(theEnv)->WarningCurrentPosition,
                                     &ParseFunctionData(theEnv)->WarningMaximumPosition);
     }

   return(1);
  }
开发者ID:aliverobotics,项目名称:Pumas-SmallSize,代码行数:20,代码来源:parsefun.c


示例12: nsPrintfCString

void
ContentHostTexture::PrintInfo(std::stringstream& aStream, const char* aPrefix)
{
  aStream << aPrefix;
  aStream << nsPrintfCString("ContentHost (0x%p)", this).get();

  AppendToString(aStream, mBufferRect, " [buffer-rect=", "]");
  AppendToString(aStream, mBufferRotation, " [buffer-rotation=", "]");
  if (PaintWillResample()) {
    aStream << " [paint-will-resample]";
  }

  if (mTextureHost) {
    nsAutoCString pfx(aPrefix);
    pfx += "  ";

    aStream << "\n";
    mTextureHost->PrintInfo(aStream, pfx.get());
  }
}
开发者ID:marshall,项目名称:gecko-dev,代码行数:20,代码来源:ContentHost.cpp


示例13: nsPrintfCString

void
DeprecatedContentHostSingleBuffered::PrintInfo(nsACString& aTo, const char* aPrefix)
{
  aTo += aPrefix;
  aTo += nsPrintfCString("DeprecatedContentHostSingleBuffered (0x%p)", this);

  AppendToString(aTo, mBufferRect, " [buffer-rect=", "]");
  AppendToString(aTo, mBufferRotation, " [buffer-rotation=", "]");
  if (PaintWillResample()) {
    aTo += " [paint-will-resample]";
  }

  nsAutoCString pfx(aPrefix);
  pfx += "  ";

  if (mDeprecatedTextureHost) {
    aTo += "\n";
    mDeprecatedTextureHost->PrintInfo(aTo, pfx.get());
  }
}
开发者ID:brendanlong,项目名称:gecko-dev,代码行数:20,代码来源:ContentHost.cpp


示例14: NS_ASSERTION

void 
nsXHTMLContentSerializer::AppendEndOfElementStart(nsIContent *aOriginalElement,
                                                  nsIAtom * aName,
                                                  PRInt32 aNamespaceID,
                                                  nsAString& aStr)
{
  // this method is not called by nsHTMLContentSerializer
  // so we don't have to check HTML element, just XHTML
  NS_ASSERTION(!mIsHTMLSerializer, "nsHTMLContentSerializer shouldn't call this method !");

  if (kNameSpaceID_XHTML != aNamespaceID) {
    nsXMLContentSerializer::AppendEndOfElementStart(aOriginalElement, aName,
                                                    aNamespaceID, aStr);
    return;
  }

  nsIContent* content = aOriginalElement;

  // for non empty elements, even if they are not a container, we always
  // serialize their content, because the XHTML element could contain non XHTML
  // nodes useful in some context, like in an XSLT stylesheet
  if (HasNoChildren(content)) {

    nsIParserService* parserService = nsContentUtils::GetParserService();
  
    if (parserService) {
      bool isContainer;
      parserService->
        IsContainer(parserService->HTMLCaseSensitiveAtomTagToId(aName),
                    isContainer);
      if (!isContainer) {
        // for backward compatibility with HTML 4 user agents
        // only non-container HTML elements can be closed immediatly,
        // and a space is added before />
        AppendToString(NS_LITERAL_STRING(" />"), aStr);
        return;
      }
    }
  }
  AppendToString(kGreaterThan, aStr);
}
开发者ID:Anachid,项目名称:mozilla-central,代码行数:41,代码来源:nsXHTMLContentSerializer.cpp


示例15: AppendToString

nsACString&
ThebesLayer::PrintInfo(nsACString& aTo, const char* aPrefix)
{
  Layer::PrintInfo(aTo, aPrefix);
  if (!mValidRegion.IsEmpty()) {
    AppendToString(aTo, mValidRegion, " [valid=", "]");
  }
  if (mXResolution != 1.0 || mYResolution != 1.0) {
    aTo.AppendPrintf(" [xres=%g yres=%g]", mXResolution, mYResolution);
  }
  return aTo;
}
开发者ID:sahlberg,项目名称:timberwolf,代码行数:12,代码来源:Layers.cpp


示例16: NS_ENSURE_ARG

NS_IMETHODIMP
nsHTMLContentSerializer::AppendText(nsIDOMText* aText,
                                    PRInt32 aStartOffset,
                                    PRInt32 aEndOffset,
                                    nsAString& aStr)
{
    NS_ENSURE_ARG(aText);

    if (mNeedLineBreaker) {
        mNeedLineBreaker = PR_FALSE;

        nsCOMPtr<nsIDOMDocument> domDoc;
        aText->GetOwnerDocument(getter_AddRefs(domDoc));
        nsCOMPtr<nsIDocument> document = do_QueryInterface(domDoc);
    }

    nsAutoString data;

    nsresult rv;
    rv = AppendTextData((nsIDOMNode*)aText, aStartOffset,
                        aEndOffset, data, PR_TRUE, PR_FALSE);
    if (NS_FAILED(rv))
        return NS_ERROR_FAILURE;

    if (mPreLevel > 0) {
        AppendToStringConvertLF(data, aStr);
    }
    else if (mFlags & nsIDocumentEncoder::OutputRaw) {
        PRInt32 lastNewlineOffset = data.RFindChar('\n');
        AppendToString(data, aStr);
        if (lastNewlineOffset != kNotFound)
            mColPos = data.Length() - lastNewlineOffset;
    }
    else if (!mDoFormat) {
        PRInt32 lastNewlineOffset = kNotFound;
        PRBool hasLongLines = HasLongLines(data, lastNewlineOffset);
        if (hasLongLines) {
            // We have long lines, rewrap
            AppendToStringWrapped(data, aStr, PR_FALSE);
            if (lastNewlineOffset != kNotFound)
                mColPos = data.Length() - lastNewlineOffset;
        }
        else {
            AppendToStringConvertLF(data, aStr);
        }
    }
    else {
        AppendToStringWrapped(data, aStr, PR_FALSE);
    }

    return NS_OK;
}
开发者ID:rhencke,项目名称:mozilla-cvs-history,代码行数:52,代码来源:nsHTMLContentSerializer.cpp


示例17: do_QueryInterface

nsresult
nsXMLContentSerializer::AppendTextData(nsIDOMNode* aNode, 
                                       PRInt32 aStartOffset,
                                       PRInt32 aEndOffset,
                                       nsAString& aStr,
                                       PRBool aTranslateEntities,
                                       PRBool aIncrColumn)
{
  nsCOMPtr<nsIContent> content = do_QueryInterface(aNode);
  const nsTextFragment* frag;
  if (!content || !(frag = content->GetText())) {
    return NS_ERROR_FAILURE;
  }

  PRInt32 endoffset = (aEndOffset == -1) ? frag->GetLength() : aEndOffset;
  PRInt32 length = endoffset - aStartOffset;

  NS_ASSERTION(aStartOffset >= 0, "Negative start offset for text fragment!");
  NS_ASSERTION(aStartOffset <= endoffset, "A start offset is beyond the end of the text fragment!");

  if (length <= 0) {
    // XXX Zero is a legal value, maybe non-zero values should be an
    // error.

    return NS_OK;
  }
    
  if (frag->Is2b()) {
    const PRUnichar *strStart = frag->Get2b() + aStartOffset;
    AppendToString(Substring(strStart, strStart + length), aStr,
                   aTranslateEntities, aIncrColumn);
  }
  else {
    AppendToString(NS_ConvertASCIItoUTF16(frag->Get1b()+aStartOffset, length),
                   aStr, aTranslateEntities, aIncrColumn);
  }

  return NS_OK;
}
开发者ID:EdgarChen,项目名称:mozilla-cvs-history,代码行数:39,代码来源:nsXMLContentSerializer.cpp


示例18: AppendToString

void
AppendToString(std::stringstream& aStream, const EventRegions& e,
               const char* pfx, const char* sfx)
{
  aStream << pfx << "{";
  if (!e.mHitRegion.IsEmpty()) {
    AppendToString(aStream, e.mHitRegion, " hitregion=", "");
  }
  if (!e.mDispatchToContentHitRegion.IsEmpty()) {
    AppendToString(aStream, e.mDispatchToContentHitRegion, " dispatchtocontentregion=", "");
  }
  if (!e.mNoActionRegion.IsEmpty()) {
    AppendToString(aStream, e.mNoActionRegion, " NoActionRegion=","");
  }
  if (!e.mHorizontalPanRegion.IsEmpty()) {
    AppendToString(aStream, e.mHorizontalPanRegion, " HorizontalPanRegion=", "");
  }
  if (!e.mVerticalPanRegion.IsEmpty()) {
    AppendToString(aStream, e.mVerticalPanRegion, " VerticalPanRegion=", "");
  }
  aStream << "}" << sfx;
}
开发者ID:valenting,项目名称:gecko-dev,代码行数:22,代码来源:LayersLogging.cpp


示例19: SavePPBuffer

globle void SavePPBuffer(
  void *theEnv,
  EXEC_STATUS,
  char *str)
  {
   size_t increment;

   /*==========================================*/
   /* If the pretty print buffer isn't needed, */
   /* then don't bother writing to it.         */
   /*==========================================*/

   if ((PrettyPrintData(theEnv,execStatus)->PPBufferStatus == OFF) || (! PrettyPrintData(theEnv,execStatus)->PPBufferEnabled)) 
     { return; }

   /*===============================*/
   /* Determine the increment size. */
   /*===============================*/

   increment = 512;
   if (PrettyPrintData(theEnv,execStatus)->PPBufferPos > increment)
     { increment = PrettyPrintData(theEnv,execStatus)->PPBufferPos * 3; }

   /*================================================*/
   /* If the pretty print buffer isn't big enough to */
   /* contain the string, then increase its size.    */
   /*================================================*/

   if (strlen(str) + PrettyPrintData(theEnv,execStatus)->PPBufferPos + 1 >= PrettyPrintData(theEnv,execStatus)->PPBufferMax)
     {
      PrettyPrintData(theEnv,execStatus)->PrettyPrintBuffer = 
         (char *) genrealloc(theEnv,execStatus,PrettyPrintData(theEnv,execStatus)->PrettyPrintBuffer,
                                    PrettyPrintData(theEnv,execStatus)->PPBufferMax,
                                    PrettyPrintData(theEnv,execStatus)->PPBufferMax + increment);
      PrettyPrintData(theEnv,execStatus)->PPBufferMax += increment;
     }

   /*==================================================*/
   /* Remember the previous tokens saved to the pretty */
   /* print buffer in case it is necessary to back up. */
   /*==================================================*/

   PrettyPrintData(theEnv,execStatus)->PPBackupTwice = PrettyPrintData(theEnv,execStatus)->PPBackupOnce;
   PrettyPrintData(theEnv,execStatus)->PPBackupOnce = PrettyPrintData(theEnv,execStatus)->PPBufferPos;

   /*=============================================*/
   /* Save the string to the pretty print buffer. */
   /*=============================================*/

   PrettyPrintData(theEnv,execStatus)->PrettyPrintBuffer = AppendToString(theEnv,execStatus,str,PrettyPrintData(theEnv,execStatus)->PrettyPrintBuffer,&PrettyPrintData(theEnv,execStatus)->PPBufferPos,&PrettyPrintData(theEnv,execStatus)->PPBufferMax);
  }
开发者ID:atrniv,项目名称:CLIPS,代码行数:51,代码来源:pprint.c


示例20: AppendToString

nsACString&
AppendToString(nsACString& s, const nsIntRegion& r,
               const char* pfx, const char* sfx)
{
  s += pfx;

  nsIntRegionRectIterator it(r);
  s += "< ";
  while (const nsIntRect* sr = it.Next())
    AppendToString(s, *sr) += "; ";
  s += ">";

  return s += sfx;
}
开发者ID:JuannyWang,项目名称:gecko-dev,代码行数:14,代码来源:LayersLogging.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ AppendUTF8toUTF16函数代码示例发布时间:2022-05-30
下一篇:
C++ AppendText函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap