~danielrichter2007/grub-customizer/4.0

« back to all changes in this revision

Viewing changes to src/Model/Rule.h

  • Committer: daniel
  • Date: 2014-12-05 15:59:27 UTC
  • Revision ID: svn-v4:be7c28b6-f33a-4d9b-8ecf-65c8357c33c1:trunk:736
headerless: combined headers with cpp files

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 * Copyright (C) 2010-2011 Daniel Richter <danielrichter2007@web.de>
3
 
 *
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.
8
 
 *
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.
13
 
 *
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
17
 
 */
18
 
 
19
 
#ifndef GRUB_CUSTOMIZER_RULE_INCLUDED
20
 
#define GRUB_CUSTOMIZER_RULE_INCLUDED
21
 
#include <string>
22
 
#include "Entry.h"
23
 
#include "../Model/EntryPathBuilder.h"
24
 
#include "../Model/EntryPathFollower.h"
25
 
#include <ostream>
26
 
#include "../lib/md5.h"
27
 
#include "../lib/ArrayStructure.h"
28
 
#include "../lib/Type.h"
29
 
 
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()!
36
 
        bool isVisible;
37
 
        std::list<Model_Rule> subRules;
38
 
        enum RuleType {
39
 
                NORMAL, OTHER_ENTRIES_PLACEHOLDER, PLAINTEXT, SUBMENU
40
 
        } type;
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
44
 
        Model_Rule();
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);
53
 
};
54
 
 
55
 
#endif