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

open-source-parsers / jsoncpp / 12718799426
95%

Build:
DEFAULT BRANCH: master
Ran 10 Jan 2025 11:26PM UTC
Jobs 1
Files 13
Run time 1min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

10 Jan 2025 11:25PM UTC coverage: 95.296%. Remained the same
12718799426

push

github

web-flow
feat: support std::string_view in Value API (#1584)

This adds direct support for `std::string_view` when available (C++17
and above). The current API can be used with `std::string_view` via the
low-level two-pointer methods, but is not ergonomic. E.g., compare:

```
Json::Value node;
std::string foo, bar, baz;
std::string_view foo_sv, bar_sv, baz_sv;

// Efficient & readable:
node[foo][bar][baz];
// Less efficient, less readable:
node[std::string(foo_sv)][std::string(bar_sv)][std::string(baz_sv)];
// Efficient, but a lot less readable:
*node.demand(foo_sv.data(), foo_sv.data() + foo_sv.size())
    ->demand(bar_sv.data(), bar_sv.data() + bar_sv.size())
    ->demand(baz_sv.data(), baz_sv.data() + baz_sv.size())
// After this change, efficient & readable:
node[foo_sv][bar_sv][baz_sv];
```

*   The constructor can take a `std::string_view` parameter. The existing
    overloads taking `const std::string&` and `const char*` are still necessary
    to support assignment from those types.
*   `operator[]`, `get()`, `isMember()` and `removeMember()` take a
    `std::string_view` parameter. This supersedes the overloads taking
    `const std::string&` and `const char*`. The overloads taking a pair of
    pointers (begin, end) are preserved for source compatibility.
*   `getString()` has an overload with a `std::string_view` output parameter.
    The one with a pair of pointers is preserved for source compatibility.

Signed-off-by: Lev Kandel <lmakhlis@google.com>
Co-authored-by: Jordan Bayles <bayles.jordan@gmail.com>

5308 of 5570 relevant lines covered (95.3%)

11930.82 hits per line

Jobs
ID Job ID Ran Files Coverage
1 12718799426.1 10 Jan 2025 11:26PM UTC 13
95.3
GitHub Action Run
Source Files on build 12718799426
  • Tree
  • List 13
  • Changed 2
  • Source Changed 2
  • Coverage Changed 2
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • 60ccc1f5 on github
  • Prev Build on master (#12718713558)
  • Next Build on master (#12718930626)
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