base/include/base/linux/proc_parser.h¶
Provides utilities for parsing Linux /proc and /sys files. More...
Namespaces¶
| Name |
|---|
| cf |
Detailed Description¶
Provides utilities for parsing Linux /proc and /sys files.
Author: Charliechen114514
Version: 0.1
Since: 0.1
Date: 2026-02-22
Offers modern C++17 utilities for parsing common Linux pseudo-filesystem formats without exceptions or allocations where possible.
Source code¶
#pragma once
#include <cstdint>
#include <optional>
#include <string_view>
namespace cf {
std::string_view parse_cpuinfo_field(std::string_view line, std::string_view field) noexcept;
std::string_view trim_whitespace(std::string_view sv) noexcept;
std::string_view ltrim_whitespace(std::string_view sv) noexcept;
std::string_view rtrim_whitespace(std::string_view sv) noexcept;
std::optional<uint32_t> parse_cache_size(std::string_view size_str) noexcept;
std::optional<uint32_t> parse_uint32(std::string_view str) noexcept;
std::optional<uint32_t> parse_hex_uint32(std::string_view str) noexcept;
std::optional<uint32_t> read_uint32_file(const char* path) noexcept;
std::string_view arm_implementer_to_vendor(uint32_t impl_val) noexcept;
} // namespace cf
Updated on 2026-03-09 at 10:14:01 +0000