• 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

0.0
/libs/core/program_options/include/hpx/program_options/environment_iterator.hpp
1
//  Copyright Vladimir Prus 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
#pragma once
8

9
#include <hpx/program_options/config.hpp>
10
#include <hpx/assert.hpp>
11
#include <hpx/program_options/eof_iterator.hpp>
12

13
#include <string>
14
#include <utility>
15

16
namespace hpx::program_options {
17

18
    HPX_CXX_EXPORT class environment_iterator
×
19
      : public eof_iterator<environment_iterator,
20
            std::pair<std::string, std::string>>
21
    {
22
    public:
23
        explicit environment_iterator(char** environment)
×
24
          : m_environment(environment)
×
25
        {
26
            get();
×
27
        }
×
28

29
        environment_iterator()
30
          : m_environment(nullptr)
×
31
        {
32
            found_eof();
33
        }
×
34

35
        void get()
×
36
        {
37
            if (*m_environment == nullptr)
×
38
                found_eof();
39
            else
40
            {
41
                std::string s(*m_environment);
×
42
                std::string::size_type n = s.find('=');
×
43
                HPX_ASSERT(n != s.npos);
44
                value().first = s.substr(0, n);
×
45
                value().second = s.substr(n + 1);
×
46

47
                ++m_environment;
×
48
            }
49
        }
×
50

51
    private:
52
        char** m_environment;
53
    };
54
}    // 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