1 // $Id: system_context.hxx,v 1.9 2003/07/28 22:46:48 grumbel Exp $
3 // Construo - A wire-frame construction game
4 // Copyright (C) 2002 Ingo Ruhnke <grumbel@gmx.de>
6 // This program is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU General Public License
8 // as published by the Free Software Foundation; either version 2
9 // of the License, or (at your option) any later version.
11 // This program 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 General Public License for more details.
16 // You should have received a copy of the GNU General Public License
17 // along with this program; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 #ifndef HEADER_SYSTEM_CONTEXT_HXX
21 #define HEADER_SYSTEM_CONTEXT_HXX
27 /** Simple enum for the different file types that Constro supports,
28 * since it doesn't really support much, it only contains directory,
29 * construo file and unknown file */
36 /** System stuff like file-IO and time */
41 virtual unsigned int get_time () =0;
43 /** sleep for the given number of milisec */
44 virtual void sleep (unsigned long) =0;
46 /** @return '$HOME/.construo/' */
47 virtual std::string
get_construo_rc_path () =0;
49 /** @return the realname of the current user */
50 virtual std::string
get_user_realname() =0;
52 /** @return the email of the current user or an empty string if not available */
53 virtual std::string
get_user_email() =0;
55 /** @return the type of the given file */
56 virtual FileType
get_file_type(const std::string
& filename
) =0;
58 virtual FILE* open_input_file(const std::string
& filename
) =0;
59 virtual FILE* open_output_file(const std::string
& filename
) =0;
61 virtual unsigned int get_mtime (const std::string
& filename
) =0;
63 /** @return a list of files available in the given directory */
64 virtual std::vector
<std::string
> read_directory(const std::string
& pathname
) =0;
66 virtual std::string
translate_filename (const std::string
&) =0;