當前位置: 首頁>>代碼示例>>C++>>正文


C++ Bar函數代碼示例

本文整理匯總了C++中Bar函數的典型用法代碼示例。如果您正苦於以下問題:C++ Bar函數的具體用法?C++ Bar怎麽用?C++ Bar使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了Bar函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。

示例1: main

int main() {
  Foo F;
  Foo *F2 = new Foo();
  new Foo();
  Foo();
  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: creating a temporary object of type 'Foo' is prohibited
  Foo F3 = Foo();
  // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: creating a temporary object of type 'Foo' is prohibited

  Bar();
  NS::Bar();
// CHECK-MESSAGES: :[[@LINE-1]]:3: warning: creating a temporary object of type 'NS::Bar' is prohibited

  int A = func(Foo());
  // CHECK-MESSAGES: :[[@LINE-1]]:16: warning: creating a temporary object of type 'Foo' is prohibited

  Foo F4(0);
  Foo *F5 = new Foo(0);
  new Foo(0);
  Foo(0);
  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: creating a temporary object of type 'Foo' is prohibited
  Foo F6 = Foo(0);
  // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: creating a temporary object of type 'Foo' is prohibited

  Bar(0);
  NS::Bar(0);
// CHECK-MESSAGES: :[[@LINE-1]]:3: warning: creating a temporary object of type 'NS::Bar' is prohibited

  int B = func(Foo(0));
  // CHECK-MESSAGES: :[[@LINE-1]]:16: warning: creating a temporary object of type 'Foo' is prohibited
}
開發者ID:ingowald,項目名稱:llvm-project,代碼行數:31,代碼來源:zircon-temporary-objects.cpp

示例2: decode

int64_t decode(void *buffer, size_t size, int64_t sum)
{
    unsigned int i;
    C(table_t) foobarcontainer;
    FooBar(vec_t) list;
    FooBar(table_t) foobar;
    Bar(struct_t) bar;
    Foo(struct_t) foo;

    foobarcontainer = C(as_root(buffer));
    sum += C(initialized(foobarcontainer));
    sum += StringLen(C(location(foobarcontainer)));
    sum += C(fruit(foobarcontainer));
    list = C(list(foobarcontainer));
    for (i = 0; i < FooBar(vec_len(list)); ++i) {
        foobar = FooBar(vec_at(list, i));
        sum += StringLen(FooBar(name(foobar)));
        sum += FooBar(postfix(foobar));
        sum += (int64_t)FooBar(rating(foobar));
        bar = FooBar(sibling(foobar));
        sum += (int64_t)Bar(ratio(bar));
        sum += Bar(size(bar));
        sum += Bar(time(bar));
        foo = Bar(parent(bar));
        sum += Foo(count(foo));
        sum += Foo(id(foo));
        sum += Foo(length(foo));
        sum += Foo(prefix(foo));
    }
    return sum + 2 * sum;
}
開發者ID:heibao,項目名稱:flatcc,代碼行數:31,代碼來源:benchflatcc.c

示例3: listIterator

void Data::parsePrices(QString page) {
    bool isPriceUpdated = false; // prices in the feed are from newest to oldest so we want the first
    Data::ctime = QDateTime::fromString(page.section("<latest_timestamp>",1,1).left(14), "yyyyMMddhhmmss");
    if(cstyle%Constants::getStyle()->size() == 1) {
        dataBars = new QList<Bar>();
        QStringListIterator listIterator(page.split("<bar>"));
        if(listIterator.hasNext()) {
            listIterator.next(); // skip the "0" index
            xmin = 999999; xmax = 0; ymin = 99999999; ymax = 0;
        }
        while(listIterator.hasNext()) {
            QString nextBar = listIterator.next();
            QString lowStr = nextBar.section("<low>",1,1).section("</low>",0,0);
            QString highStr = nextBar.section("<high>",1,1).section("</high>",0,0);
            QString closeStr = nextBar.section("<close>",1,1).section("</close>",0,0);
            if(closeStr != "") {
                if(lowStr.toDouble() < ymin) ymin = lowStr.toDouble();
                if(highStr.toDouble() > ymax) ymax = highStr.toDouble();
                dataBars->prepend(Bar(lowStr.toDouble(), highStr.toDouble(), closeStr.toDouble()));
            } else {
                dataBars->prepend(Bar());
            }
            if(!isPriceUpdated && closeStr.toDouble() > 0) {
                isPriceUpdated = true;
                lastChartPrice = closeStr.toDouble();
            }
        }
        xmax = dataBars->size()+1.5;
    } else if(cstyle%Constants::getStyle()->size() == 0) {
        dataPoints = new QList<double>();
        QStringListIterator listIterator(page.split("<point>"));
        if(listIterator.hasNext()) {
            listIterator.next(); // skip the "0" index
            xmin = 999999; xmax = 0; ymin = 999999; ymax = 0;
        }
        while(listIterator.hasNext()) {
            QString nextPoint = listIterator.next();
            QString priceStr = nextPoint.section("<price>",1,1).section("</price>",0,0);
            if(priceStr != "") {
                if(priceStr.toDouble() < ymin) ymin = priceStr.toDouble();
                if(priceStr.toDouble() > ymax) ymax = priceStr.toDouble();
                dataPoints->prepend(priceStr.toDouble());
            } else {
                dataPoints->prepend(-1);
            }
            if(!isPriceUpdated && priceStr.toDouble() > 0) {
                isPriceUpdated = true;
                lastChartPrice = priceStr.toDouble();
            }
        }
        xmax = dataPoints->size()+1.5;
    }
    xmin = 0;
    double ydiff = ymax - ymin;
    ymin = ymin-ydiff/20;
    ymax = ymax+ydiff/20;

    // 'callback' to chart to update once the data is parsed
    chart->update();
}
開發者ID:szymonwartak,項目名稱:NokiaBV,代碼行數:60,代碼來源:data.cpp

示例4: main

int main()
{
    My my;
    Bar(my); // OK
    My2 my2;
    Bar(my2); // Compile error: no type named ‘foo’ in ‘struct My2’
    return 0;
}
開發者ID:CCJY,項目名稱:coliru,代碼行數:8,代碼來源:main.cpp

示例5: bar

void bar()
{
  std::cout << "========== Bar ==============\n";

  Bar b = Bar() + Bar();

  std::cout << "=============================\n";

}
開發者ID:gary109,項目名稱:cppblog,代碼行數:9,代碼來源:case3.cpp

示例6: TEST

TEST(MatchingContainers, Foo)
{
    MockFoo foo;
    EXPECT_CALL(foo, Bar(ElementsAre(1, Gt(0), _, 5)));
    EXPECT_CALL(foo, Bar(UnorderedElementsAre(2, 3)));
    
    const vector<int> a{1, 2, 3, 5};
    foo.Bar(a);
    
    const vector<int> b{3, 2};
    foo.Bar(b);
}
開發者ID:Junch,項目名稱:StudyCppUTest,代碼行數:12,代碼來源:MatchingContainers.cpp

示例7: main

int main()
{
	Bar bar = Bar();
	bar.Bartender();

	return 0;
}
開發者ID:matanl,項目名稱:Study-Books,代碼行數:7,代碼來源:main.cpp

示例8: Bar

void tst_QHash::dont_need_default_constructor()
{
    QHash<int, Bar> hash1;
    for (int i = 0; i < 100; ++i) {
        hash1.insert(i, Bar(2 * i));
        QVERIFY(hash1.value(i, Bar(-1)).j == 2 * i);
        QVERIFY(hash1.size() == i + 1);
    }

    QHash<QString, Bar> hash2;
    for (int i = 0; i < 100; ++i) {
        hash2.insert(QString::number(i), Bar(2 * i));
        QVERIFY(hash2.value(QString::number(i), Bar(-1)).j == 2 * i);
        QVERIFY(hash2.size() == i + 1);
    }
}
開發者ID:husninazer,項目名稱:qt,代碼行數:16,代碼來源:tst_qhash.cpp

示例9: LoadDatabase

void LoadDatabase(QueryResult * pResult)
{
    pResult = SD2Database.PQuery(
        "SELECT flag, data0, data1, CatId, C.name, destid "
        "FROM sd2p_npc_tele_category C, sd2p_npc_tele_association A "
        "WHERE C.id = CatId ORDER BY C.name, CatId");
    VCategorie.clear();

    if (pResult)
    {
        outstring_log("SD2P: Chargement \"sd2p_npc_tele_category\" et \"sd2p_npc_tele_association\"...");
        barGoLink Bar(pResult->GetRowCount());

        uint32 CatId  = 0;
        uint32 NbDest = 0;
        bool IsValidCat = true;
        bool FirstTime  = true;

        do
        {
            Bar.step();
            Field * pFields = pResult->Fetch();

            if (!GetDestination(pFields[5].GetUInt32()))
            {
                outstring_log("SD2P >> Destination introuvable (DestID: %u).", pFields[5].GetUInt32());
                continue;
            }

            if (!IsValidCat && CatId == pFields[3].GetUInt32() && !FirstTime)
                continue;

            IsValidCat = true;
            FirstTime = false;

            if (!IsValidData(pFields[3].GetUInt32(), (Flag_t)pFields[0].GetUInt8(),
                             pFields[1].GetUInt64(), pFields[2].GetUInt32()))
            {
                IsValidCat = false;
                CatId = pFields[3].GetUInt32();
                continue;
            }

            if (CatId != pFields[3].GetUInt32())
            {
                CatId = pFields[3].GetUInt32();
                Categorie Cat (CatId, pFields[4].GetCppString(), (Flag_t)pFields[0].GetUInt8(),
                               pFields[1].GetUInt64(), pFields[2].GetUInt32());
                VCategorie.push_back(Cat);
            }

            VCategorie.back().AddDest(pFields[5].GetUInt32());
            ++NbDest;
        } while (pResult->NextRow());

        delete pResult;
        outstring_log("");
        outstring_log(">> %u npc_teleport charge(s).", NbDest);
    } else outstring_log("WARNING >> 0 npc_teleport charge.");
}
開發者ID:benoit934,項目名稱:scriptdev2,代碼行數:60,代碼來源:sd2p_sc_npc_teleport.cpp

示例10: main

int main()
{
    Bar Bar(1);
    class Bar Bar2(2); // elaborated type
    
    printf("hello");
}
開發者ID:CCJY,項目名稱:coliru,代碼行數:7,代碼來源:main.cpp

示例11: main

int main()
{
    union  union_64 param1, param2;

    param1._uint8[0]=0xde;
    param1._uint8[1]=0xad;
    param1._uint8[2]=0xbe;
    param1._uint8[3]=0xef;
    param1._uint8[4]=0xde;
    param1._uint8[5]=0xad;
    param1._uint8[6]=0xbe;
    param1._uint8[7]=0xef;

    param2._uint8[0]=0xde;
    param2._uint8[1]=0xad;
    param2._uint8[2]=0xbe;
    param2._uint8[3]=0xef;
    param2._uint8[4]=0xde;
    param2._uint8[5]=0xad;
    param2._uint8[6]=0xbe;
    param2._uint8[7]=0x7f;

    Bar(param1.i64, param2.i64);

    return 0;
}
開發者ID:alugupta,項目名稱:resilient-systems,代碼行數:26,代碼來源:callapp_64bit_param_app_1.c

示例12: CcDraw

/*********************************************************************
* Function: WORD CcDraw(CUSTOM *pCc)
*
* PreCondition: object must be created before this is called
*
* Input: pCc - pointer to struct CUSTOM with data
*
* Output: returns the status of the drawing
*		  0 - not complete
*         1 - done
*
* Overview: draws control
*
* Note: THIS FUNCTION CALL SHOULD BE ADDED INTO GOLDraw() FUNCTION IN
*       GOL.C FILE
*
********************************************************************/
WORD CcDraw(CUSTOM *pCc)
{
    typedef enum
    {
        REMOVE,
        BOX_DRAW,
        RUN_DRAW
    } CC_DRAW_STATES;

    static CC_DRAW_STATES state = REMOVE;

    switch(state)
    {
        case REMOVE:
            if(GetState(pCc, CC_HIDE))
            {
                SetColor(pCc->pGolScheme->CommonBkColor);
                if(!Bar(pCc->left, pCc->top, pCc->right, pCc->bottom))
                    return (0);
                return (1);
            }

            state = BOX_DRAW;

        case BOX_DRAW:
            if(GetState(pCc, CC_DRAW))
            {
                GOLPanelDraw
                (
                    pCc->left,
                    pCc->top,
                    pCc->right,
                    pCc->bottom,
                    pCc->pGolScheme->Color0,
                    pCc->pGolScheme->EmbossDkColor,
                    pCc->pGolScheme->EmbossLtColor,
                    NULL,
                    GOL_EMBOSS_SIZE
                );
            }
            else
            {
                state = BAR_DRAW;
                goto bar_draw;
            }

            state = RUN_DRAW;

        case RUN_DRAW:
            if(!GOLPanelDrawTsk())
            {
                return (0);
            }

            // DRAWING IS DONE
            state = REMOVE;
            return (1);
    }
}
開發者ID:WilliamAvila,項目名稱:PIC32MX460F512L_Examples,代碼行數:76,代碼來源:Template.c

示例13: Foo

template<int I> void Foo () {
  const int cst = global;
  auto lam0 = [&]() -> void {
    auto lam1 = [&]() -> void { cst; };
    
    Bar (cst);
  };
}
開發者ID:MaxKellermann,項目名稱:gcc,代碼行數:8,代碼來源:lambda-generic-const5.C

示例14: Baz

int Baz (int const *ptr, int *ptr2)
{
  Baz (ptr2);   // { dg-error "ambiguous" } 
  Bar (ptr2);   // { dg-error "ambiguous" } 
  Foo (ptr2);   // { dg-error "ambiguous" } 
  Qux (ptr2);   // { dg-error "ambiguous" } 
  return 0;
}
開發者ID:Akheon23,項目名稱:chromecast-mirrored-source.toolchain,代碼行數:8,代碼來源:spec35.C

示例15: Foo

void Foo(int number) {
	Bar();

	if (::testing::Test::HasFatalFailure())
		return FailTest();

	ASSERT_TRUE(number != 3);
}
開發者ID:czerniecki-wojciech,項目名稱:cmake_magisterka,代碼行數:8,代碼來源:main.cpp


注:本文中的Bar函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。