1 |
|
/** |
2 |
|
Copyright 2002 Cyril Picard |
3 |
|
|
4 |
|
This file is part of the GEDCOMViewer tool |
5 |
|
(developed within the Genealogy Free Software Tools project). |
6 |
|
|
7 |
|
The GEDCOMViewer tool is free software; you can redistribute it and/or modify |
8 |
|
it under the terms of the GNU General Public License as published by |
9 |
|
the Free Software Foundation; either version 2 of the License, or |
10 |
|
(at your option) any later version. |
11 |
|
|
12 |
|
The GEDCOMViewer tool is distributed in the hope that it will be useful, |
13 |
|
but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 |
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
15 |
|
GNU General Public License for more details. |
16 |
|
|
17 |
|
You should have received a copy of the GNU General Public License |
18 |
|
along with the GEDCOMViewer tool ; if not, write to the Free Software |
19 |
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
20 |
|
|
21 |
|
**/ |
22 |
#include "BakeryGateway/Document.hh" |
#include "BakeryGateway/Document.hh" |
23 |
#include "GEDCOMParser/Parser.hh" |
#include "GEDCOMParser/Parser.hh" |
24 |
#include "GEDCOMParser/GEDCOMFactory.hh" |
#include "GEDCOMParser/GEDCOMFactory.hh" |
25 |
|
#include "GEDCOMParser/ParseErrorManagement/ParseErrorManager.hh" |
26 |
|
|
27 |
bool BakeryGateway::Document::load(void) |
bool BakeryGateway::Document::load(void) |
28 |
{ |
{ |
29 |
|
bool res; |
30 |
GEDCOMParser::GEDCOMFactory factory; |
GEDCOMParser::GEDCOMFactory factory; |
31 |
GEDCOMParser::Parser parser(&factory, this); |
GEDCOMParser::Parser parser(&factory, this); |
32 |
std::string filename = Bakery::Document::get_filepath(); |
std::string filename = Bakery::Document::get_filepath(); |
33 |
parser.Parse(filename, PARSERDEBUG); |
GEDCOMParser::ParseErrorManagement::ParseErrorManager parse_error_manager = parser.Parse(filename, PARSERDEBUG); |
34 |
textdomain (PACKAGE); |
textdomain (PACKAGE); |
35 |
if(m_pView) |
if (parse_error_manager.ErrorCount() > 0) |
36 |
m_pView->load_from_document(); |
{ |
37 |
return true; |
res = false; |
38 |
|
} |
39 |
|
else |
40 |
|
{ |
41 |
|
if(m_pView) |
42 |
|
m_pView->load_from_document(); |
43 |
|
res = true; |
44 |
|
} |
45 |
|
return res; |
46 |
} |
} |
47 |
|
|
48 |
bool BakeryGateway::Document::save(void) |
bool BakeryGateway::Document::save(void) |