presage
0.8.8
Main Page
Classes
Files
File List
File Members
src
lib
core
profileManager.h
Go to the documentation of this file.
1
2
/******************************************************
3
* Presage, an extensible predictive text entry system
4
* ---------------------------------------------------
5
*
6
* Copyright (C) 2008 Matteo Vescovi <matteo.vescovi@yahoo.co.uk>
7
8
This program is free software; you can redistribute it and/or modify
9
it under the terms of the GNU General Public License as published by
10
the Free Software Foundation; either version 2 of the License, or
11
(at your option) any later version.
12
13
This program is distributed in the hope that it will be useful,
14
but WITHOUT ANY WARRANTY; without even the implied warranty of
15
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
GNU General Public License for more details.
17
18
You should have received a copy of the GNU General Public License along
19
with this program; if not, write to the Free Software Foundation, Inc.,
20
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21
*
22
**********(*)*/
23
24
25
#ifndef PRESAGE_PROFILEMANAGER
26
#define PRESAGE_PROFILEMANAGER
27
28
#include "
profile.h
"
29
#include "
defaultProfile.h
"
30
#include "
combiner.h
"
31
#include "
logger.h
"
32
#include "
dispatcher.h
"
33
34
#include <string>
35
#include <list>
36
#include <sstream>
// for std::ostringstream
37
#include <stdio.h>
// for int remove( const char* ) to remove files/dirs
38
39
51
class
ProfileManager
{
52
public
:
53
ProfileManager
(
const
std::string =
""
);
54
~ProfileManager
();
55
56
void
save_profile
()
const
;
57
58
Configuration
*
get_configuration
();
59
60
void
set_autopersist
(
const
std::string& value);
61
62
static
const
char
*
LOGGER
;
63
static
const
char
*
AUTOPERSIST
;
64
65
private
:
66
void
init_profiles
(
const
std::string& profilename);
67
68
Profile
*
create_profile_from_xml
(
const
std::string& filename);
69
70
std::string
get_user_home_dir
()
const
;
71
std::string
get_system_etc_dir
()
const
;
72
73
bool
loaded_at_least_one_profile
;
74
77
void
cache_log_message
(
Logger<char>::Level
level,
const
std::string& message);
80
void
flush_cached_log_messages
();
83
void
refresh_config
();
84
85
struct
CachedLogMessage
{
86
// Level is commented out because it gets translated to
87
// numeric value of enum, instead of acting as templatized
88
// function type switching the logger level as intended. This
89
// is not an issue however since all cached log messages need
90
// to be logged at same level, so we can hardcode level in
91
// flush method.
92
//
93
//Logger<char>::Level level;
94
std::string
message
;
95
};
96
97
std::list<CachedLogMessage>
cached_log_messages
;
98
99
Configuration
*
config
;
100
Profile
*
rw_profile
;
// readable-writable profile
101
bool
autopersist_config
;
102
103
Logger<char>
logger
;
104
105
};
106
107
108
#endif // PRESAGE_PROFILEMANAGER
Generated on Tue Apr 8 2014 13:23:50 for presage by
1.8.1.2