File: fsystem.h

package info (click to toggle)
finalcut 0.9.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 6,832 kB
  • sloc: cpp: 90,264; makefile: 546; sh: 412
file content (82 lines) | stat: -rw-r--r-- 3,163 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
/***********************************************************************
* fsystem.h - Abstract class for system calls                          *
*                                                                      *
* This file is part of the FINAL CUT widget toolkit                    *
*                                                                      *
* Copyright 2019-2022 Markus Gans                                      *
*                                                                      *
* FINAL CUT is free software; you can redistribute it and/or modify    *
* it under the terms of the GNU Lesser General Public License as       *
* published by the Free Software Foundation; either version 3 of       *
* the License, or (at your option) any later version.                  *
*                                                                      *
* FINAL CUT is distributed in the hope that it will be useful, but     *
* WITHOUT ANY WARRANTY; without even the implied warranty of           *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the        *
* GNU Lesser General Public License for more details.                  *
*                                                                      *
* You should have received a copy of the GNU Lesser General Public     *
* License along with this program.  If not, see                        *
* <http://www.gnu.org/licenses/>.                                      *
***********************************************************************/

/*  Standalone class
 *  ════════════════
 *
 * ▕▔▔▔▔▔▔▔▔▔▏
 * ▕ FSystem ▏
 * ▕▁▁▁▁▁▁▁▁▁▏
 */

#ifndef FSYSTEM_H
#define FSYSTEM_H

#if !defined (USE_FINAL_H) && !defined (COMPILE_FINAL_CUT)
  #error "Only <final/final.h> can be included directly."
#endif

#include <memory>
#include <pwd.h>

#include "final/ftypes.h"

namespace finalcut
{

//----------------------------------------------------------------------
// class FSystem
//----------------------------------------------------------------------

class FSystem
{
  public:
    // Constructor
    FSystem() = default;

    // Destructor
    virtual ~FSystem() noexcept;

    // Accessor
    static auto   getInstance() -> std::unique_ptr<FSystem>&;

    // Methods
    virtual auto inPortByte (uShort) -> uChar = 0;
    virtual void outPortByte (uChar, uShort) = 0;
    virtual auto isTTY (int) const -> int = 0;
    virtual auto ioctl (int, uLong, ...) -> int = 0;
    virtual auto open (const char*, int, ...) -> int = 0;
    virtual auto close (int) -> int = 0;
    virtual auto fopen (const char*, const char*) -> FILE* = 0;
    virtual auto fclose (FILE*) -> int = 0;
    virtual auto fputs (const char*, FILE*) -> int = 0;
    virtual auto putchar (int) -> int = 0;
    virtual auto getuid() -> uid_t = 0;
    virtual auto geteuid() -> uid_t = 0;
    virtual auto getpwuid_r ( uid_t, struct passwd*, char*
                            , size_t, struct passwd**) -> int = 0;
    virtual auto realpath (const char*, char*) -> char* = 0;
};

}  // namespace finalcut

#endif  // FSYSTEM_H