当前位置: 首页>>代码示例>>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;未经允许,请勿转载。