Some checks failed
dev release / build (push) Failing after 12s
Builds out the full v1 scope: a vendored+patched openscreen subset for low-latency Cast Streaming (Mirroring receiver 0F5096E8) alongside the existing Cast V2/HLS and new DLNA/AVTransport casting paths, breadcastd's Idle/Casting state machine with a private IPC socket, the breadcast GTK4 popup as a thin IPC client, and bread.cast.*/bread.command.cast.* breadd integration (device discovery, start/stop, mirroring lifecycle events). Also adds bakery/systemd/Forgejo CI packaging. Validated end-to-end against a real Chromecast/Google TV: negotiated Cast Streaming session, live pipeline playback, and daemon+GUI click-to-cast/ stop through the actual popup.
32 lines
1 KiB
C++
32 lines
1 KiB
C++
// Copyright 2024 The Chromium Authors
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
// found in the LICENSE file.
|
|
|
|
#ifndef UTIL_STRING_PARSE_H_
|
|
#define UTIL_STRING_PARSE_H_
|
|
|
|
#include <charconv>
|
|
#include <optional>
|
|
#include <string_view>
|
|
#include <system_error>
|
|
|
|
#include "platform/base/type_util.h"
|
|
|
|
namespace openscreen::string_parse {
|
|
|
|
// Parses `number` into the numeric type `result` and returns true if
|
|
// successful. `number` must be an ASCII representation of an integer or
|
|
// floating point value, and `result` must be compatible with the resulting
|
|
// value. If `number` cannot be parsed, then returns false.
|
|
template <typename T, typename = internal::EnableIfArithmetic<T>>
|
|
bool ParseAsciiNumber(std::string_view number, T& result) {
|
|
if (number.empty())
|
|
return false;
|
|
auto [unused_ptr, error_code] =
|
|
std::from_chars(number.data(), &number.back() + 1, result);
|
|
return error_code == std::errc();
|
|
}
|
|
|
|
} // namespace openscreen::string_parse
|
|
|
|
#endif // UTIL_STRING_PARSE_H_
|