FFmpegKit Linux API 5.1
ReturnCode.cpp
Go to the documentation of this file.
1/*
2 * Copyright (c) 2022 Taner Sener
3 *
4 * This file is part of FFmpegKit.
5 *
6 * FFmpegKit is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU Lesser General License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * FFmpegKit is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU Lesser General License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General License
17 * along with FFmpegKit. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20#include "ReturnCode.h"
21
22bool ffmpegkit::ReturnCode::isSuccess(const std::shared_ptr<ffmpegkit::ReturnCode> value) {
23 return (value != nullptr) && (value->getValue() == Success);
24}
25
26bool ffmpegkit::ReturnCode::isCancel(const std::shared_ptr<ffmpegkit::ReturnCode> value) {
27 return (value != nullptr) && (value->getValue() == Cancel);
28}
29
30ffmpegkit::ReturnCode::ReturnCode(const int value) : _value {value} {
31}
32
34 return _value;
35}
36
38 return (_value == Success);
39}
40
42 return ((_value != Success) && (_value != Cancel));
43}
44
46 return (_value == Cancel);
47}
48
49namespace ffmpegkit {
50
51 std::ostream& operator<<(std::ostream& out, const std::shared_ptr<ffmpegkit::ReturnCode>& o) {
52 if (o == nullptr) {
53 return out;
54 } else {
55 return out << o->_value;
56 }
57 }
58
59}
bool isValueError() const
Definition: ReturnCode.cpp:41
static bool isCancel(const std::shared_ptr< ffmpegkit::ReturnCode > value)
Definition: ReturnCode.cpp:26
static constexpr int Success
Definition: ReturnCode.h:30
bool isValueCancel() const
Definition: ReturnCode.cpp:45
static bool isSuccess(const std::shared_ptr< ffmpegkit::ReturnCode > value)
Definition: ReturnCode.cpp:22
bool isValueSuccess() const
Definition: ReturnCode.cpp:37
int getValue() const
Definition: ReturnCode.cpp:33
ReturnCode(const int value)
Definition: ReturnCode.cpp:30
std::ostream & operator<<(std::ostream &out, const std::shared_ptr< ffmpegkit::ReturnCode > &o)
Definition: ReturnCode.cpp:51