1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * Copyright (C) 2005 Takuro Ashie
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 2, or (at your option)
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.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 #ifndef __SCIM_ANTHY_STYLE_FILE_H__
21 #define __SCIM_ANTHY_STYLE_FILE_H__
23 #define Uses_SCIM_ICONV
26 #include "scim_anthy_key2kana_table.h"
30 namespace scim_anthy {
36 typedef std::vector<StyleLine> StyleLines;
37 typedef std::vector<StyleLines> StyleSections;
38 typedef std::vector<StyleFile> StyleFiles;
41 SCIM_ANTHY_STYLE_LINE_UNKNOWN,
42 SCIM_ANTHY_STYLE_LINE_SPACE,
43 SCIM_ANTHY_STYLE_LINE_COMMENT,
44 SCIM_ANTHY_STYLE_LINE_SECTION,
45 SCIM_ANTHY_STYLE_LINE_KEY,
51 StyleLine (StyleFile *style_file,
53 StyleLine (StyleFile *style_file,
56 StyleLine (StyleFile *style_file,
58 std::vector<String> &value);
62 StyleLineType get_type (void);
63 void get_line (String &line) { line = m_line; }
64 bool get_section (String §ion);
65 bool get_key (String &key);
66 bool get_value (String &value);
67 void set_value (String value);
68 bool get_value_array (std::vector<String> &value);
69 void set_value_array (std::vector<String> &value);
72 StyleFile *m_style_file;
84 bool load (const char *filename);
85 bool save (const char *filename);
87 String get_encoding (void);
88 String get_title (void);
89 String get_file_name (void);
91 bool get_section_list (StyleSections §ions);
92 bool get_entry_list (StyleLines &lines,
94 bool get_key_list (std::vector<String> &keys,
96 bool get_string (String &value,
99 bool get_string (WideString &value,
102 bool get_string_array (std::vector<String> &value,
105 bool get_string_array (std::vector<WideString> &value,
109 void set_string (String section,
112 void set_string (String section,
115 void set_string_array (String section,
117 std::vector<String> &value);
118 void set_string_array (String section,
120 std::vector<WideString> &value);
122 void delete_key (String section,
124 void delete_section (String section);
126 public: // for getting specific data
128 get_key2kana_table (String section);
132 void setup_default_entries (void);
134 find_section (const String §ion);
136 append_new_section (const String §ion);
142 String m_format_version;
147 StyleSections m_sections;
152 #endif /* __SCIM_ANTHY_STYLE_FILE_H__ */