• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

STEllAR-GROUP / hpx / #882

31 Aug 2023 07:44PM UTC coverage: 41.798% (-44.7%) from 86.546%
#882

push

19442 of 46514 relevant lines covered (41.8%)

126375.38 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

76.92
/libs/core/program_options/src/positional_options.cpp
1
//  Copyright Vladimir Prus 2002-2004.
2
//
3
//  SPDX-License-Identifier: BSL-1.0
4
//  Distributed under the Boost Software License, Version 1.0. (See accompanying
5
//  file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6

7
#include <hpx/program_options/config.hpp>
8
#include <hpx/assert.hpp>
9
#include <hpx/program_options/positional_options.hpp>
10

11
#include <cstddef>
12
#include <limits>
13
#include <string>
14

15
namespace hpx::program_options {
16

17
    positional_options_description& positional_options_description::add(
137✔
18
        char const* name, int max_count)
19
    {
20
        HPX_ASSERT(max_count != -1 || m_trailing.empty());
21

22
        if (max_count == -1)
137✔
23
            m_trailing = name;
137✔
24
        else
25
        {
26
            m_names.resize(
×
27
                m_names.size() + static_cast<std::size_t>(max_count), name);
×
28
        }
29
        return *this;
137✔
30
    }
31

32
    unsigned positional_options_description::max_total_count() const noexcept
47✔
33
    {
34
        return m_trailing.empty() ? static_cast<unsigned>(m_names.size()) :
47✔
35
                                    (std::numeric_limits<unsigned>::max)();
47✔
36
    }
37

38
    std::string const& positional_options_description::name_for_position(
47✔
39
        unsigned position) const noexcept
40
    {
41
        HPX_ASSERT(position < max_total_count());
42

43
        if (static_cast<std::size_t>(position) < m_names.size())
47✔
44
            return m_names[static_cast<std::size_t>(position)];
×
45

46
        return m_trailing;
47✔
47
    }
48
}    // namespace hpx::program_options
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc