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


C++ StringBuffer::AppendBoolean方法代码示例

本文整理汇总了C++中StringBuffer::AppendBoolean方法的典型用法代码示例。如果您正苦于以下问题:C++ StringBuffer::AppendBoolean方法的具体用法?C++ StringBuffer::AppendBoolean怎么用?C++ StringBuffer::AppendBoolean使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在StringBuffer的用法示例。


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

示例1: ToString

// @Override
ECode CWifiInfo::ToString(
    /* [out] */ String* str)
{
    StringBuffer sb;
    String none("<none>");

    sb.Append("SSID: ");
    String sidStr;
    mWifiSsid->ToString(&sidStr);
    sb.Append(mWifiSsid == NULL ? IWifiSsid::NONE : sidStr);
    sb.Append(", BSSID: ");
    sb.Append(mBSSID.IsNull() ? none : mBSSID);
    sb.Append(", MAC: ");
    sb.Append(mMacAddress.IsNull() ? none : mMacAddress);
    sb.Append(", Supplicant state: ");
    if (mSupplicantState == NULL) sb.Append(none);
    sb.Append(mSupplicantState);
    sb.Append(", RSSI: ");
    sb.Append(mRssi);
    sb.Append(", Link speed: ");
    sb.Append(mLinkSpeed);
    sb.Append(", Net ID: ");
    sb.Append(mNetworkId);
    sb.Append(", Metered hint: ");
    sb.AppendBoolean(mMeteredHint);

    *str = sb.ToString();
    return NOERROR;
}
开发者ID:TheTypoMaster,项目名称:ElastosRDK5_0,代码行数:30,代码来源:CWifiInfo.cpp

示例2: testStringBuffer

void testStringBuffer()
{
    printf("==== Enter testStringBuffer ====\n");

    printf("\n === Construct === \n");

    StringBuffer sbc(String("Construct from String"));
    String str = sbc.ToString();
    printf(" > Construct:\n%s\n", (const char*)str);

    printf("\n === Append === \n");

    Char32 a = 'A';
    StringBuffer sb;
    ECode ec = sb.ToString(&str);
    printf(">> Get string from emtpy StringBuffer %s, %08x - %08x\n", str.string(), NOERROR, ec);

    sb.AppendCStr(">>Start\n");
    sb.AppendNULL();
    sb.AppendChar('_');
    sb.AppendChar(a);
    sb.AppendChar('_');
    sb.AppendBoolean(TRUE);
    sb.AppendChar('_');
    sb.AppendBoolean(FALSE);
    sb.AppendChar('_');
    sb.AppendInt32(32);
    sb.AppendChar('_');
    sb.AppendInt32(-32);
    sb.AppendChar('_');
    sb.AppendInt64(64);
    sb.AppendChar('_');
    sb.AppendInt64(-64);
    sb.AppendChar('_');
    sb.AppendFloat(10.0f);
    sb.AppendChar('_');
    sb.AppendDouble(101010.1010);
    sb.AppendChar('_');
    sb.AppendString(String("String"));
    sb.AppendCStr("\n<<End");

    str = sb.ToString();
    printf(" > AppendTest:\n%s\n", (const char*)str);


    printf("\n === Index ===\n");
    Int32 index = 0;
    String subStr("32");
    sb.IndexOf(subStr, &index);
    printf(" > IndexOf %s is %d\n", (const char*)subStr, index);

    subStr = String("_NOT_");
    sb.IndexOf(subStr, &index);
    printf(" > IndexOf %s is %d\n", (const char*)subStr, index);

    subStr = String("32");
    sb.LastIndexOf(subStr, &index);
    printf(" > LastIndexOf %s is %d\n", (const char*)subStr, index);

    subStr = String("_NOT_");
    sb.LastIndexOf(subStr, &index);
    printf(" > LastIndexOf %s is %d\n", (const char*)subStr, index);


    printf("\n === Substring ===\n");
    Int32 start = 30, end = 32;
    sb.Substring(start, &subStr);
    printf(" > Substring from %d is : %s\n", start, (const char*)subStr);
    sb.SubstringEx(start, end, &subStr);
    printf(" > Substring from %d to %d is : %s\n", start, end, (const char*)subStr);

    printf("\n === Get ===\n");
    Char32 ch = 0;
    sb.GetChar(start, &ch);
    printf(" > GetChar at %d is : %c\n", start, ch);
    sb.GetLength(&end);
    printf(" > GetLength is : %d\n", end);
    sb.GetByteCount(&end);
    printf(" > GetByteCount is : %d\n", end);
    sb.GetCapacity(&end);
    printf(" > GetCapacity is : %d\n", end);

    printf("\n === Set/Replace/Insert ===\n");
    sb.SetChar(13, 'B');
    sb.ToString(&str);
    printf(" > SetCharAt:\n%s\n", (const char*)str);
    sb.Replace(15, 15 + 4, String("Replace"));
    sb.ToString(&str);
    printf(" > Replace:\n%s\n", (const char*)str);
    sb.InsertString(15, String("Insert_"));
    sb.ToString(&str);
    printf(" > InsertString:\n%s\n", (const char*)str);
    sb.InsertString(0, String("HeadInsert_"));
    sb.ToString(&str);
    printf(" > InsertString in head:\n%s\n", (const char*)str);
    sb.InsertChar(19, '_');
    sb.ToString(&str);
    printf(" > InsertChar:\n%s\n", (const char*)str);
    sb.InsertBoolean(19, TRUE);
    sb.ToString(&str);
//.........这里部分代码省略.........
开发者ID:TheTypoMaster,项目名称:ElastosRDK5_0,代码行数:101,代码来源:main.cpp


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