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


C++ StringCollection::size方法代码示例

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


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

示例1:

vector<ReplicaDescription> PlacementAndLoadBalancingUnitTest::CreateReplicas(wstring replicas, std::vector<bool>& isReplicaUp)
{
    StringCollection replicaSet;
    vector<ReplicaDescription> replicaDescription;
    StringUtility::Split<wstring>(replicas, replicaSet, ItemDelimiter);

    if (replicaSet.size() != isReplicaUp.size())
    {
        return replicaDescription;
    }

    for (int i = 0; i < replicaSet.size(); i++)
    {
        replicaDescription.push_back(CreateReplicas(replicaSet[i], isReplicaUp[i])[0]);
    }

    return replicaDescription;
}
开发者ID:vturecek,项目名称:Service-Fabric,代码行数:18,代码来源:TestUtility.cpp

示例2: AddSpecification

bool UnreliableTransportConfiguration::AddSpecification(std::wstring const & name, std::wstring const & data)
{
    StringCollection params;
    StringUtility::Split<wstring>(data, params, L" ");

    wstring source = (params.size() > 0 ? params[0] : wstring());
    wstring destination = (params.size() > 1 ? params[1] : wstring());
    wstring action = (params.size() > 2 ? params[2] : wstring());
    double probability = (params.size() > 3 ? Common::Double_Parse(params[3]) : 1.0);
    TimeSpan delay = (params.size() > 4 ? ParseTimeSpan(params[4]) : TimeSpan::MaxValue);
    TimeSpan delaySpan = (params.size() > 5 ? ParseTimeSpan(params[5]) : TimeSpan::Zero);
    int priority = (params.size() > 6 ? Common::Int32_Parse(params[6]) : 0);
    int applyCount = (params.size() > 7 ? Common::Int32_Parse(params[7]) : -1);

    return AddSpecification(make_unique<UnreliableTransportSpecification>(name, source, destination, action, probability, delay, delaySpan, priority, applyCount));
}
开发者ID:vturecek,项目名称:Service-Fabric,代码行数:16,代码来源:UnreliableTransportConfiguration.cpp

示例3: TestGetFilesWithMask

void TestDirectory::TestGetFilesWithMask()
{
	typedef std::vector<std::tstring> StringCollection;
	StringCollection fileNames = Workshare::System::IO::Directory::GetFiles(TEST_FOLDER + _T("\\TestGetFiles"), _T("*.doc"));
	assertEquals(2, (long)fileNames.size());

	// make all fileNames lowercase, so we can find them.
	std::for_each(fileNames.begin(), fileNames.end(), MakeFileNameLowerCase);

	StringCollection::iterator fileName = std::find(fileNames.begin(), fileNames.end(), tolower(TEST_FOLDER + _T("\\testgetfiles\\filea.doc")));
	assertMessage(fileName != fileNames.end(), _T("Expected to find [") + TEST_FOLDER + _T("\\testgetfiles\\filea.doc] in the returned list"));

	fileName = std::find(fileNames.begin(), fileNames.end(), tolower(TEST_FOLDER + _T("\\testgetfiles\\fileb.doc")));
	assertMessage(fileName != fileNames.end(), _T("Expected to find [") + TEST_FOLDER + _T("\\testgetfiles\\fileb.doc] in the returned list"));
}
开发者ID:killbug2004,项目名称:WSProf,代码行数:15,代码来源:TestDirectory.cpp

示例4: FromClientId

bool TestMultiPackageHostContext::FromClientId(std::wstring const& clientId, TestMultiPackageHostContext & testMultiPackageHostContext)
{
    StringCollection collection;
    StringUtility::Split<wstring>(clientId, collection, TestMultiPackageHostContext::ParamDelimiter);
    if(collection.size() == 2)
    {
        Federation::NodeId nodeId;
        TestSession::FailTestIfNot(Federation::NodeId::TryParse(collection[0], nodeId), "Could not parse NodeId: {0}", clientId);
        testMultiPackageHostContext = TestMultiPackageHostContext(nodeId.ToString(), collection[1]);
        return true;
    }
    else
    {
        return false;
    }
}
开发者ID:vturecek,项目名称:Service-Fabric,代码行数:16,代码来源:TestMultiPackageHostContext.cpp

示例5: ApplicationCapacitiesDescription

map<wstring, ApplicationCapacitiesDescription> PlacementAndLoadBalancingUnitTest::CreateApplicationCapacities(wstring appCapacities)
{
    map<std::wstring, ApplicationCapacitiesDescription> capacityDesc;

    StringCollection capacityCollection;
    StringUtility::Split<wstring>(appCapacities, capacityCollection, ItemDelimiter);
    for (wstring const& metricStr : capacityCollection)
    {
        StringCollection metricProperties;
        StringUtility::Split<wstring>(metricStr, metricProperties, PairDelimiter);

        ASSERT_IFNOT(metricProperties.size() == 4, "CreateApplicationCapacities metric error");

        wstring metricName = metricProperties[0];
        capacityDesc.insert(make_pair(metricName,
            ApplicationCapacitiesDescription(move(metricProperties[0]), _wtoi(metricProperties[1].c_str()), _wtoi(metricProperties[2].c_str()), _wtoi(metricProperties[3].c_str()))));
    }

    return capacityDesc;
}
开发者ID:vturecek,项目名称:Service-Fabric,代码行数:20,代码来源:TestUtility.cpp

示例6: if

vector<ReplicaDescription> PlacementAndLoadBalancingUnitTest::CreateReplicas(wstring replicas, bool isUp)
{
    vector<ReplicaDescription> replicaVector;

    // format [replica1], [replica2], ...
    // each replica: [replicaRole]/[nodeIndex]/[IsToBePromoted][IsMoveInProgress][IsToBeDropped][IsInBuild]
    // replicaRole: P or S or SB
    // the last three descriptions optional inputs: PDB; treated as false by default
    StringCollection placement;
    StringUtility::Split<wstring>(replicas, placement, ItemDelimiter);

    for (wstring const& replica : placement)
    {
        StringCollection replicaFields;
        StringUtility::Split<wstring>(replica, replicaFields, PairDelimiter);

        ReplicaRole::Enum role = ReplicaRole::None;
        Reliability::ReplicaStates::Enum state = Reliability::ReplicaStates::Ready;
        StringUtility::TrimSpaces(replicaFields[0]);

        if (replicaFields[0] == L"P")
        {
            role = ReplicaRole::Primary;
        }
        else if (replicaFields[0] == L"S" || replicaFields[0] == L"I")
        {
            role = ReplicaRole::Secondary;
        }
        else if (replicaFields[0] == L"N")
        {
            role = ReplicaRole::None;
        }
        else if (replicaFields[0] == L"SB")
        {
            role = ReplicaRole::StandBy;
            state = Reliability::ReplicaStates::StandBy;
        }
        else if (replicaFields[0] == L"D")
        {
            role = ReplicaRole::Dropped;
            state = Reliability::ReplicaStates::Dropped;
        }

        int nodeIndex = _wtoi(replicaFields[1].c_str());
        Reliability::ReplicaFlags::Enum flags = Reliability::ReplicaFlags::None;

        if (replicaFields.size() >= 3)
        {
            wstring properties = replica.substr(replicaFields[0].length() + replicaFields[1].length() + 2);

            if (StringUtility::Contains<wstring>(properties, L"B"))
            {
                state = Reliability::ReplicaStates::InBuild;
            }

            if (StringUtility::Contains<wstring>(properties, L"I"))
            {
                flags = static_cast<Reliability::ReplicaFlags::Enum>(flags ^ Reliability::ReplicaFlags::PrimaryToBeSwappedOut);
            }

            if (StringUtility::Contains<wstring>(properties, L"J"))
            {
                flags = static_cast<Reliability::ReplicaFlags::Enum>(flags ^ Reliability::ReplicaFlags::PrimaryToBePlaced);
            }

            if (StringUtility::Contains<wstring>(properties, L"K"))
            {
                flags = static_cast<Reliability::ReplicaFlags::Enum>(flags ^ Reliability::ReplicaFlags::ReplicaToBePlaced);
            }

            if (StringUtility::Contains<wstring>(properties, L"V"))
            {
                flags = static_cast<Reliability::ReplicaFlags::Enum>(flags ^ Reliability::ReplicaFlags::MoveInProgress);
            }

            if (StringUtility::Contains<wstring>(properties, L"D"))
            {
                flags = static_cast<Reliability::ReplicaFlags::Enum>(flags ^ Reliability::ReplicaFlags::ToBeDroppedByFM);
            }

            if (StringUtility::Contains<wstring>(properties, L"R"))
            {
                flags = static_cast<Reliability::ReplicaFlags::Enum>(flags ^ Reliability::ReplicaFlags::ToBeDroppedByPLB);
            }

            if (StringUtility::Contains<wstring>(properties, L"T"))
            {
                flags = static_cast<Reliability::ReplicaFlags::Enum>(flags ^ Reliability::ReplicaFlags::ToBeDroppedForNodeDeactivation);
            }

            if (StringUtility::Contains<wstring>(properties, L"P"))
            {
                flags = static_cast<Reliability::ReplicaFlags::Enum>(flags ^ Reliability::ReplicaFlags::ToBePromoted);
            }

            if (StringUtility::Contains<wstring>(properties, L"N"))
            {
                flags = static_cast<Reliability::ReplicaFlags::Enum>(flags ^ Reliability::ReplicaFlags::PendingRemove);
            }

//.........这里部分代码省略.........
开发者ID:vturecek,项目名称:Service-Fabric,代码行数:101,代码来源:TestUtility.cpp


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