presage
0.8.8
Main Page
Classes
Files
File List
File Members
src
lib
core
variable.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_VARIABLE
26
#define PRESAGE_VARIABLE
27
28
#include <string>
29
#include <vector>
30
31
#include "
observable.h
"
32
33
class
Variable
:
public
Observable
{
34
public
:
35
Variable
(
const
char
* variable);
36
Variable
(
const
std::string& variable);
37
Variable
(
const
std::vector<std::string>& variable);
38
~Variable
();
39
40
std::string
get_name
()
const
;
41
std::vector<std::string>
get_name_vector
()
const
;
42
43
std::string
get_value
()
const
;
44
void
set_value
(std::string value);
45
46
size_t
size
()
const
{
return
m_name_vector
.size(); }
47
48
bool
operator<
(
const
Variable
& other)
const
{
return
(get_name () < other.
get_name
()); }
49
50
static
std::vector<std::string>
string_to_vector
(
const
std::string& str);
51
static
std::string
vector_to_string
(
const
std::vector<std::string>& var);
52
53
private
:
54
55
std::string
m_name
;
56
std::vector<std::string>
m_name_vector
;
57
std::string
m_value
;
58
59
};
60
61
#endif // PRESAGE_VARIABLE
Generated on Wed Jun 13 2012 10:34:24 for presage by
1.8.1