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


C++ StringView::getData方法代码示例

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


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

示例1: getSubs

    /**
     * @brief Returns all sub-configuration with given name.
     *
     * @param name Sub-configuration name.
     *
     * @return
     */
    DynamicArray<UniquePtr<config::Implementation>> getSubs(StringView name) const noexcept override
    {
        DynamicArray<UniquePtr<config::Implementation>> res;

        // Foreach children
        for (const auto& node : m_node.children(name.getData()))
            res.push_back(makeUnique<ConfigImplementation>(node.internal_object()));

        return res;
    }
开发者ID:GustavoPB,项目名称:CeCe,代码行数:17,代码来源:Configuration.hpp

示例2: changeMoleculeCount

    /**
     * @brief Add molecules of given name.
     *
     * @param name Molecule name.
     * @param diff Number of molecules.
     */
    void changeMoleculeCount(const StringView& name, MoleculeCountDifference diff) noexcept
    {
        // Get mutable reference
        auto& value = m_molecules[name.getData()];

        // We need to compare signed versions.
        // If not, this condition is always true.
        if (MoleculeCountDifference(value) + diff < 0)
            value = MoleculeCount(0);
        else
            value += diff;
    }
开发者ID:GustavoPB,项目名称:CeCe_,代码行数:18,代码来源:CellBase.hpp

示例3: has

 /**
  * @brief Check if value with given name exists.
  *
  * @param name Value name.
  *
  * @return
  */
 bool has(StringView name) const noexcept override
 {
     return !m_node.attribute(name.getData()).empty();
 }
开发者ID:GustavoPB,项目名称:CeCe,代码行数:11,代码来源:Configuration.hpp

示例4: addSub

 /**
  * @brief Create new sub-configuration.
  *
  * @param name Sub-configuration name.
  *
  * @return
  */
 UniquePtr<config::Implementation> addSub(StringView name) noexcept override
 {
     return makeUnique<ConfigImplementation>(m_node.append_child(name.getData()));
 }
开发者ID:GustavoPB,项目名称:CeCe,代码行数:11,代码来源:Configuration.hpp

示例5: setContent

 /**
  * @brief Store content.
  *
  * @param content Content text.
  */
 void setContent(StringView content) noexcept override
 {
     m_node.text().set(content.getData());
 }
开发者ID:GustavoPB,项目名称:CeCe,代码行数:9,代码来源:Configuration.hpp

示例6: set

 /**
  * @brief Set string value.
  *
  * @param name  Value name.
  * @param value Value to store.
  *
  * @return
  */
 void set(StringView name, StringView value) noexcept override
 {
     m_node.attribute(name.getData()).set_value(value.getData());
 }
开发者ID:GustavoPB,项目名称:CeCe,代码行数:12,代码来源:Configuration.hpp

示例7: hasSubs

 /**
  * @brief Returns if sub-configuration exists.
  *
  * @param name Sub-configuration name.
  *
  * @return
  */
 bool hasSubs(StringView name) const noexcept override
 {
     auto rng = m_node.children(name.getData());
     return rng.begin() != rng.end();
 }
开发者ID:GustavoPB,项目名称:CeCe,代码行数:12,代码来源:Configuration.hpp

示例8: get

 /**
  * @brief Returns string value.
  *
  * @param name Value name.
  *
  * @return
  */
 String get(StringView name) const noexcept override
 {
     return m_node.attribute(name.getData()).value();
 }
开发者ID:GustavoPB,项目名称:CeCe,代码行数:11,代码来源:Configuration.hpp

示例9: setMoleculeCount

 /**
  * @brief Set a number of molecules of given name.
  *
  * @param name  Molecule name.
  * @param count Number of molecules.
  */
 void setMoleculeCount(const StringView& name, MoleculeCount count) noexcept
 {
     m_molecules[name.getData()] = count;
 }
开发者ID:GustavoPB,项目名称:CeCe_,代码行数:10,代码来源:CellBase.hpp

示例10: getMoleculeCount

 /**
  * @brief Returns a number moulecules of given name.
  *
  * @param name Molecule name.
  *
  * @return Number of molecules.
  */
 MoleculeCount getMoleculeCount(const StringView& name) const noexcept
 {
     auto it = m_molecules.find(name.getData());
     return it != m_molecules.end() ? it->second : MoleculeCount();
 }
开发者ID:GustavoPB,项目名称:CeCe_,代码行数:12,代码来源:CellBase.hpp

示例11: string

TEST(StringViewTests, stdStringConstructor) {
  std::string string("ABCD");
  const StringView view = string;
  ASSERT_EQ(string.data(), view.getData());
  ASSERT_EQ(string.size(), view.getSize());
}
开发者ID:HBNCoins,项目名称:cryptonote,代码行数:6,代码来源:StringViewTests.cpp

示例12:

TEST(StringViewTests, arrayConstructor) {
  const char data[] = "ABCD";
  const StringView view = data;
  ASSERT_EQ(data, view.getData());
  ASSERT_EQ(4, view.getSize());
}
开发者ID:HBNCoins,项目名称:cryptonote,代码行数:6,代码来源:StringViewTests.cpp


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