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


C++ OsConfigDb::numEntries方法代码示例

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


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

示例1: testCreators

 void testCreators()
 {
     OsConfigDb *pDb = new OsConfigDb();       // create an empty database
     CPPUNIT_ASSERT_MESSAGE("verify that it looks empty", pDb->isEmpty());
     CPPUNIT_ASSERT_MESSAGE("has zero entries", pDb->numEntries()==0);
     delete pDb;
 }
开发者ID:Jaroslav23,项目名称:sipxtapi,代码行数:7,代码来源:OsConfigDbTest.cpp

示例2: createMediaTaskandFlowGraph

//******************************************************************************
void createMediaTaskandFlowGraph()
{
    // Create foundation Media Task & Flow Graph

    OsSysLog::initialize(0, "mstream");
    OsSysLog::setLoggingPriority(PRI_DEBUG);
    OsSysLog::enableConsoleOutput(true);

    OsConfigDb cfgDb;
    if (cfgDb.loadFromFile("mstream.cfg") == OS_SUCCESS)
        cout << "(Read " << cfgDb.numEntries()
             << " config entries from mstream.cfg)" << endl;

    // Creates a sipXmediaFactoryImpl
    pFactory = sipXmediaFactoryFactory(&cfgDb);

    MpMediaTask* pMediaTask = MpMediaTask::getMediaTask();
    //sleep(0);

    char sdesName[64];
    sprintf(sdesName, "mstream-%d", OsProcess::getCurrentPID());
    cout << "Setting SDES NAME to " << sdesName << endl;

#ifdef INCLUDE_RTCP

    CSourceDescription* pSdes = CSourceDescription::GetLocalSDES();
    pSdes->SetAllComponents(
        /* NAME        */   (unsigned char*)sdesName,
        /* EMAIL       */   (unsigned char*)"",
        /* PHONE       */   (unsigned char*)"",
        /* APPLICATION */   (unsigned char*)"",
        /* LOCATION    */   (unsigned char*)"",
        /* NOTES       */   (unsigned char*)"",
        /* PRIVATE     */   (unsigned char*)"");

#endif

    selectFlowGraph(createFlowGraph());

    if (initialFocus)
    {
        pIf->giveFocus();
        cout << "Gave focus to this interface" << endl;
    }

    {
        SdpCodecList codecList;
        //UtlString codecs = "PCMU PCMA TELEPHONE-EVENT";
        UtlString codecNames = "PCMU";
        codecList.addCodecs(codecNames);

        codecList.getCodecs(numCodecs, pCodecArray);
    } 
}
开发者ID:John-Chan,项目名称:sipXtapi,代码行数:55,代码来源:mstream.cpp

示例3: testManipulators

    void testManipulators()
    {
        OsConfigDb *pDb = new OsConfigDb();
        pDb->set("Key1", "Value1");
        CPPUNIT_ASSERT_MESSAGE("verify that the database is not empty", 
                               !pDb->isEmpty());
        CPPUNIT_ASSERT_MESSAGE("has one entry", pDb->numEntries()==1);
                                                                                
        // test the remove() method
        //
        // We put the following block in its own scope so that the UtlString
        // reference (stored in "value") is released as a side effect of going
        // out of scope.  Otherwise, it will look like a memory leak.
        {
            UtlString value;
                                                                                
            pDb->remove("Key1");
            CPPUNIT_ASSERT_MESSAGE("verify that it looks empty", pDb->isEmpty());
            CPPUNIT_ASSERT_MESSAGE("has zero entries", pDb->numEntries()==0);
                                                                                
            pDb->set("Key1", "Value1");   // add the entry back
            pDb->set("Key1", "Value1b");  // change the value for an existing entry
            CPPUNIT_ASSERT_MESSAGE("verify that the database is not empty", 
                                   !pDb->isEmpty());
            CPPUNIT_ASSERT_EQUAL_MESSAGE("has one entry", 1, pDb->numEntries());
                                                                                
            OsStatus res = pDb->get("Key1", value);
            CPPUNIT_ASSERT(res == OS_SUCCESS);
            CPPUNIT_ASSERT_MESSAGE("that contains the revised value", 
                value.compareTo("Value1b") == 0);
                                                                                
            pDb->set("Key2", "Value2");
            pDb->set("Key3", "Value3");
            pDb->set("Key4", "Value4");
            CPPUNIT_ASSERT_MESSAGE("check the number of entries", 
                                   pDb->numEntries()==4);
            value.remove(0);
        }
                                                                                
        // test the storeToFile() method
        pDb->storeToFile("tmpdb");         // store the config db to the file
        delete pDb;                   // delete the database
                                                                                
        // test the loadFromFile() method
        //
        // We put the following block in its own scope so that the UtlString
        // reference (stored in "value") is released as a side effect of going
        // out of scope.  Otherwise, it will look like a memory leak.
        {
            UtlString  value;
            
            pDb = new OsConfigDb();       // create an empty database
            pDb->loadFromFile("tmpdb");        // load the data from a file
        }
                                                                                
        CPPUNIT_ASSERT_MESSAGE("verify the database is not empty", 
                               !pDb->isEmpty());

        CPPUNIT_ASSERT_MESSAGE("has four entries", pDb->numEntries()==4);

        UtlString value;
        OsStatus res = pDb->get("Key1", value);
        CPPUNIT_ASSERT_MESSAGE("contains correct data", 
            res == OS_SUCCESS && value.compareTo("Value1b") == 0);

        res = pDb->get("Key2", value);
        CPPUNIT_ASSERT_MESSAGE("contains correct data",
            res == OS_SUCCESS && value.compareTo("Value2") == 0);

        res = pDb->get("Key3", value);
        CPPUNIT_ASSERT_MESSAGE("contains correct data",
            res == OS_SUCCESS && value.compareTo("Value3") == 0);

        res = pDb->get("Key4", value);
        CPPUNIT_ASSERT_MESSAGE("contains correct data",
            res == OS_SUCCESS && value.compareTo("Value4") == 0);

        delete pDb;                   // delete the database
        value.remove(0);
    }
开发者ID:Jaroslav23,项目名称:sipxtapi,代码行数:80,代码来源:OsConfigDbTest.cpp

示例4: testAccessors

 void testAccessors()
 {
     OsConfigDb *pDb = new OsConfigDb();
                                                                             
     // the get() method is tested by testManipulators()
                                                                             
     // test the getNext() method
     //
     // We put the following block in its own scope so that the UtlString
     // references (stored in "name" and "value") are released as a side effect
     // of going out of scope.  Otherwise, it will look like a memory leak.
     {
         UtlString  name;
         UtlString  value;
                                                                             
         pDb->set("Key3", "Value3");   // add several entries (not in
         pDb->set("Key2", "Value2");   //  alphabetical or reverse alphabetical
         pDb->set("Key4", "Value4");   //  order
         pDb->set("Key1", "Value1");
         CPPUNIT_ASSERT_MESSAGE("verify that the database is not empty",
                                !pDb->isEmpty());
         CPPUNIT_ASSERT_MESSAGE("has four entries", pDb->numEntries()==4);
                                                                             
         OsStatus res = pDb->getNext("", name, value);      // call getNext("", ...)
         CPPUNIT_ASSERT_MESSAGE("verify that Key1/Value1", 
             res == OS_SUCCESS &&
             name.compareTo("Key1") == 0 &&     //  is returned
             value.compareTo("Value1") == 0);
                                                                             
         res = pDb->getNext("Key1", name, value);
         CPPUNIT_ASSERT_MESSAGE("call getNext(\"Key1\", ...)",
             res == OS_SUCCESS &&               //  verify that Key2/Value2
             name.compareTo("Key2") == 0 &&     //  is returned
             value.compareTo("Value2") == 0);
                                                                             
         res = pDb->getNext("Key2", name, value);
         CPPUNIT_ASSERT_MESSAGE("call getNext(\"Key2\", ...)", 
             res == OS_SUCCESS &&               //  verify that Key3/Value3
             name.compareTo("Key3") == 0 &&     //  is returned
             value.compareTo("Value3") == 0);
                                                                             
         res = pDb->getNext("Key3", name, value);
         CPPUNIT_ASSERT_MESSAGE("call getNext(\"Key3\", ...)", 
             res == OS_SUCCESS &&
             name.compareTo("Key4") == 0 &&
             value.compareTo("Value4") == 0);
     
         res = pDb->getNext("Key4", name, value);
         CPPUNIT_ASSERT_MESSAGE("call getNext(\"Key4\", ...)", 
              res == OS_NO_MORE_DATA &&
              name.compareTo("") == 0 &&
              value.compareTo("") == 0);
                                                                             
         res = pDb->getNext("XXX", name, value);
         CPPUNIT_ASSERT_MESSAGE("call getNext with a key not in the database and verify",
             res == OS_NOT_FOUND &&         
             name.compareTo("") == 0 &&      //  that empty strings are
            value.compareTo("") == 0);       //  returned for the next name
                                             //  and value pair.
                                                                             
         delete pDb;                               // delete the database
         name.remove(0);
         value.remove(0);
     }
 }
开发者ID:Jaroslav23,项目名称:sipxtapi,代码行数:65,代码来源:OsConfigDbTest.cpp


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