Revision 4c8b82e2 include/ImageTemplate.h

View differences:

include/ImageTemplate.h
33 33

  
34 34
    ~ImageTemplate(){};
35 35

  
36
    /**
37
     *  Checks the template for RESTRICTED ATTRIBUTES
38
     *    @param rs_attr the first restricted attribute found if any
39
     *    @return true if a restricted attribute is found in the template
40
     */
41
    bool check(string& rs_attr)
42
    {
43
        return Template::check(rs_attr, restricted_attributes);
44
    };
45

  
46
    /**
47
     * Deletes all restricted attributes
48
     */
49
    void remove_restricted()
50
    {
51
        Template::remove_restricted(restricted_attributes);
52
    };
53

  
54
    /**
55
     * Deletes all the attributes, except the restricted ones
56
     */
57
    void remove_all_except_restricted()
58
    {
59
        Template::remove_all_except_restricted(restricted_attributes);
60
    };
61

  
62 36
    bool is_saving()
63 37
    {
64 38
        bool save_as_hot;
......
73 47
        replace("SAVE_AS_HOT", "YES");
74 48
    }
75 49

  
76
private:
77
    friend class ImagePool;
50
    // -------------------------------------------------------------------------
51
    // Restricted attributes interface implementation
52
    // -------------------------------------------------------------------------
53
    virtual void remove_restricted()
54
    {
55
        Template::remove_restricted(restricted);
56
    };
78 57

  
79
    static vector<string> restricted_attributes;
58
    virtual bool check_restricted(string& rs_attr, const Template& base)
59
    {
60
        return Template::check_restricted(rs_attr, base, restricted);
61
    }
80 62

  
81
    bool has_restricted()
63
    virtual bool check_restricted(string& rs_attr)
82 64
    {
83
        return restricted_attributes.size() > 0;
84
    };
65
        return Template::check_restricted(rs_attr, restricted);
66
    }
67

  
68
    static void parse_restricted(vector<const SingleAttribute *>& ra)
69
    {
70
        Template::parse_restricted(ra, restricted);
71
    }
85 72

  
73
private:
86 74
    /**
87
     * Stores the attributes as restricted, these attributes will be used in
88
     * ImageTemplate::check
89
     * @param rattrs Attributes to restrict
75
     *  Restricted attribute list for ImageTemplates
90 76
     */
91
    static void set_restricted_attributes(vector<const SingleAttribute *>& rattrs)
92
    {
93
        Template::set_restricted_attributes(rattrs, restricted_attributes);
94
    };
77
    static std::map<std::string, std::set<std::string> > restricted;
95 78
};
96 79

  
97 80
/* -------------------------------------------------------------------------- */

Also available in: Unified diff