2
* Copyright (C) 2010-2011 Daniel Richter <danielrichter2007@web.de>
4
* This program is free software; you can redistribute it and/or modify
5
* it under the terms of the GNU General Public License as published by
6
* the Free Software Foundation; either version 3 of the License, or
7
* (at your option) any later version.
9
* This program is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
* GNU General Public License for more details.
14
* You should have received a copy of the GNU General Public License
15
* along with this program; if not, write to the Free Software
16
* Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
19
#ifndef GRUB_CUSTOMIZER_RULE_INCLUDED
20
#define GRUB_CUSTOMIZER_RULE_INCLUDED
23
#include "../Model/EntryPathBuilder.h"
24
#include "../Model/EntryPathFollower.h"
26
#include "../lib/md5.h"
27
#include "../lib/ArrayStructure.h"
28
#include "../lib/Type.h"
30
struct Model_Rule : public Rule {
31
Model_Entry* dataSource; //assigned when using RuleType::OTHER_ENTRIES_PLACEHOLDER
32
std::string outputName;
33
std::string __idHash; //should only be used by sync()!
34
std::list<std::string> __idpath; //should only be used by sync()!
35
std::string __sourceScriptPath; //should only be used by sync()!
37
std::list<Model_Rule> subRules;
39
NORMAL, OTHER_ENTRIES_PLACEHOLDER, PLAINTEXT, SUBMENU
41
Model_Rule(RuleType type, std::list<std::string> path, std::string outputName, bool isVisible);
42
Model_Rule(RuleType type, std::list<std::string> path, bool isVisible);
43
Model_Rule(Model_Entry& source, bool isVisible, Model_EntryPathFollower& pathFollower, std::list<std::list<std::string> > const& pathesToIgnore = std::list<std::list<std::string> >(), std::list<std::string> const& currentPath = std::list<std::string>()); //generate rule for given entry
45
std::string toString(Model_EntryPathBilder const& pathBuilder);
46
bool hasRealSubrules() const;
47
void print(std::ostream& out) const;
48
std::string getEntryName() const;
49
void setVisibility(bool isVisible);
50
operator ArrayStructure() const;
51
static Model_Rule& fromPtr(Rule* rule);
52
static Model_Rule const& fromPtr(Rule const* rule);