Roc Toolkit internal modules
Roc Toolkit: real-time audio streaming
Toggle main menu visibility
Loading...
Searching...
No Matches
parse_units.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2019 Roc Streaming authors
3
*
4
* This Source Code Form is subject to the terms of the Mozilla Public
5
* License, v. 2.0. If a copy of the MPL was not distributed with this
6
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
7
*/
8
9
//! @file roc_core/parse_units.h
10
//! @brief Parse units like duration, size, etc.
11
12
#ifndef ROC_CORE_PARSE_UNITS_H_
13
#define ROC_CORE_PARSE_UNITS_H_
14
15
#include "
roc_core/attributes.h
"
16
#include "
roc_core/time.h
"
17
18
namespace
roc
{
19
namespace
core
{
20
21
//! Parse duration from string.
22
//!
23
//! @remarks
24
//! The input string should be in one of the following forms:
25
//! - "<number>ns"
26
//! - "<number>us"
27
//! - "<number>ms"
28
//! - "<number>s"
29
//! - "<number>m"
30
//! - "<number>h"
31
//!
32
//! @returns
33
//! false if string can't be parsed.
34
ROC_ATTR_NODISCARD
bool
parse_duration
(
const
char
*
string
,
nanoseconds_t
& result);
35
36
//! Parse size from string.
37
//!
38
//! @remarks
39
//! The input string should be in one of the following forms:
40
//! - "<number>"
41
//! - "<number>K"
42
//! - "<number>M"
43
//! - "<number>G"
44
//!
45
//! @returns
46
//! false if string can't be parsed.
47
ROC_ATTR_NODISCARD
bool
parse_size
(
const
char
*
string
,
size_t
& result);
48
49
}
// namespace core
50
}
// namespace roc
51
52
#endif
// ROC_CORE_PARSE_UNITS_H_
attributes.h
Compiler attributes.
ROC_ATTR_NODISCARD
#define ROC_ATTR_NODISCARD
Emit warning if function result is not checked.
Definition
attributes.h:31
roc::core
General-purpose building blocks and platform abstraction layer.
roc::core::parse_duration
ROC_ATTR_NODISCARD bool parse_duration(const char *string, nanoseconds_t &result)
Parse duration from string.
roc::core::nanoseconds_t
int64_t nanoseconds_t
Nanoseconds.
Definition
time.h:58
roc::core::parse_size
ROC_ATTR_NODISCARD bool parse_size(const char *string, size_t &result)
Parse size from string.
roc
Root namespace.
time.h
Time definitions.
roc_core
parse_units.h
Generated by
1.17.0