Seamly2D
Code documentation
vsysexits.h
Go to the documentation of this file.
1 /***************************************************************************
2  * *
3  * Copyright (C) 2017 Seamly, LLC *
4  * *
5  * https://github.com/fashionfreedom/seamly2d *
6  * *
7  ***************************************************************************
8  **
9  ** Seamly2D is free software: you can redistribute it and/or modify
10  ** it under the terms of the GNU General Public License as published by
11  ** the Free Software Foundation, either version 3 of the License, or
12  ** (at your option) any later version.
13  **
14  ** Seamly2D is distributed in the hope that it will be useful,
15  ** but WITHOUT ANY WARRANTY; without even the implied warranty of
16  ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  ** GNU General Public License for more details.
18  **
19  ** You should have received a copy of the GNU General Public License
20  ** along with Seamly2D. If not, see <http://www.gnu.org/licenses/>.
21  **
22  **************************************************************************
23 
24  ************************************************************************
25  **
26  ** @file vsysexits.h
27  ** @author Roman Telezhynskyi <dismine(at)gmail.com>
28  ** @date 28 9, 2015
29  **
30  ** @brief
31  ** @copyright
32  ** This source code is part of the Valentine project, a pattern making
33  ** program, whose allow create and modeling patterns of clothing.
34  ** Copyright (C) 2015 Seamly2D project
35  ** <https://github.com/fashionfreedom/seamly2d> All Rights Reserved.
36  **
37  ** Seamly2D is free software: you can redistribute it and/or modify
38  ** it under the terms of the GNU General Public License as published by
39  ** the Free Software Foundation, either version 3 of the License, or
40  ** (at your option) any later version.
41  **
42  ** Seamly2D is distributed in the hope that it will be useful,
43  ** but WITHOUT ANY WARRANTY; without even the implied warranty of
44  ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
45  ** GNU General Public License for more details.
46  **
47  ** You should have received a copy of the GNU General Public License
48  ** along with Seamly2D. If not, see <http://www.gnu.org/licenses/>.
49  **
50  *************************************************************************/
51 
52 #ifndef VSYSEXITS_H
53 #define VSYSEXITS_H
54 
55 #include <QTextStream>
56 
57 #ifdef __GNUC__
58 #define V_UNUSED __attribute__ ((unused))
59 #else
60 #define V_UNUSED
61 #endif
62 
63 static const auto V_UNUSED V_EX_OK = 0; /*Indicate the successful exit.*/
64 
65 static const auto V_UNUSED V_EX_USAGE = 64; /*The command was used incorrectly, e.g., with the wrong number of
66  arguments, a bad flag, a bad syntax in a parameter, or whatever.*/
67 
68 static const auto V_UNUSED V_EX_DATAERR = 65; /*The input data was incorrect in some way. This should only be
69  used for user's data and not system files.*/
70 
71 static const auto V_UNUSED V_EX_NOINPUT = 66; /*An input file (not a system file) did not exist or was not
72  readable.*/
73 
74 static const auto V_UNUSED V_EX_UNAVAILABLE = 69; /*A service is unavailable. This can occur if a support program or
75  file does not exist. This can also be used as a catchall message
76  when something you wanted to do doesn't work, but you don't know
77  why.*/
78 
79 static const auto V_UNUSED V_EX_SOFTWARE = 70; /*An internal software error has been detected. This should be
80  limited to nonoperating operating system related errors as
81  possible.*/
82 
83 static const auto V_UNUSED V_EX_OSERR = 71; /*An operating system error has been detected. This is intended to be
84  used for such things as ``cannot fork'', ``cannot create pipe'', or
85  the like. It includes things like getuid returning a user that does
86  not exist in the passwd file.*/
87 
88 static const auto V_UNUSED V_EX_OSFILE = 72; /*Some system file (e.g., /etc/passwd, /var/run/utmp, etc.) does not
89  exist, cannot be opened, or has some sort of error (e.g., syntax
90  error).*/
91 
92 static const auto V_UNUSED V_EX_CANTCREAT = 73; /*A (user specified) output file cannot be created.*/
93 
94 static const auto V_UNUSED V_EX_IOERR = 74; /*An error occurred while doing I/O on some file.*/
95 
96 static const auto V_UNUSED V_EX_NOPERM = 77; /*You did not have sufficient permission to perform the operation.
97  This is not intended for file system problems, which should use
98  EX_NOINPUT or EX_CANTCREAT, but rather for higher level
99  permissions.*/
100 
101 static const auto V_UNUSED V_EX_CONFIG = 78; /*Something was found in an unconfigured or misconfigured state.*/
102 
103 #undef V_UNUSED
104 
105 //---------------------------------------------------------------------------------------------------------------------
106 inline QTextStream& vStdErr()
107 {
108  static QTextStream ts( stderr );
109  ts.flush();
110  return ts;
111 }
112 
113 //---------------------------------------------------------------------------------------------------------------------
114 inline QTextStream& vStdOut()
115 {
116  static QTextStream ts( stdout );
117  ts.flush();
118  return ts;
119 }
120 
121 #endif // VSYSEXITS_H
static const auto V_EX_USAGE
Definition: vsysexits.h:65
static const auto V_EX_DATAERR
Definition: vsysexits.h:68
QTextStream & vStdOut()
Definition: vsysexits.h:114
static const auto V_EX_OK
Definition: vsysexits.h:63
static const auto V_EX_OSERR
Definition: vsysexits.h:83
static const auto V_EX_IOERR
Definition: vsysexits.h:94
static const auto V_EX_SOFTWARE
Definition: vsysexits.h:79
static const auto V_EX_CONFIG
Definition: vsysexits.h:101
static const auto V_EX_NOINPUT
Definition: vsysexits.h:71
static const auto V_EX_CANTCREAT
Definition: vsysexits.h:92
#define V_UNUSED
Definition: vsysexits.h:60
static const auto V_EX_NOPERM
Definition: vsysexits.h:96
QTextStream & vStdErr()
Definition: vsysexits.h:106
static const auto V_EX_OSFILE
Definition: vsysexits.h:88
static const auto V_EX_UNAVAILABLE
Definition: vsysexits.h:74