presage
0.8.8
Main Page
Classes
Files
File List
File Members
src
lib
core
profile.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_PROFILE
26
#define PRESAGE_PROFILE
27
28
#include "config.h"
29
30
#include <tinyxml.h>
31
32
#include <vector>
33
#include <string>
34
#include <map>
35
36
typedef
std::string
Value
;
37
#include "
configuration.h
"
38
#include "
presageException.h
"
39
56
class
Profile
{
57
public
:
62
Profile
(
const
std::string& filename);
63
69
virtual
~Profile
();
70
74
void
read_into_configuration
(
Configuration
* configuration);
75
76
/* Reads from configuration and writes to XML DOM document.
77
*
78
*/
79
void
read_from_configuration
(
Configuration
* configuration);
80
81
bool
file_read_ok
()
const
;
82
83
bool
write_to_file
()
const
;
84
85
class
ProfileException
:
public
PresageException
{
86
public
:
87
ProfileException
(
presage_error_code_t
code
,
const
std::string& desc)
throw
() :
PresageException
(
code
, desc) { }
88
virtual
~ProfileException
() throw() { }
89
90
private
:
91
ProfileException
() throw() :
PresageException
(
PRESAGE_ERROR
, "") { }
92
93
};
94
95
protected
:
96
void
init_configuration
(
Configuration
*
config
, TiXmlDocument* node);
97
void
visit_node
(
Configuration
*
config
, TiXmlNode* node, std::vector<std::string> variable);
98
99
TiXmlDocument*
xmlProfileDoc
;
100
std::string
xml_filename
;
101
bool
xml_profile_read_ok
;
102
};
103
104
#endif // PRESAGE_PROFILE
Generated on Thu Nov 7 2013 14:39:06 for presage by
1.8.4