FFmpegKit iOS / macOS / tvOS API  4.4
ReturnCode.m
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2021 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 #import "ReturnCode.h"
21 
22 @implementation ReturnCode {
23  int _value;
24 }
25 
26 - (instancetype)init:(int)value {
27  self = [super init];
28  if (self) {
29  _value = value;
30  }
31 
32  return self;
33 }
34 
35 + (BOOL)isSuccess:(ReturnCode*)value {
36  return (value != nil) && ([value getValue] == ReturnCodeSuccess);
37 }
38 
39 + (BOOL)isCancel:(ReturnCode*)value {
40  return (value != nil) && ([value getValue] == ReturnCodeCancel);
41 }
42 
43 - (int)getValue {
44  return _value;
45 }
46 
47 - (BOOL)isSuccess {
48  return (_value == ReturnCodeSuccess);
49 }
50 
51 - (BOOL)isError {
52  return ((_value != ReturnCodeSuccess) && (_value != ReturnCodeCancel));
53 }
54 
55 - (BOOL)isCancel {
56  return (_value == ReturnCodeCancel);
57 }
58 
59 - (NSString*)description {
60  return [NSString stringWithFormat:@"%d", _value];
61 }
62 
63 @end
int getValue()
Definition: ReturnCode.m:43