Commit e4ca68e6 authored by coppro's avatar coppro

Fix warnings

Semi-fix bug #6 (does not work if the zipfile was loaded from a directory)
parent 74215961
...@@ -3444,7 +3444,7 @@ if test "${enable_debug+set}" = set; then : ...@@ -3444,7 +3444,7 @@ if test "${enable_debug+set}" = set; then :
fi fi
if test "x${enable_debug}" = "xyes"; then if test "x${enable_debug}" = "xyes"; then
DEFAULT_CXXFLAGS="-ggdb -O0 -D_GLIBCXX_DEBUG -D_GLIBCXX_DEBUG_PEDANTIC" DEFAULT_CXXFLAGS="-ggdb -O0"
WXCONFIG_FLAGS="--debug" WXCONFIG_FLAGS="--debug"
else else
DEFAULT_CXXFLAGS="-O2" DEFAULT_CXXFLAGS="-O2"
......
...@@ -21,7 +21,7 @@ AC_PROG_CXX ...@@ -21,7 +21,7 @@ AC_PROG_CXX
AC_ARG_ENABLE(debug, [--enable-debug Enable debug build (requires debug AC_ARG_ENABLE(debug, [--enable-debug Enable debug build (requires debug
versions of wxWidgets and libstdc++.]) versions of wxWidgets and libstdc++.])
if test "x${enable_debug}" = "xyes"; then if test "x${enable_debug}" = "xyes"; then
DEFAULT_CXXFLAGS="-ggdb -O0 -D_GLIBCXX_DEBUG -D_GLIBCXX_DEBUG_PEDANTIC" DEFAULT_CXXFLAGS="-ggdb -O0"
WXCONFIG_FLAGS="--debug" WXCONFIG_FLAGS="--debug"
else else
DEFAULT_CXXFLAGS="-O2" DEFAULT_CXXFLAGS="-O2"
......
...@@ -156,7 +156,7 @@ void AddPackAction::perform(bool to_undo) { ...@@ -156,7 +156,7 @@ void AddPackAction::perform(bool to_undo) {
ChangePackAction::ChangePackAction(Set& set, size_t pos, const PackTypeP& pack) ChangePackAction::ChangePackAction(Set& set, size_t pos, const PackTypeP& pack)
: PackTypesAction(set) : PackTypesAction(set)
, pos(pos), pack(pack) , pack(pack), pos(pos)
{} {}
String ChangePackAction::getName(bool to_undo) const { String ChangePackAction::getName(bool to_undo) const {
......
...@@ -15,8 +15,8 @@ ...@@ -15,8 +15,8 @@
// ----------------------------------------------------------------------------- : Export template, basics // ----------------------------------------------------------------------------- : Export template, basics
ExportTemplate::ExportTemplate() ExportTemplate::ExportTemplate()
: create_directory(false) : file_type(_("HTML files (*.html)|*.html"))
, file_type(_("HTML files (*.html)|*.html")) , create_directory(false)
{} {}
String ExportTemplate::typeNameStatic() { return _("export-template"); } String ExportTemplate::typeNameStatic() { return _("export-template"); }
......
...@@ -34,7 +34,7 @@ bool Font::update(Context& ctx) { ...@@ -34,7 +34,7 @@ bool Font::update(Context& ctx) {
| underline .update(ctx) | underline .update(ctx)
| color .update(ctx) | color .update(ctx)
| shadow_color.update(ctx); | shadow_color.update(ctx);
flags = flags & (~FONT_BOLD & ~FONT_ITALIC) flags = (flags & ~FONT_BOLD & ~FONT_ITALIC)
| (weight() == _("bold") ? FONT_BOLD : FONT_NORMAL) | (weight() == _("bold") ? FONT_BOLD : FONT_NORMAL)
| (style() == _("italic") ? FONT_ITALIC : FONT_NORMAL); | (style() == _("italic") ? FONT_ITALIC : FONT_NORMAL);
return changes; return changes;
......
...@@ -641,14 +641,14 @@ ApprenticeExportWindow::ApprenticeExportWindow(Window* parent, const SetP& set) ...@@ -641,14 +641,14 @@ ApprenticeExportWindow::ApprenticeExportWindow(Window* parent, const SetP& set)
wxSizer* s2 = new wxBoxSizer(wxHORIZONTAL); wxSizer* s2 = new wxBoxSizer(wxHORIZONTAL);
s2->Add(apprentice, 1, wxEXPAND | wxRIGHT, 4); s2->Add(apprentice, 1, wxEXPAND | wxRIGHT, 4);
s2->Add(browse, 0, wxEXPAND); s2->Add(browse, 0, wxEXPAND);
s->Add(s2, 0, wxEXPAND | wxALL & ~wxTOP, 4); s->Add(s2, 0, wxEXPAND | (wxALL & ~wxTOP), 4);
s->AddSpacer(8); s->AddSpacer(8);
// Set code // Set code
s->Add(new wxStaticText(this, -1, _LABEL_("set code")), 0, wxALL, 4); s->Add(new wxStaticText(this, -1, _LABEL_("set code")), 0, wxALL, 4);
s->Add(set_code, 0, wxEXPAND | wxLEFT | wxRIGHT, 4); s->Add(set_code, 0, wxEXPAND | wxLEFT | wxRIGHT, 4);
s->Add(new wxStaticText(this, -1, _HELP_( "set code")), 0, wxALL, 4); s->Add(new wxStaticText(this, -1, _HELP_( "set code")), 0, wxALL, 4);
s->AddSpacer(4); s->AddSpacer(4);
s->Add(CreateButtonSizer(wxOK | wxCANCEL), 0, wxEXPAND | wxALL & ~wxTOP, 8); s->Add(CreateButtonSizer(wxOK | wxCANCEL), 0, wxEXPAND | (wxALL & ~wxTOP), 8);
s->SetSizeHints(this); s->SetSizeHints(this);
SetSizer(s); SetSizer(s);
} }
......
...@@ -28,14 +28,14 @@ DECLARE_TYPEOF_NO_REV(IndexMap<FieldP COMMA ValueP>); ...@@ -28,14 +28,14 @@ DECLARE_TYPEOF_NO_REV(IndexMap<FieldP COMMA ValueP>);
// ----------------------------------------------------------------------------- : Set // ----------------------------------------------------------------------------- : Set
Set::Set() Set::Set()
: script_manager(new SetScriptManager(*this)) : vcs (new_intrusive<VCS>())
, vcs (new_intrusive<VCS>()) , script_manager(new SetScriptManager(*this))
{} {}
Set::Set(const GameP& game) Set::Set(const GameP& game)
: game(game) : game(game)
, script_manager(new SetScriptManager(*this))
, vcs (new_intrusive<VCS>()) , vcs (new_intrusive<VCS>())
, script_manager(new SetScriptManager(*this))
{ {
data.init(game->set_fields); data.init(game->set_fields);
} }
...@@ -43,8 +43,8 @@ Set::Set(const GameP& game) ...@@ -43,8 +43,8 @@ Set::Set(const GameP& game)
Set::Set(const StyleSheetP& stylesheet) Set::Set(const StyleSheetP& stylesheet)
: game(stylesheet->game) : game(stylesheet->game)
, stylesheet(stylesheet) , stylesheet(stylesheet)
, script_manager(new SetScriptManager(*this))
, vcs (new_intrusive<VCS>()) , vcs (new_intrusive<VCS>())
, script_manager(new SetScriptManager(*this))
{ {
data.init(game->set_fields); data.init(game->set_fields);
} }
...@@ -201,8 +201,11 @@ void Set::reflect_cards (Tag& tag) { ...@@ -201,8 +201,11 @@ void Set::reflect_cards (Tag& tag) {
template <> template <>
void Set::reflect_cards<Writer> (Writer& tag) { void Set::reflect_cards<Writer> (Writer& tag) {
// TODO: disable for zipfiles // When writing to a directory, we write each card in a separate file.
if (true) { // We don't do this in zipfiles because it leads to bloat.
if (isZipfile()) {
REFLECT(cards);
} else {
set<String> used; set<String> used;
FOR_EACH(card, cards) { FOR_EACH(card, cards) {
String filename = normalize_internal_filename(clean_filename(card->identification())); String filename = normalize_internal_filename(clean_filename(card->identification()));
...@@ -222,8 +225,6 @@ void Set::reflect_cards<Writer> (Writer& tag) { ...@@ -222,8 +225,6 @@ void Set::reflect_cards<Writer> (Writer& tag) {
referenceFile(full_name); referenceFile(full_name);
REFLECT_N("include file", full_name); REFLECT_N("include file", full_name);
} }
} else {
REFLECT(cards);
} }
} }
......
...@@ -75,9 +75,9 @@ GameSettings::GameSettings() ...@@ -75,9 +75,9 @@ GameSettings::GameSettings()
, images_export_filename(_("{card.name}.jpg")) , images_export_filename(_("{card.name}.jpg"))
, images_export_conflicts(CONFLICT_NUMBER_OVERWRITE) , images_export_conflicts(CONFLICT_NUMBER_OVERWRITE)
, use_auto_replace(true) , use_auto_replace(true)
, initialized(false)
, pack_seed_random(true) , pack_seed_random(true)
, pack_seed(123456) , pack_seed(123456)
, initialized(false)
{} {}
void GameSettings::initDefaults(const Game& game) { void GameSettings::initDefaults(const Game& game) {
......
...@@ -64,8 +64,8 @@ END_EVENT_TABLE () ...@@ -64,8 +64,8 @@ END_EVENT_TABLE ()
HoverButtonBase::HoverButtonBase(Window* parent, int id, bool accepts_focus) HoverButtonBase::HoverButtonBase(Window* parent, int id, bool accepts_focus)
: wxControl(parent, id, wxDefaultPosition, wxDefaultSize, wxNO_BORDER ) : wxControl(parent, id, wxDefaultPosition, wxDefaultSize, wxNO_BORDER )
, hover(false), focus(false), mouse_down(false), key_down(false)
, accepts_focus(accepts_focus) , accepts_focus(accepts_focus)
, hover(false), focus(false), mouse_down(false), key_down(false)
{} {}
void HoverButtonBase::onMouseEnter(wxMouseEvent&) { void HoverButtonBase::onMouseEnter(wxMouseEvent&) {
......
...@@ -178,12 +178,12 @@ AutoReplaceWindow::AutoReplaceWindow(Window* parent, const Game& game) ...@@ -178,12 +178,12 @@ AutoReplaceWindow::AutoReplaceWindow(Window* parent, const Game& game)
// enabled? // enabled?
s->Add(use_auto_replace, 0, wxALL & ~wxBOTTOM, 8); s->Add(use_auto_replace, 0, wxALL & ~wxBOTTOM, 8);
// list // list
s->Add(list, 1, wxEXPAND | wxALL & ~wxBOTTOM, 8); s->Add(list, 1, wxEXPAND | (wxALL & ~wxBOTTOM), 8);
s->AddSpacer(4); s->AddSpacer(4);
wxSizer* s2 = new wxBoxSizer(wxHORIZONTAL); wxSizer* s2 = new wxBoxSizer(wxHORIZONTAL);
s2->Add(add, 0, wxRIGHT, 4); s2->Add(add, 0, wxRIGHT, 4);
s2->Add(remove); s2->Add(remove);
s->Add(s2, 0, wxALIGN_RIGHT | wxALL & ~wxTOP & ~wxBOTTOM, 8); s->Add(s2, 0, wxALIGN_RIGHT | (wxALL & ~wxTOP & ~wxBOTTOM), 8);
// values // values
wxFlexGridSizer* s3 = new wxFlexGridSizer(2); wxFlexGridSizer* s3 = new wxFlexGridSizer(2);
s3->AddGrowableCol(1); s3->AddGrowableCol(1);
...@@ -191,7 +191,7 @@ AutoReplaceWindow::AutoReplaceWindow(Window* parent, const Game& game) ...@@ -191,7 +191,7 @@ AutoReplaceWindow::AutoReplaceWindow(Window* parent, const Game& game)
s3->Add(match, 1, wxEXPAND | wxBOTTOM, 2); s3->Add(match, 1, wxEXPAND | wxBOTTOM, 2);
s3->Add(replaceL, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT, 4); s3->Add(replaceL, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT, 4);
s3->Add(replace, 1, wxEXPAND | wxBOTTOM, 2); s3->Add(replace, 1, wxEXPAND | wxBOTTOM, 2);
s->Add(s3, 0, wxEXPAND | wxALL & ~wxBOTTOM, 8); s->Add(s3, 0, wxEXPAND | (wxALL & ~wxBOTTOM), 8);
s->AddSpacer(2); s->AddSpacer(2);
s->Add(whole_word, 0, wxALL & ~wxBOTTOM & ~wxTOP, 8); s->Add(whole_word, 0, wxALL & ~wxBOTTOM & ~wxTOP, 8);
s->AddSpacer(4); s->AddSpacer(4);
......
...@@ -30,8 +30,8 @@ ExportCardSelectionChoice::ExportCardSelectionChoice(const Set& set) ...@@ -30,8 +30,8 @@ ExportCardSelectionChoice::ExportCardSelectionChoice(const Set& set)
ExportCardSelectionChoice::ExportCardSelectionChoice(const String& label, const vector<CardP>& cards) ExportCardSelectionChoice::ExportCardSelectionChoice(const String& label, const vector<CardP>& cards)
: label(label) : label(label)
, type(EXPORT_SEL_SUBSET) , type(EXPORT_SEL_SUBSET)
, own_cards(cards)
, the_cards(&own_cards) , the_cards(&own_cards)
, own_cards(cards)
{} {}
ExportCardSelectionChoice::ExportCardSelectionChoice(const String& label, const vector<CardP>* cards) ExportCardSelectionChoice::ExportCardSelectionChoice(const String& label, const vector<CardP>* cards)
: label(label) : label(label)
...@@ -142,7 +142,7 @@ CardSelectWindow::CardSelectWindow(Window* parent, const SetP& set, const String ...@@ -142,7 +142,7 @@ CardSelectWindow::CardSelectWindow(Window* parent, const SetP& set, const String
s2->Add(sel_all, 0, wxEXPAND | wxRIGHT, 8); s2->Add(sel_all, 0, wxEXPAND | wxRIGHT, 8);
s2->Add(sel_none, 0, wxEXPAND | wxRIGHT, 8); s2->Add(sel_none, 0, wxEXPAND | wxRIGHT, 8);
s2->Add(CreateButtonSizer(wxOK | wxCANCEL), 1, wxEXPAND, 8); s2->Add(CreateButtonSizer(wxOK | wxCANCEL), 1, wxEXPAND, 8);
s->Add(s2, 0, wxEXPAND | wxALL & ~wxTOP, 8); s->Add(s2, 0, wxEXPAND | (wxALL & ~wxTOP), 8);
s->SetSizeHints(this); s->SetSizeHints(this);
SetSizer(s); SetSizer(s);
SetSize(600,500); SetSize(600,500);
......
...@@ -103,7 +103,7 @@ void CardListBase::onAction(const Action& action, bool undone) { ...@@ -103,7 +103,7 @@ void CardListBase::onAction(const Action& action, bool undone) {
} }
TYPE_CASE(action, ReorderCardsAction) { TYPE_CASE(action, ReorderCardsAction) {
if (sort_by_column >= 0) return; // nothing changes for us if (sort_by_column >= 0) return; // nothing changes for us
if ((long)action.card_id1 < 0 || (long)action.card_id2 >= sorted_list.size()) return; if ((long)action.card_id1 < 0 || (long)action.card_id2 >= (long)sorted_list.size()) return;
if ((long)action.card_id1 == selected_item_pos || (long)action.card_id2 == selected_item_pos) { if ((long)action.card_id1 == selected_item_pos || (long)action.card_id2 == selected_item_pos) {
// Selected card has moved; also move in the sorted card list // Selected card has moved; also move in the sorted card list
swap(sorted_list[action.card_id1], sorted_list[action.card_id2]); swap(sorted_list[action.card_id1], sorted_list[action.card_id2]);
......
...@@ -34,7 +34,7 @@ CardListColumnSelectDialog::CardListColumnSelectDialog(Window* parent, const Gam ...@@ -34,7 +34,7 @@ CardListColumnSelectDialog::CardListColumnSelectDialog(Window* parent, const Gam
s3->Add(new wxButton(this, ID_MOVE_DOWN, _BUTTON_("move down")), 0, wxEXPAND | wxTOP, 2); s3->Add(new wxButton(this, ID_MOVE_DOWN, _BUTTON_("move down")), 0, wxEXPAND | wxTOP, 2);
s3->Add(new wxButton(this, ID_SHOW, _BUTTON_("show")), 0, wxEXPAND | wxTOP, 2); s3->Add(new wxButton(this, ID_SHOW, _BUTTON_("show")), 0, wxEXPAND | wxTOP, 2);
s3->Add(new wxButton(this, ID_HIDE, _BUTTON_("hide")), 0, wxEXPAND | wxTOP, 2); s3->Add(new wxButton(this, ID_HIDE, _BUTTON_("hide")), 0, wxEXPAND | wxTOP, 2);
s2->Add(s3, 0, wxEXPAND | wxALL & ~wxTOP, 4); s2->Add(s3, 0, wxEXPAND | (wxALL & ~wxTOP), 4);
s->Add(s2 , 1, wxEXPAND | wxALL, 4); s->Add(s2 , 1, wxEXPAND | wxALL, 4);
s->Add(CreateButtonSizer(wxOK | wxCANCEL) , 0, wxEXPAND | wxALL, 8); s->Add(CreateButtonSizer(wxOK | wxCANCEL) , 0, wxEXPAND | wxALL, 8);
s->SetSizeHints(this); s->SetSizeHints(this);
......
...@@ -237,7 +237,7 @@ void GraphData::crossAxis(size_t axis1, size_t axis2, size_t axis3, vector<UInt> ...@@ -237,7 +237,7 @@ void GraphData::crossAxis(size_t axis1, size_t axis2, size_t axis3, vector<UInt>
bool matches(const GraphDataElement* v, const vector<int>& match) { bool matches(const GraphDataElement* v, const vector<int>& match) {
for (size_t i = 0 ; i < match.size() ; ++i) { for (size_t i = 0 ; i < match.size() ; ++i) {
if (v->group_nrs[i] == -1 || match[i] != -1 && v->group_nrs[i] != match[i]) { if (v->group_nrs[i] == -1 || (match[i] != -1 && v->group_nrs[i] != match[i])) {
return false; return false;
} }
} }
......
...@@ -36,7 +36,7 @@ HtmlExportWindow::HtmlExportWindow(Window* parent, const SetP& set, const Export ...@@ -36,7 +36,7 @@ HtmlExportWindow::HtmlExportWindow(Window* parent, const SetP& set, const Export
// init sizers // init sizers
wxSizer* s = new wxBoxSizer(wxVERTICAL); wxSizer* s = new wxBoxSizer(wxVERTICAL);
s->Add(new wxStaticText(this, wxID_ANY, _LABEL_("html template")), 0, wxALL, 4); s->Add(new wxStaticText(this, wxID_ANY, _LABEL_("html template")), 0, wxALL, 4);
s->Add(list, 0, wxEXPAND | wxALL & ~wxTOP, 4); s->Add(list, 0, wxEXPAND | (wxALL & ~wxTOP), 4);
wxSizer* s2 = new wxBoxSizer(wxHORIZONTAL); wxSizer* s2 = new wxBoxSizer(wxHORIZONTAL);
s2->Add(ExportWindowBase::Create(), 2, wxEXPAND); s2->Add(ExportWindowBase::Create(), 2, wxEXPAND);
wxSizer* s3 = new wxStaticBoxSizer(wxVERTICAL, this, _LABEL_("html export options")); wxSizer* s3 = new wxStaticBoxSizer(wxVERTICAL, this, _LABEL_("html export options"));
......
...@@ -145,7 +145,7 @@ ImageSliceWindow::ImageSliceWindow(Window* parent, const Image& source, const wx ...@@ -145,7 +145,7 @@ ImageSliceWindow::ImageSliceWindow(Window* parent, const Image& source, const wx
s5->Add(s6, 0, wxEXPAND | wxALL, 4); s5->Add(s6, 0, wxEXPAND | wxALL, 4);
s5->AddStretchSpacer(1); s5->AddStretchSpacer(1);
wxSizer* s8 = zoom_sizer = new wxStaticBoxSizer(wxVERTICAL, this, _LABEL_("zoom")); wxSizer* s8 = zoom_sizer = new wxStaticBoxSizer(wxVERTICAL, this, _LABEL_("zoom"));
s8->Add(fix_aspect, 0, wxEXPAND | wxALL & ~wxBOTTOM, 4); s8->Add(fix_aspect, 0, wxEXPAND | (wxALL & ~wxBOTTOM), 4);
wxSizer* s9 = zoom_fixed = new wxFlexGridSizer(0, 3, 4, 5); wxSizer* s9 = zoom_fixed = new wxFlexGridSizer(0, 3, 4, 5);
s9->Add(new wxStaticText(this, wxID_ANY, _LABEL_("zoom amount")), 0, wxALIGN_CENTER_VERTICAL); s9->Add(new wxStaticText(this, wxID_ANY, _LABEL_("zoom amount")), 0, wxALIGN_CENTER_VERTICAL);
s9->Add(zoom, 0, wxEXPAND); s9->Add(zoom, 0, wxEXPAND);
...@@ -162,7 +162,7 @@ ImageSliceWindow::ImageSliceWindow(Window* parent, const Image& source, const wx ...@@ -162,7 +162,7 @@ ImageSliceWindow::ImageSliceWindow(Window* parent, const Image& source, const wx
s5->Add(s8, 0, wxEXPAND | wxALL, 4); s5->Add(s8, 0, wxEXPAND | wxALL, 4);
s5->AddStretchSpacer(1); s5->AddStretchSpacer(1);
wxSizer* sB = new wxStaticBoxSizer(wxVERTICAL, this, _LABEL_("filter")); wxSizer* sB = new wxStaticBoxSizer(wxVERTICAL, this, _LABEL_("filter"));
sB->Add(sharpen, 0, wxEXPAND | wxALL & ~wxBOTTOM, 4); sB->Add(sharpen, 0, wxEXPAND | (wxALL & ~wxBOTTOM), 4);
sB->Add(sharpen_amount, 0, wxEXPAND | wxALL, 4); sB->Add(sharpen_amount, 0, wxEXPAND | wxALL, 4);
s5->Add(sB, 0, wxEXPAND | wxALL, 4); s5->Add(sB, 0, wxEXPAND | wxALL, 4);
s5->AddStretchSpacer(1); s5->AddStretchSpacer(1);
......
...@@ -37,14 +37,14 @@ ImagesExportWindow::ImagesExportWindow(Window* parent, const SetP& set, const Ex ...@@ -37,14 +37,14 @@ ImagesExportWindow::ImagesExportWindow(Window* parent, const SetP& set, const Ex
wxSizer* s = new wxBoxSizer(wxVERTICAL); wxSizer* s = new wxBoxSizer(wxVERTICAL);
wxSizer* s2 = new wxStaticBoxSizer(wxVERTICAL, this, _LABEL_("export filenames")); wxSizer* s2 = new wxStaticBoxSizer(wxVERTICAL, this, _LABEL_("export filenames"));
s2->Add(new wxStaticText(this, -1, _LABEL_("filename format")), 0, wxALL, 4); s2->Add(new wxStaticText(this, -1, _LABEL_("filename format")), 0, wxALL, 4);
s2->Add(format, 0, wxEXPAND | wxALL & ~wxTOP, 4); s2->Add(format, 0, wxEXPAND | (wxALL & ~wxTOP), 4);
s2->Add(new wxStaticText(this, -1, _HELP_("filename format")), 0, wxALL & ~wxTOP, 4); s2->Add(new wxStaticText(this, -1, _HELP_("filename format")), 0, wxALL & ~wxTOP, 4);
s2->Add(new wxStaticText(this, -1, _LABEL_("filename conflicts")), 0, wxALL, 4); s2->Add(new wxStaticText(this, -1, _LABEL_("filename conflicts")), 0, wxALL, 4);
s2->Add(conflicts, 0, wxEXPAND | wxALL & ~wxTOP, 4); s2->Add(conflicts, 0, wxEXPAND | (wxALL & ~wxTOP), 4);
s->Add(s2, 0, wxEXPAND | wxALL, 8); s->Add(s2, 0, wxEXPAND | wxALL, 8);
wxSizer* s3 = ExportWindowBase::Create(); wxSizer* s3 = ExportWindowBase::Create();
s->Add(s3, 1, wxEXPAND | wxALL & ~wxTOP, 8); s->Add(s3, 1, wxEXPAND | (wxALL & ~wxTOP), 8);
s->Add(CreateButtonSizer(wxOK | wxCANCEL), 0, wxEXPAND | wxALL & ~wxTOP, 8); s->Add(CreateButtonSizer(wxOK | wxCANCEL), 0, wxEXPAND | (wxALL & ~wxTOP), 8);
s->SetSizeHints(this); s->SetSizeHints(this);
SetSizer(s); SetSizer(s);
SetSize(500,-1); SetSize(500,-1);
......
...@@ -37,9 +37,9 @@ NewSetWindow::NewSetWindow(Window* parent) ...@@ -37,9 +37,9 @@ NewSetWindow::NewSetWindow(Window* parent)
// init sizer // init sizer
wxSizer* s = new wxBoxSizer(wxVERTICAL); wxSizer* s = new wxBoxSizer(wxVERTICAL);
s->Add(game_text, 0, wxALL, 4); s->Add(game_text, 0, wxALL, 4);
s->Add(game_list, 0, wxEXPAND | wxALL & ~wxTOP, 4); s->Add(game_list, 0, wxEXPAND | (wxALL & ~wxTOP), 4);
s->Add(stylesheet_text, 0, wxALL, 4); s->Add(stylesheet_text, 0, wxALL, 4);
s->Add(stylesheet_list, 0, wxEXPAND | wxALL & ~wxTOP, 4); s->Add(stylesheet_list, 0, wxEXPAND | (wxALL & ~wxTOP), 4);
s->Add(CreateButtonSizer(wxOK | wxCANCEL) , 0, wxEXPAND | wxALL, 8); s->Add(CreateButtonSizer(wxOK | wxCANCEL) , 0, wxEXPAND | wxALL, 8);
s->SetSizeHints(this); s->SetSizeHints(this);
SetSizer(s); SetSizer(s);
...@@ -147,7 +147,7 @@ SelectStyleSheetWindow::SelectStyleSheetWindow(Window* parent, const Game& game, ...@@ -147,7 +147,7 @@ SelectStyleSheetWindow::SelectStyleSheetWindow(Window* parent, const Game& game,
wxSizer* s = new wxBoxSizer(wxVERTICAL); wxSizer* s = new wxBoxSizer(wxVERTICAL);
s->Add(description, 0, wxALL, 4); s->Add(description, 0, wxALL, 4);
s->Add(stylesheet_text, 0, wxALL, 4); s->Add(stylesheet_text, 0, wxALL, 4);
s->Add(stylesheet_list, 0, wxEXPAND | wxALL & ~wxTOP, 4); s->Add(stylesheet_list, 0, wxEXPAND | (wxALL & ~wxTOP), 4);
s->Add(CreateButtonSizer(wxOK | wxCANCEL) , 0, wxEXPAND | wxALL, 8); s->Add(CreateButtonSizer(wxOK | wxCANCEL) , 0, wxEXPAND | wxALL, 8);
s->SetSizeHints(this); s->SetSizeHints(this);
SetSizer(s); SetSizer(s);
......
...@@ -192,8 +192,8 @@ class PackageIconRequest : public ThumbnailRequest { ...@@ -192,8 +192,8 @@ class PackageIconRequest : public ThumbnailRequest {
PackageUpdateList::PackageUpdateList(Window* parent, const InstallablePackages& packages, bool show_only_installable, int id) PackageUpdateList::PackageUpdateList(Window* parent, const InstallablePackages& packages, bool show_only_installable, int id)
: TreeList(parent, id) : TreeList(parent, id)
, show_only_installable(show_only_installable)
, packages(packages) , packages(packages)
, show_only_installable(show_only_installable)
{ {
item_height = max(item_height,19); item_height = max(item_height,19);
rebuild(); rebuild();
......
...@@ -255,7 +255,7 @@ void PackagesWindow::init(Window* parent, bool show_only_installable) { ...@@ -255,7 +255,7 @@ void PackagesWindow::init(Window* parent, bool show_only_installable) {
// Init sizer // Init sizer
wxBoxSizer* v = new wxBoxSizer(wxVERTICAL); wxBoxSizer* v = new wxBoxSizer(wxVERTICAL);
v->Add(package_list, 1, wxEXPAND | wxALL & ~wxBOTTOM, 8); v->Add(package_list, 1, wxEXPAND | (wxALL & ~wxBOTTOM), 8);
v->AddSpacer(4); v->AddSpacer(4);
wxBoxSizer* h = new wxBoxSizer(wxHORIZONTAL); wxBoxSizer* h = new wxBoxSizer(wxHORIZONTAL);
h->Add(package_info, 1, wxRIGHT, 4); h->Add(package_info, 1, wxRIGHT, 4);
...@@ -266,8 +266,8 @@ void PackagesWindow::init(Window* parent, bool show_only_installable) { ...@@ -266,8 +266,8 @@ void PackagesWindow::init(Window* parent, bool show_only_installable) {
v2->AddStretchSpacer(); v2->AddStretchSpacer();
v2->Add(remove_button, 0, wxEXPAND | wxBOTTOM, 0); v2->Add(remove_button, 0, wxEXPAND | wxBOTTOM, 0);
h->Add(v2); h->Add(v2);
v->Add(h, 0, wxEXPAND | wxALL & ~wxTOP, 8); v->Add(h, 0, wxEXPAND | (wxALL & ~wxTOP), 8);
v->Add(CreateButtonSizer(wxOK | wxCANCEL), 0, wxEXPAND | wxALL & ~wxTOP, 8); v->Add(CreateButtonSizer(wxOK | wxCANCEL), 0, wxEXPAND | (wxALL & ~wxTOP), 8);
SetSizer(v); SetSizer(v);
wxUpdateUIEvent::SetMode(wxUPDATE_UI_PROCESS_SPECIFIED); wxUpdateUIEvent::SetMode(wxUPDATE_UI_PROCESS_SPECIFIED);
......
...@@ -116,9 +116,9 @@ PreferencesWindow::PreferencesWindow(Window* parent) ...@@ -116,9 +116,9 @@ PreferencesWindow::PreferencesWindow(Window* parent)
// init sizer // init sizer
wxSizer* s = new wxBoxSizer(wxVERTICAL); wxSizer* s = new wxBoxSizer(wxVERTICAL);
s->Add(nb, 1, wxEXPAND | wxALL & ~wxBOTTOM, 8); s->Add(nb, 1, wxEXPAND | (wxALL & ~wxBOTTOM), 8);
s->AddSpacer(4); s->AddSpacer(4);
s->Add(CreateButtonSizer(wxOK | wxCANCEL), 0, wxEXPAND | wxALL & ~wxTOP, 8); s->Add(CreateButtonSizer(wxOK | wxCANCEL), 0, wxEXPAND | (wxALL & ~wxTOP), 8);
s->SetSizeHints(this); s->SetSizeHints(this);
SetSizer(s); SetSizer(s);
} }
...@@ -168,13 +168,13 @@ GlobalPreferencesPage::GlobalPreferencesPage(Window* parent) ...@@ -168,13 +168,13 @@ GlobalPreferencesPage::GlobalPreferencesPage(Window* parent)
wxSizer* s = new wxBoxSizer(wxVERTICAL); wxSizer* s = new wxBoxSizer(wxVERTICAL);
s->SetSizeHints(this); s->SetSizeHints(this);
wxSizer* s2 = new wxStaticBoxSizer(wxVERTICAL, this, _LABEL_("language")); wxSizer* s2 = new wxStaticBoxSizer(wxVERTICAL, this, _LABEL_("language"));
s2->Add(new wxStaticText(this, wxID_ANY, _LABEL_("app language")), 0, wxALL, 4); s2->Add(new wxStaticText(this, wxID_ANY, _LABEL_("app language")), 0, wxALL, 4);
s2->Add(language, 0, wxEXPAND | wxALL & ~wxTOP, 4); s2->Add(language, 0, wxEXPAND | (wxALL & ~wxTOP), 4);
s2->Add(new wxStaticText(this, wxID_ANY, _HELP_( "app language")), 0, wxALL, 4); s2->Add(new wxStaticText(this, wxID_ANY, _HELP_( "app language")), 0, wxALL, 4);
s->Add(s2, 0, wxALL | wxEXPAND, 8); s->Add(s2, 0, wxEXPAND | wxALL, 8);
wxSizer* s3 = new wxStaticBoxSizer(wxVERTICAL, this, _LABEL_("windows")); wxSizer* s3 = new wxStaticBoxSizer(wxVERTICAL, this, _LABEL_("windows"));
s3->Add(open_sets_in_new_window, 0, wxALL, 4); s3->Add(open_sets_in_new_window, 0, wxALL, 4);
s->Add(s3, 0, wxALL & ~wxTOP | wxEXPAND, 8); s->Add(s3, 0, wxEXPAND | (wxALL & ~wxTOP), 8);
SetSizer(s); SetSizer(s);
} }
...@@ -216,7 +216,7 @@ DisplayPreferencesPage::DisplayPreferencesPage(Window* parent) ...@@ -216,7 +216,7 @@ DisplayPreferencesPage::DisplayPreferencesPage(Window* parent)
zoom_int = static_cast<int>(settings.default_stylesheet_settings.card_zoom() * 100); zoom_int = static_cast<int>(settings.default_stylesheet_settings.card_zoom() * 100);
zoom->SetValue(String::Format(_("%d%%"),zoom_int)); zoom->SetValue(String::Format(_("%d%%"),zoom_int));
int choices[] = {50,66,75,100,120,150,200}; int choices[] = {50,66,75,100,120,150,200};
for (int i = 0 ; i < sizeof(choices)/sizeof(choices[0]) ; ++i) { for (unsigned int i = 0 ; i < sizeof(choices)/sizeof(choices[0]) ; ++i) {
zoom->Append(String::Format(_("%d%%"),choices[i])); zoom->Append(String::Format(_("%d%%"),choices[i]));
} }
#else #else
...@@ -309,7 +309,7 @@ DirsPreferencesPage::DirsPreferencesPage(Window* parent) ...@@ -309,7 +309,7 @@ DirsPreferencesPage::DirsPreferencesPage(Window* parent)
wxSizer* s3 = new wxBoxSizer(wxHORIZONTAL); wxSizer* s3 = new wxBoxSizer(wxHORIZONTAL);
s3->Add(apprentice, 1, wxEXPAND | wxRIGHT, 4); s3->Add(apprentice, 1, wxEXPAND | wxRIGHT, 4);
s3->Add(ab, 0, wxEXPAND); s3->Add(ab, 0, wxEXPAND);
s2->Add(s3, 0, wxEXPAND | wxALL & ~wxTOP, 4); s2->Add(s3, 0, wxEXPAND | (wxALL & ~wxTOP), 4);
s->Add(s2, 0, wxEXPAND | wxALL, 8); s->Add(s2, 0, wxEXPAND | wxALL, 8);
s->SetSizeHints(this); s->SetSizeHints(this);
SetSizer(s); SetSizer(s);
......
...@@ -58,7 +58,7 @@ void KeywordsPanel::initControls() { ...@@ -58,7 +58,7 @@ void KeywordsPanel::initControls() {
s0->Add(fixedI, 0, wxALIGN_CENTER | wxRIGHT, 10); s0->Add(fixedI, 0, wxALIGN_CENTER | wxRIGHT, 10);
s0->Add(fixedL, 0, wxALIGN_CENTER_VERTICAL); s0->Add(fixedL, 0, wxALIGN_CENTER_VERTICAL);
fixed->Add(new wxStaticLine(panel), 0, wxEXPAND | wxBOTTOM, 8); fixed->Add(new wxStaticLine(panel), 0, wxEXPAND | wxBOTTOM, 8);
fixed->Add(s0, 0, wxALL & ~wxTOP | wxALIGN_CENTER, 8); fixed->Add(s0, 0, (wxALL & ~wxTOP) | wxALIGN_CENTER, 8);
fixed->Add(new wxStaticLine(panel), 0, wxEXPAND | wxBOTTOM, 8); fixed->Add(new wxStaticLine(panel), 0, wxEXPAND | wxBOTTOM, 8);
// init sizer for panel // init sizer for panel
sp = new wxBoxSizer(wxVERTICAL); sp = new wxBoxSizer(wxVERTICAL);
......
...@@ -337,12 +337,12 @@ CustomPackDialog::CustomPackDialog(Window* parent, const SetP& set, const PackTy ...@@ -337,12 +337,12 @@ CustomPackDialog::CustomPackDialog(Window* parent, const SetP& set, const PackTy
s4->AddSpacer(2); s4->AddSpacer(2);
wxFlexGridSizer* packsSizer = new wxFlexGridSizer(0, 2, 4, 4); wxFlexGridSizer* packsSizer = new wxFlexGridSizer(0, 2, 4, 4);
packsSizer->AddGrowableCol(0); packsSizer->AddGrowableCol(0);
s4->Add(packsSizer, 1, wxEXPAND | wxALL & ~wxTOP & ~wxLEFT, 4); s4->Add(packsSizer, 1, wxEXPAND | (wxALL & ~wxTOP & ~wxLEFT), 4);
s3->Add(s4, 1, wxEXPAND, 8); s3->Add(s4, 1, wxEXPAND, 8);
wxSizer* s5 = new wxStaticBoxSizer(wxHORIZONTAL, this, _LABEL_("pack totals")); wxSizer* s5 = new wxStaticBoxSizer(wxHORIZONTAL, this, _LABEL_("pack totals"));
s5->Add(totals, 1, wxEXPAND | wxALL, 4); s5->Add(totals, 1, wxEXPAND | wxALL, 4);
s3->Add(s5, 1, wxEXPAND | wxLEFT, 8); s3->Add(s5, 1, wxEXPAND | wxLEFT, 8);
s->Add(s3, 0, wxEXPAND | wxALL & ~wxTOP, 8); s->Add(s3, 0, wxEXPAND | (wxALL & ~wxTOP), 8);
wxSizer* s6 = new wxBoxSizer(wxHORIZONTAL); wxSizer* s6 = new wxBoxSizer(wxHORIZONTAL);
if (can_remove) { if (can_remove) {
s6->Add(remove, 0, wxALL & ~wxTOP & ~wxRIGHT, 8); s6->Add(remove, 0, wxALL & ~wxTOP & ~wxRIGHT, 8);
...@@ -467,9 +467,9 @@ void RandomPackPanel::initControls() { ...@@ -467,9 +467,9 @@ void RandomPackPanel::initControls() {
wxSizer* s4b = new wxBoxSizer(wxHORIZONTAL); wxSizer* s4b = new wxBoxSizer(wxHORIZONTAL);
packsSizer = new wxFlexGridSizer(0, 2, 4, 4); packsSizer = new wxFlexGridSizer(0, 2, 4, 4);
packsSizer->AddGrowableCol(0); packsSizer->AddGrowableCol(0);
s4b->Add(packsSizer, 1, wxEXPAND | wxALL & ~wxTOP & ~wxLEFT, 4); s4b->Add(packsSizer, 1, wxEXPAND | (wxALL & ~wxTOP & ~wxLEFT), 4);
s4->Add(s4b, 1, wxEXPAND | wxLEFT, 2); s4->Add(s4b, 1, wxEXPAND | wxLEFT, 2);
s4->Add(new wxButton(this, ID_CUSTOM_PACK, _BUTTON_("add custom pack")), 0, wxEXPAND | wxALIGN_TOP | wxALL & ~wxTOP, 4); s4->Add(new wxButton(this, ID_CUSTOM_PACK, _BUTTON_("add custom pack")), 0, wxEXPAND | wxALIGN_TOP | (wxALL & ~wxTOP), 4);
s3->Add(s4, 1, wxEXPAND, 8); s3->Add(s4, 1, wxEXPAND, 8);
wxSizer* s5 = new wxStaticBoxSizer(wxHORIZONTAL, this, _LABEL_("pack totals")); wxSizer* s5 = new wxStaticBoxSizer(wxHORIZONTAL, this, _LABEL_("pack totals"));
s5->Add(totals, 1, wxEXPAND | wxALL, 4); s5->Add(totals, 1, wxEXPAND | wxALL, 4);
...@@ -486,7 +486,7 @@ void RandomPackPanel::initControls() { ...@@ -486,7 +486,7 @@ void RandomPackPanel::initControls() {
//s6->Add(generate_button, 0, wxTOP | wxALIGN_RIGHT, 8); //s6->Add(generate_button, 0, wxTOP | wxALIGN_RIGHT, 8);
s6->Add(generate_button, 1, wxTOP | wxEXPAND, 8); s6->Add(generate_button, 1, wxTOP | wxEXPAND, 8);
s3->Add(s6, 0, wxEXPAND | wxLEFT, 8); s3->Add(s6, 0, wxEXPAND | wxLEFT, 8);
s2->Add(s3, 0, wxEXPAND | wxALL & ~wxTOP, 4); s2->Add(s3, 0, wxEXPAND | (wxALL & ~wxTOP), 4);
s2->Add(card_list, 1, wxEXPAND); s2->Add(card_list, 1, wxEXPAND);
s->Add(s2, 1, wxEXPAND, 8); s->Add(s2, 1, wxEXPAND, 8);
s->SetSizeHints(this); s->SetSizeHints(this);
......
...@@ -109,9 +109,9 @@ class StatDimensionList : public GalleryList { ...@@ -109,9 +109,9 @@ class StatDimensionList : public GalleryList {
public: public:
StatDimensionList(Window* parent, int id, bool show_empty, int dimension_count = 3) StatDimensionList(Window* parent, int id, bool show_empty, int dimension_count = 3)
: GalleryList(parent, id, wxVERTICAL, false) : GalleryList(parent, id, wxVERTICAL, false)
, show_empty(show_empty)
, dimension_count(dimension_count) , dimension_count(dimension_count)
, prefered_dimension_count(dimension_count) , prefered_dimension_count(dimension_count)
, show_empty(show_empty)
{ {
//item_size = wxSize(150, 23); //item_size = wxSize(150, 23);
subcolumns[0].size = wxSize(140,23); subcolumns[0].size = wxSize(140,23);
......
...@@ -190,7 +190,7 @@ void show_update_dialog(Window* parent) { ...@@ -190,7 +190,7 @@ void show_update_dialog(Window* parent) {
// layout // layout
wxSizer* s = new wxBoxSizer(wxVERTICAL); wxSizer* s = new wxBoxSizer(wxVERTICAL);
s->Add(html, 1, wxEXPAND | wxALL, 8); s->Add(html, 1, wxEXPAND | wxALL, 8);
s->Add(close, 0, wxALIGN_RIGHT | wxALL & ~wxTOP, 8); s->Add(close, 0, wxALIGN_RIGHT | (wxALL & ~wxTOP), 8);
dlg->SetSizer(s); dlg->SetSizer(s);
dlg->SetSize(400,400); dlg->SetSize(400,400);
dlg->Show(); dlg->Show();
......
...@@ -111,7 +111,7 @@ struct DropDownWordListItem { ...@@ -111,7 +111,7 @@ struct DropDownWordListItem {
DropDownListP submenu; DropDownListP submenu;
inline bool active() const { return flags & FLAG_ACTIVE; } inline bool active() const { return flags & FLAG_ACTIVE; }
inline void setActive(bool a) { flags = flags & ~FLAG_ACTIVE | a * FLAG_ACTIVE; } inline void setActive(bool a) { flags = (flags & ~FLAG_ACTIVE) | a * FLAG_ACTIVE; }
}; };
class DropDownWordList : public DropDownList { class DropDownWordList : public DropDownList {
......
...@@ -211,7 +211,7 @@ int MSE::OnRun() { ...@@ -211,7 +211,7 @@ int MSE::OnRun() {
CLISetInterface cli_interface(set,quiet); CLISetInterface cli_interface(set,quiet);
return EXIT_SUCCESS; return EXIT_SUCCESS;
} else if (arg == _("--export")) { } else if (arg == _("--export")) {
if (argc <= 2 || argc <= 3 && starts_with(argv[2],_("--"))) { if (argc <= 2 || (argc <= 3 && starts_with(argv[2],_("--")))) {
handle_error(Error(_("No input file specified for --export"))); handle_error(Error(_("No input file specified for --export")));
return EXIT_FAILURE; return EXIT_FAILURE;
} }
......
...@@ -515,6 +515,8 @@ void instrBinary (BinaryInstructionType i, ScriptValueP& a, const ScriptValueP& ...@@ -515,6 +515,8 @@ void instrBinary (BinaryInstructionType i, ScriptValueP& a, const ScriptValueP&
case I_OR_ELSE: case I_OR_ELSE:
if (at == SCRIPT_ERROR) a = b; if (at == SCRIPT_ERROR) a = b;
break; break;
case I_ITERATOR_R: case I_MEMBER:
throw InternalError(_("ITERATOR_R/MEMBER instruction fell through!"));
}} }}
} }
......
...@@ -33,12 +33,12 @@ ...@@ -33,12 +33,12 @@
template <typename Key, typename Value> template <typename Key, typename Value>
class IndexMap : private vector<Value> { class IndexMap : private vector<Value> {
public: public:
using typename vector<Value>::iterator;
using typename vector<Value>::const_iterator;
using typename vector<Value>::reference;
using typename vector<Value>::const_reference;
using vector<Value>::empty; using vector<Value>::empty;
using vector<Value>::size; using vector<Value>::size;
using vector<Value>::iterator;
using vector<Value>::const_iterator;
using vector<Value>::reference;
using vector<Value>::const_reference;
using vector<Value>::begin; using vector<Value>::begin;
using vector<Value>::end; using vector<Value>::end;
using vector<Value>::clear; using vector<Value>::clear;
......
...@@ -340,6 +340,7 @@ void Package::loadZipStream() { ...@@ -340,6 +340,7 @@ void Package::loadZipStream() {
} }
void Package::openDirectory() { void Package::openDirectory() {
zipfile = false;
openSubdir(wxEmptyString); openSubdir(wxEmptyString);
} }
...@@ -367,6 +368,7 @@ void Package::openSubdir(const String& name) { ...@@ -367,6 +368,7 @@ void Package::openSubdir(const String& name) {
} }
void Package::openZipfile() { void Package::openZipfile() {
zipfile = true;
// close old streams // close old streams
delete fileStream; fileStream = nullptr; delete fileStream; fileStream = nullptr;
delete zipStream; zipStream = nullptr; delete zipStream; zipStream = nullptr;
...@@ -380,6 +382,7 @@ void Package::openZipfile() { ...@@ -380,6 +382,7 @@ void Package::openZipfile() {
} }
void Package::saveToDirectory(const String& saveAs, bool remove_unused, bool is_copy) { void Package::saveToDirectory(const String& saveAs, bool remove_unused, bool is_copy) {
zipfile = false;
// write to a directory // write to a directory
VCSP vcs = getVCS(); VCSP vcs = getVCS();
FOR_EACH(f, files) { FOR_EACH(f, files) {
...@@ -411,6 +414,7 @@ void Package::saveToDirectory(const String& saveAs, bool remove_unused, bool is_ ...@@ -411,6 +414,7 @@ void Package::saveToDirectory(const String& saveAs, bool remove_unused, bool is_
} }
void Package::saveToZipfile(const String& saveAs, bool remove_unused, bool is_copy) { void Package::saveToZipfile(const String& saveAs, bool remove_unused, bool is_copy) {
zipfile = true;
// create a temporary zip file name // create a temporary zip file name
String tempFile = saveAs + _(".tmp"); String tempFile = saveAs + _(".tmp");
wxRemoveFile(tempFile); wxRemoveFile(tempFile);
......
...@@ -121,14 +121,8 @@ class Package : public IntrusivePtrVirtualBase { ...@@ -121,14 +121,8 @@ class Package : public IntrusivePtrVirtualBase {
// --------------------------------------------------- : Managing the inside of the package : Reader/writer // --------------------------------------------------- : Managing the inside of the package : Reader/writer
template <typename T> template <typename T>
void readFile(const String& file, T& obj) { void readFile(const String& file, T& obj);
Reader reader(openIn(file), dynamic_cast<Packaged*>(this), absoluteFilename() + _("/") + file);
try {
reader.handle_greedy(obj);
} catch (const ParseError& err) {
throw FileParseError(err.what(), absoluteFilename() + _("/") + file); // more detailed message
}
}
template <typename T> template <typename T>
T readFile(const String& file) { T readFile(const String& file) {
T obj; T obj;
...@@ -146,6 +140,9 @@ class Package : public IntrusivePtrVirtualBase { ...@@ -146,6 +140,9 @@ class Package : public IntrusivePtrVirtualBase {
// TODO: I dislike putting this here very much. There ought to be a better way. // TODO: I dislike putting this here very much. There ought to be a better way.
virtual VCSP getVCS() { return new_intrusive<VCS>(); } virtual VCSP getVCS() { return new_intrusive<VCS>(); }
/// true if this is a zip file, false if a directory (updated on open/save)
bool isZipfile() { return zipfile; }
// --------------------------------------------------- : Private stuff // --------------------------------------------------- : Private stuff
private: private:
...@@ -165,6 +162,10 @@ class Package : public IntrusivePtrVirtualBase { ...@@ -165,6 +162,10 @@ class Package : public IntrusivePtrVirtualBase {
String filename; String filename;
/// Last modified time /// Last modified time
DateTime modified; DateTime modified;
/// Zipfile flag
bool zipfile;
public: public:
/// Information on files in the package /// Information on files in the package
/** Note: must be public for DECLARE_TYPEOF to work */ /** Note: must be public for DECLARE_TYPEOF to work */
...@@ -278,5 +279,19 @@ intrusive_ptr<T> open_package(const String& filename) { ...@@ -278,5 +279,19 @@ intrusive_ptr<T> open_package(const String& filename) {
return package; return package;
} }
// ----------------------------------------------------------------------------- : readFile definition
// This is here because it uses dynamic_cast and must be to a complete type.
template <typename T>
inline void Package::readFile(const String& file, T& obj)
{
Reader reader(openIn(file), dynamic_cast<Packaged*>(this), absoluteFilename() + _("/") + file);
try {
reader.handle_greedy(obj);
} catch (const ParseError& err) {
throw FileParseError(err.what(), absoluteFilename() + _("/") + file); // more detailed message
}
}
// ----------------------------------------------------------------------------- : EOF // ----------------------------------------------------------------------------- : EOF
#endif #endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment