Colobot
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Pages
src
app
system.h
Go to the documentation of this file.
1
// * This file is part of the COLOBOT source code
2
// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
3
// * Copyright (C) 2012, Polish Portal of Colobot (PPC)
4
// *
5
// * This program is free software: you can redistribute it and/or modify
6
// * it under the terms of the GNU General Public License as published by
7
// * the Free Software Foundation, either version 3 of the License, or
8
// * (at your option) any later version.
9
// *
10
// * This program is distributed in the hope that it will be useful,
11
// * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
// * GNU General Public License for more details.
14
// *
15
// * You should have received a copy of the GNU General Public License
16
// * along with this program. If not, see http://www.gnu.org/licenses/.
17
23
#pragma once
24
25
#include "
common/singleton.h
"
26
27
#include <string>
28
33
enum
SystemDialogType
34
{
36
SDT_INFO
,
38
SDT_WARNING
,
40
SDT_ERROR
,
42
SDT_YES_NO
,
44
SDT_OK_CANCEL
45
};
46
53
enum
SystemDialogResult
54
{
55
SDR_OK,
56
SDR_CANCEL,
57
SDR_YES,
58
SDR_NO
59
};
60
65
enum
SystemTimeUnit
66
{
68
STU_SEC
,
70
STU_MSEC
,
72
STU_USEC
73
};
74
75
/*
76
* Forward declaration of time stamp struct
77
* SystemTimeStamp should only be used in a pointer context.
78
* The implementation details are hidden because of platform dependence.
79
*/
80
struct
SystemTimeStamp
;
81
89
class
CSystemUtils
:
public
CSingleton
<CSystemUtils>
90
{
91
protected
:
92
CSystemUtils
();
93
94
public
:
96
static
CSystemUtils
*
Create
();
97
99
virtual
void
Init
() = 0;
100
102
virtual
SystemDialogResult
SystemDialog
(
SystemDialogType
,
const
std::string &title,
const
std::string &message) = 0;
103
105
TEST_VIRTUAL
SystemDialogResult
ConsoleSystemDialog
(
SystemDialogType
type,
const
std::string& title,
const
std::string& message);
106
108
TEST_VIRTUAL
SystemTimeStamp
*
CreateTimeStamp
();
109
111
TEST_VIRTUAL
void
DestroyTimeStamp
(
SystemTimeStamp
*stamp);
112
114
TEST_VIRTUAL
void
CopyTimeStamp
(
SystemTimeStamp
*dst,
SystemTimeStamp
*src);
115
117
virtual
void
GetCurrentTimeStamp
(
SystemTimeStamp
*stamp) = 0;
118
120
TEST_VIRTUAL
float
GetTimeStampResolution
(
SystemTimeUnit
unit =
STU_SEC
);
121
123
virtual
long
long
GetTimeStampExactResolution
() = 0;
124
126
127
TEST_VIRTUAL
float
TimeStampDiff
(
SystemTimeStamp
*before,
SystemTimeStamp
*after,
SystemTimeUnit
unit =
STU_SEC
);
128
130
131
virtual
long
long
TimeStampExactDiff
(
SystemTimeStamp
*before,
SystemTimeStamp
*after) = 0;
132
134
virtual
std::string
GetDataPath
();
135
137
virtual
std::string
GetLangPath
();
138
140
virtual
std::string
GetProfileFileLocation
();
141
143
virtual
std::string
GetSavegameDirectoryLocation
();
144
};
145
147
inline
CSystemUtils
*
GetSystemUtils
()
148
{
149
return
CSystemUtils::GetInstancePointer();
150
}
151
Generated on Sat Jul 5 2014 09:25:01 for Colobot by
1.8.1.2