|
From: <mad...@us...> - 2008-01-28 18:46:48
|
Revision: 2769
http://selinux.svn.sourceforge.net/selinux/?rev=2769&view=rev
Author: madmethod
Date: 2008-01-28 10:46:46 -0800 (Mon, 28 Jan 2008)
Log Message:
-----------
various cleanups, remove Makefile targets that don't yet build
Add base class for symbols
remove policy_package and xar dependancies
fix operator = calls to return pointer
add negset to idset
remove unused init/copy methods
Modified Paths:
--------------
branches/policyrep/libpolicyrep/include/policyrep/conditional.hpp
branches/policyrep/libpolicyrep/include/policyrep/idset.hpp
branches/policyrep/libpolicyrep/include/policyrep/mls.hpp
branches/policyrep/libpolicyrep/include/policyrep/object_class.hpp
branches/policyrep/libpolicyrep/include/policyrep/optional.hpp
branches/policyrep/libpolicyrep/include/policyrep/parse.hpp
branches/policyrep/libpolicyrep/include/policyrep/policy.hpp
branches/policyrep/libpolicyrep/include/policyrep/policy_base.hpp
branches/policyrep/libpolicyrep/include/policyrep/rbac.hpp
branches/policyrep/libpolicyrep/include/policyrep/rule.hpp
branches/policyrep/libpolicyrep/include/policyrep/te_decl.hpp
branches/policyrep/libpolicyrep/include/policyrep/user.hpp
branches/policyrep/libpolicyrep/src/conditional.cpp
branches/policyrep/libpolicyrep/src/idset.cpp
branches/policyrep/libpolicyrep/src/mls.cpp
branches/policyrep/libpolicyrep/src/object_class.cpp
branches/policyrep/libpolicyrep/src/optional.cpp
branches/policyrep/libpolicyrep/src/parse.cpp
branches/policyrep/libpolicyrep/src/policy.cpp
branches/policyrep/libpolicyrep/src/policy_base.cpp
branches/policyrep/libpolicyrep/src/policyrep_python.cpp
branches/policyrep/libpolicyrep/src/rbac.cpp
branches/policyrep/libpolicyrep/src/rule.cpp
branches/policyrep/libpolicyrep/src/te_decl.cpp
branches/policyrep/libpolicyrep/src/user.cpp
branches/policyrep/policycoreutils/Makefile
branches/policyrep/policycoreutils/semodule_package/Makefile
Modified: branches/policyrep/libpolicyrep/include/policyrep/conditional.hpp
===================================================================
--- branches/policyrep/libpolicyrep/include/policyrep/conditional.hpp 2008-01-28 13:45:06 UTC (rev 2768)
+++ branches/policyrep/libpolicyrep/include/policyrep/conditional.hpp 2008-01-28 18:46:46 UTC (rev 2769)
@@ -4,6 +4,7 @@
#define __conditional_hpp__
#include <policyrep/policy_base.hpp>
+#include <policyrep/symbol.hpp>
#include <list>
@@ -39,22 +40,19 @@
*/
struct CondBoolImpl;
- class CondBool : public Node
+ class CondBool : public Symbol
{
public:
CondBool();
CondBool(const std::string& name, bool v);
CondBool(const CondBool& other);
virtual ~CondBool();
- virtual void operator=(const CondBool& other);
+ virtual CondBool& operator=(const CondBool& other);
- virtual void set_name(const std::string& name);
- virtual const std::string& get_name() const;
virtual void set_default_value(bool v);
virtual bool get_default_value() const;
protected:
- void copy(const CondBool& other);
virtual void do_output(std::ostream& o, const OutputFormatter& op) const;
CondBoolImpl* impl;
};
@@ -76,7 +74,7 @@
CondOp(Op op);
CondOp(const CondOp& other);
virtual ~CondOp();
- virtual void operator=(const CondOp& other);
+ virtual CondOp& operator=(const CondOp& other);
virtual void set_op(Op op);
virtual Op get_op() const;
@@ -114,9 +112,8 @@
CondBlock(CondBranchPtr if_, CondBranchPtr else_);
CondBlock(const CondBlock& other);
virtual ~CondBlock();
- virtual void operator=(const CondBlock& other);
+ virtual CondBlock& operator=(const CondBlock& other);
protected:
- void copy(const CondBlock& other);
CondBlockImpl* impl;
};
@@ -131,7 +128,7 @@
CondBranch();
CondBranch(const CondBranch& other);
virtual ~CondBranch();
- virtual void operator=(const CondBranch& other);
+ virtual CondBranch& operator=(const CondBranch& other);
virtual CondExpr& expr();
protected:
Modified: branches/policyrep/libpolicyrep/include/policyrep/idset.hpp
===================================================================
--- branches/policyrep/libpolicyrep/include/policyrep/idset.hpp 2008-01-28 13:45:06 UTC (rev 2768)
+++ branches/policyrep/libpolicyrep/include/policyrep/idset.hpp 2008-01-28 18:46:46 UTC (rev 2769)
@@ -6,6 +6,7 @@
#include <policyrep/policy_base.hpp>
#include <set>
+#include <algorithm>
namespace policyrep
{
@@ -15,16 +16,31 @@
public:
IdSet();
IdSet(const IdSet& other);
+ template<typename I>
+ IdSet(bool comp, I sids, I eids){
+ init();
+ set_compl(comp);
+ ids().insert(sids, eids);
+ }
+ template<typename I>
+ IdSet(bool comp, I sids, I eids, I snids, I enids){
+ init();
+ set_compl(comp);
+ ids().insert(sids, eids);
+ neg_ids().insert(snids, enids);
+ }
~IdSet();
- void operator=(const IdSet& other);
+ IdSet& operator=(const IdSet& other);
void set_compl(bool val);
bool get_compl() const;
StringSet& ids();
+ StringSet& neg_ids();
protected:
+ IdSetImpl* impl;
+ private:
void init();
- IdSetImpl* impl;
};
Modified: branches/policyrep/libpolicyrep/include/policyrep/mls.hpp
===================================================================
--- branches/policyrep/libpolicyrep/include/policyrep/mls.hpp 2008-01-28 13:45:06 UTC (rev 2768)
+++ branches/policyrep/libpolicyrep/include/policyrep/mls.hpp 2008-01-28 18:46:46 UTC (rev 2769)
@@ -4,6 +4,7 @@
#define __mls_hpp__
#include <policyrep/policy_base.hpp>
+#include <policyrep/symbol.hpp>
namespace policyrep
{
@@ -13,14 +14,14 @@
//
struct SensitivityImpl;
- class Sensitivity : public Node
+ class Sensitivity : public Symbol
{
public:
Sensitivity();
Sensitivity(const std::string& name);
Sensitivity(const Sensitivity& other);
virtual ~Sensitivity();
- virtual void operator=(const Sensitivity& other);
+ virtual Sensitivity& operator=(const Sensitivity& other);
template<class T>
Sensitivity(const std::string& name, T begin, T end)
@@ -30,14 +31,12 @@
aliases().insert(begin, end);
}
- virtual const std::string& get_name() const;
- virtual void set_name(const std::string& name);
-
virtual StringSet& aliases();
protected:
virtual void do_output(std::ostream& o, const OutputFormatter& op) const;
- void init();
SensitivityImpl* impl;
+ private:
+ void init();
};
typedef boost::shared_ptr<Sensitivity> SensitivityPtr;
@@ -52,7 +51,7 @@
Dominance();
Dominance(const Dominance& other);
virtual ~Dominance();
- virtual void operator=(const Dominance& other);
+ virtual Dominance& operator=(const Dominance& other);
template<class T>
Dominance(T begin, T end)
@@ -64,8 +63,9 @@
virtual StringVector& ordering();
protected:
virtual void do_output(std::ostream& o, const OutputFormatter& op) const;
- void init();
DominanceImpl* impl;
+ private:
+ void init();
};
typedef boost::shared_ptr<Dominance> DominancePtr;
@@ -74,14 +74,14 @@
//
struct CategoryImpl;
- class Category : public Node
+ class Category : public Symbol
{
public:
Category();
Category(const std::string& name);
Category(const Category& other);
virtual ~Category();
- virtual void operator=(const Category& other);
+ virtual Category& operator=(const Category& other);
template<class T>
Category(const std::string& name, T begin, T end)
@@ -91,13 +91,11 @@
aliases().insert(begin, end);
}
- virtual const std::string& get_name() const;
- virtual void set_name(const std::string& name);
-
virtual StringSet& aliases();
protected:
- virtual void do_output(std::ostream& o, const OutputFormatter& op) const;
+ private:
void init();
+ virtual void do_output(std::ostream& o, const OutputFormatter& op) const;
CategoryImpl* impl;
};
typedef boost::shared_ptr<Category> CategoryPtr;
@@ -107,14 +105,14 @@
//
struct LevelImpl;
- class Level : public Node
+ class Level : public Symbol
{
public:
Level();
Level(const std::string& name);
Level(const Level& other);
virtual ~Level();
- virtual void operator=(const Level& other);
+ virtual Level& operator=(const Level& other);
template<class T>
Level(const std::string& name, T begin, T end)
@@ -124,15 +122,13 @@
categories().insert(begin, end);
}
- virtual const std::string& get_name() const;
- virtual void set_name(const std::string& name);
-
virtual StringSet& categories();
virtual void do_output_brief(std::ostream& o, const OutputFormatter& op) const;
protected:
virtual void do_output(std::ostream& o, const OutputFormatter& op) const;
- void init();
LevelImpl* impl;
+ private:
+ void init();
};
typedef boost::shared_ptr<Level> LevelPtr;
@@ -153,10 +149,9 @@
virtual const LevelPtr& get_high() const;
virtual LevelPtr& get_low();
virtual LevelPtr& get_high();
- virtual void operator=(const Range& other);
+ virtual Range& operator=(const Range& other);
virtual void do_output(std::ostream& o, const OutputFormatter& op) const;
protected:
- void init();
RangeImpl* impl;
};
typedef boost::shared_ptr<Range> RangePtr;
Modified: branches/policyrep/libpolicyrep/include/policyrep/object_class.hpp
===================================================================
--- branches/policyrep/libpolicyrep/include/policyrep/object_class.hpp 2008-01-28 13:45:06 UTC (rev 2768)
+++ branches/policyrep/libpolicyrep/include/policyrep/object_class.hpp 2008-01-28 18:46:46 UTC (rev 2769)
@@ -4,6 +4,7 @@
#define __object_class_hpp__
#include <policyrep/policy_base.hpp>
+#include <policyrep/symbol.hpp>
namespace policyrep
{
@@ -13,13 +14,13 @@
//
struct CommonPermsImpl;
- class CommonPerms : public Node
+ class CommonPerms : public Symbol
{
public:
CommonPerms();
CommonPerms(const CommonPerms& other);
virtual ~CommonPerms();
- virtual void operator=(const CommonPerms& other);
+ virtual CommonPerms& operator=(const CommonPerms& other);
template<class T>
CommonPerms(const std::string& name, T perms_begin, T perms_end)
@@ -29,15 +30,13 @@
perms().insert(perms_begin, perms_end);
}
- virtual const std::string& get_name() const;
- virtual void set_name(const std::string& name);
virtual StringSet& perms();
protected:
virtual void do_output(std::ostream& o, const OutputFormatter& op) const;
- void init();
- void copy(const CommonPerms& other);
CommonPermsImpl* impl;
+ private:
+ void init();
};
typedef boost::shared_ptr<CommonPerms> CommonPermsPtr;
@@ -46,14 +45,15 @@
//
struct ObjectClassImpl;
- class ObjectClass : public Node
+ class ObjectClass : public Symbol
{
public:
ObjectClass();
+ ObjectClass(const std::string& name);
ObjectClass(const std::string& name, const std::string& commons);
ObjectClass(const ObjectClass& other);
virtual ~ObjectClass();
- virtual void operator=(const ObjectClass& other);
+ virtual ObjectClass& operator=(const ObjectClass& other);
template<class T>
ObjectClass(std::string name, std::string commons,
@@ -65,21 +65,18 @@
perms().insert(perms_begin, perms_end);
}
- virtual const std::string& get_name() const;
- virtual void set_name(const std::string& name);
virtual StringSet& perms();
virtual const std::string& get_common_perms() const;
virtual void set_common_perms(const std::string& name);
protected:
virtual void do_output(std::ostream& o, const OutputFormatter& op) const;
- void init();
- void copy(const ObjectClass& other);
ObjectClassImpl* impl;
+ private:
+ void init();
};
typedef boost::shared_ptr<ObjectClass> ObjectClassPtr;
-
} // namespace policyrep
#endif
Modified: branches/policyrep/libpolicyrep/include/policyrep/optional.hpp
===================================================================
--- branches/policyrep/libpolicyrep/include/policyrep/optional.hpp 2008-01-28 13:45:06 UTC (rev 2768)
+++ branches/policyrep/libpolicyrep/include/policyrep/optional.hpp 2008-01-28 18:46:46 UTC (rev 2769)
@@ -19,9 +19,8 @@
OptionalBlock(OptionalBranchPtr true_);
OptionalBlock(OptionalBranchPtr true_, OptionalBranchPtr false_);
virtual ~OptionalBlock();
- virtual void operator=(const OptionalBlock& other);
+ virtual OptionalBlock& operator=(const OptionalBlock& other);
protected:
- void copy(const OptionalBlock& other);
OptionalBlockImpl* impl;
};
typedef boost::shared_ptr<OptionalBlock> OptionalBlockPtr;
@@ -33,60 +32,13 @@
OptionalBranch();
OptionalBranch(const OptionalBranch& other);
virtual ~OptionalBranch();
- virtual void operator=(const OptionalBranch& other);
+ virtual OptionalBranch& operator=(const OptionalBranch& other);
protected:
virtual void do_output(std::ostream& o, const OutputFormatter& op) const;
- void copy(const OptionalBranch& other);
OptionalBranchImpl* impl;
};
} // namespace policyrep
#endif
-/* Author: Karl MacMillan <kma...@me...> */
-
-#ifndef __optional_hpp__
-#define __optional_hpp__
-
-#include <policyrep/policy_base.hpp>
-
-namespace policyrep
-{
- class OptionalBranch;
- typedef boost::shared_ptr<OptionalBranch> OptionalBranchPtr;
-
- struct OptionalBlockImpl;
- class OptionalBlock : public PolicyBlock
- {
- public:
- OptionalBlock();
- OptionalBlock(const OptionalBlock& other);
- OptionalBlock(OptionalBranchPtr true_);
- OptionalBlock(OptionalBranchPtr true_, OptionalBranchPtr false_);
- virtual ~OptionalBlock();
- virtual void operator=(const OptionalBlock& other);
- protected:
- void copy(const OptionalBlock& other);
- OptionalBlockImpl* impl;
- };
- typedef boost::shared_ptr<OptionalBlock> OptionalBlockPtr;
-
- struct OptionalBranchImpl;
- class OptionalBranch : public PolicyBranch
- {
- public:
- OptionalBranch();
- OptionalBranch(const OptionalBranch& other);
- virtual ~OptionalBranch();
- virtual void operator=(const OptionalBranch& other);
-
- protected:
- virtual void do_output(std::ostream& o, const OutputFormatter& op) const;
- void copy(const OptionalBranch& other);
- OptionalBranchImpl* impl;
- };
-
-} // namespace policyrep
-
-#endif
Modified: branches/policyrep/libpolicyrep/include/policyrep/parse.hpp
===================================================================
--- branches/policyrep/libpolicyrep/include/policyrep/parse.hpp 2008-01-28 13:45:06 UTC (rev 2768)
+++ branches/policyrep/libpolicyrep/include/policyrep/parse.hpp 2008-01-28 18:46:46 UTC (rev 2769)
@@ -18,7 +18,7 @@
Parser();
Parser(const Parser& other);
virtual ~Parser();
- virtual void operator=(const Parser& other);
+ virtual Parser& operator=(const Parser& other);
// Parser
virtual ModulePtr parse(const std::string& f);
Modified: branches/policyrep/libpolicyrep/include/policyrep/policy.hpp
===================================================================
--- branches/policyrep/libpolicyrep/include/policyrep/policy.hpp 2008-01-28 13:45:06 UTC (rev 2768)
+++ branches/policyrep/libpolicyrep/include/policyrep/policy.hpp 2008-01-28 18:46:46 UTC (rev 2769)
@@ -12,6 +12,7 @@
#include <policyrep/user.hpp>
#include <policyrep/mls.hpp>
#include <policyrep/optional.hpp>
+#include <policyrep/symbol.hpp>
namespace policyrep
{
@@ -27,13 +28,12 @@
Policy(bool mls=false);
Policy(const Policy& other);
virtual ~Policy();
- virtual void operator=(const Policy& other);
+ virtual Policy& operator=(const Policy& other);
virtual bool get_mls() const;
virtual void set_mls(bool val);
virtual bool ignore_indent() const;
protected:
- void copy(const Policy& other);
PolicyImpl* impl;
};
typedef boost::shared_ptr<Policy> PolicyPtr;
@@ -49,7 +49,7 @@
Module(const std::string& name, const std::string& version);
Module(const Module& other);
virtual ~Module();
- virtual void operator=(const Module& other);
+ virtual Module& operator=(const Module& other);
virtual const std::string& get_name() const;
virtual void set_name(const std::string& name);
@@ -59,7 +59,6 @@
protected:
virtual void do_output(std::ostream& o, const OutputFormatter& op) const;
- void copy(const Module& other);
ModuleImpl* impl;
};
typedef boost::shared_ptr<Module> ModulePtr;
@@ -69,21 +68,17 @@
//
struct InitialSidImpl;
- class InitialSid : public Node
+ class InitialSid : public Symbol
{
public:
InitialSid();
InitialSid(const std::string& name);
InitialSid(const InitialSid& other);
virtual ~InitialSid();
- virtual void operator=(const InitialSid& other);
+ virtual InitialSid& operator=(const InitialSid& other);
- virtual const std::string& get_name() const;
- virtual void set_name(const std::string& name);
-
protected:
virtual void do_output(std::ostream& o, const OutputFormatter& op) const;
- void copy(const InitialSid& other);
InitialSidImpl* impl;
};
typedef boost::shared_ptr<InitialSid> InitialSidPtr;
Modified: branches/policyrep/libpolicyrep/include/policyrep/policy_base.hpp
===================================================================
--- branches/policyrep/libpolicyrep/include/policyrep/policy_base.hpp 2008-01-28 13:45:06 UTC (rev 2768)
+++ branches/policyrep/libpolicyrep/include/policyrep/policy_base.hpp 2008-01-28 18:46:46 UTC (rev 2769)
@@ -82,7 +82,7 @@
OutputFormatter();
OutputFormatter(const OutputFormatter& other);
~OutputFormatter();
- void operator=(const OutputFormatter& other);
+ OutputFormatter& operator=(const OutputFormatter& other);
OutputFormatter& operator()(const Node& n, bool end=false);
OutputFormatter& operator()(NodePtr n, bool end=false);
@@ -117,7 +117,7 @@
Node();
Node(const Node& other);
virtual ~Node();
- virtual void operator=(const Node& other);
+ virtual Node& operator=(const Node& other);
virtual void set_parent(Parent* p);
virtual Parent* get_parent() const;
@@ -132,7 +132,6 @@
protected:
virtual void output_indentation(std::ostream& o, const OutputFormatter& op) const;
virtual void do_output(std::ostream& o, const OutputFormatter& op) const;
- void copy(const Node& other);
NodeImpl* node_impl;
static const int VISITED = 1;
};
@@ -153,7 +152,7 @@
explicit TreeIterator(Parent* n, enum Strategy strategy=POSTORDER);
TreeIterator(const TreeIterator& other);
virtual ~TreeIterator();
- void operator=(const TreeIterator& other);
+ TreeIterator& operator=(const TreeIterator& other);
bool get_visited() const;
private:
friend class boost::iterator_core_access;
@@ -177,7 +176,7 @@
Parent();
Parent(const Parent& other);
virtual ~Parent();
- virtual void operator=(const Parent& other);
+ virtual Parent& operator=(const Parent& other);
typedef TreeIterator iterator;
virtual void append_child(NodePtr Node);
@@ -197,7 +196,6 @@
virtual bool ignore_indent() const;
protected:
- void copy(const Parent& other);
ParentImpl* parent_impl;
};
typedef boost::shared_ptr<Parent> ParentPtr;
@@ -223,7 +221,7 @@
PolicyBlock(PolicyBranchPtr true_, PolicyBranchPtr false_);
PolicyBlock(const PolicyBlock& other);
virtual ~PolicyBlock();
- virtual void operator=(const PolicyBlock& other);
+ virtual PolicyBlock& operator=(const PolicyBlock& other);
virtual void append_child(PolicyBranchPtr node);
@@ -235,7 +233,6 @@
virtual void set_false(PolicyBranchPtr branch);
virtual bool ignore_indent() const;
protected:
- void copy(const PolicyBlock& other);
PolicyBlockImpl* block_impl;
};
@@ -250,12 +247,11 @@
PolicyBranch();
PolicyBranch(const PolicyBranch& other);
virtual ~PolicyBranch();
- virtual void operator=(const PolicyBranch& other);
+ virtual PolicyBranch& operator=(const PolicyBranch& other);
virtual void set_isfalse(bool v);
virtual bool get_isfalse() const;
protected:
- void copy(const PolicyBranch& other);
PolicyBranchImpl* branch_impl;
};
Modified: branches/policyrep/libpolicyrep/include/policyrep/rbac.hpp
===================================================================
--- branches/policyrep/libpolicyrep/include/policyrep/rbac.hpp 2008-01-28 13:45:06 UTC (rev 2768)
+++ branches/policyrep/libpolicyrep/include/policyrep/rbac.hpp 2008-01-28 18:46:46 UTC (rev 2769)
@@ -4,6 +4,7 @@
#define __role_hpp__
#include <policyrep/policy_base.hpp>
+#include <policyrep/symbol.hpp>
namespace policyrep
{
@@ -13,14 +14,14 @@
//
struct RoleImpl;
- class Role : public Node
+ class Role : public Symbol
{
public:
Role();
Role(const std::string& name);
Role(const Role& other);
virtual ~Role();
- virtual void operator=(const Role& other);
+ virtual Role& operator=(const Role& other);
template<class T>
Role(const std::string& name, T types_begin, T end)
@@ -30,14 +31,12 @@
types().insert(types_begin, end);
}
- virtual const std::string& get_name() const;
- virtual void set_name(const std::string& name);
-
virtual StringSet& types();
protected:
virtual void do_output(std::ostream& o, const OutputFormatter& op) const;
- void init();
RoleImpl* impl;
+ private:
+ void init();
};
typedef boost::shared_ptr<Role> RolePtr;
Modified: branches/policyrep/libpolicyrep/include/policyrep/rule.hpp
===================================================================
--- branches/policyrep/libpolicyrep/include/policyrep/rule.hpp 2008-01-28 13:45:06 UTC (rev 2768)
+++ branches/policyrep/libpolicyrep/include/policyrep/rule.hpp 2008-01-28 18:46:46 UTC (rev 2769)
@@ -21,7 +21,7 @@
AVRule(Type type=ALLOW);
AVRule(const AVRule& other);
virtual ~AVRule();
- virtual void operator=(const AVRule& other);
+ virtual AVRule& operator=(const AVRule& other);
virtual void set_type(Type type);
virtual Type get_type() const;
@@ -33,8 +33,6 @@
protected:
virtual void do_output(std::ostream& o, const OutputFormatter& op) const;
- void init();
- void copy(const AVRule& other);
AVRuleImpl* impl;
};
@@ -50,7 +48,7 @@
TypeRule(Type type=TRANSITION);
TypeRule(const TypeRule& other);
virtual ~TypeRule();
- virtual void operator=(const TypeRule& other);
+ virtual TypeRule& operator=(const TypeRule& other);
virtual void set_type(Type type);
virtual Type get_type() const;
@@ -63,8 +61,6 @@
protected:
virtual void do_output(std::ostream& o, const OutputFormatter& op) const;
- void init();
- void copy(const TypeRule& other);
TypeRuleImpl* impl;
};
Modified: branches/policyrep/libpolicyrep/include/policyrep/te_decl.hpp
===================================================================
--- branches/policyrep/libpolicyrep/include/policyrep/te_decl.hpp 2008-01-28 13:45:06 UTC (rev 2768)
+++ branches/policyrep/libpolicyrep/include/policyrep/te_decl.hpp 2008-01-28 18:46:46 UTC (rev 2769)
@@ -4,6 +4,7 @@
#define __te_decl_hpp__
#include <policyrep/policy_base.hpp>
+#include <policyrep/symbol.hpp>
namespace policyrep
{
@@ -13,14 +14,14 @@
//
struct TypeImpl;
- class Type : public Node
+ class Type : public Symbol
{
public:
Type();
Type(const std::string& name);
Type(const Type& other);
virtual ~Type();
- virtual void operator=(const Type& other);
+ virtual Type& operator=(const Type& other);
template<class T>
Type(const std::string& name, T attrs_begin, T end)
@@ -40,16 +41,13 @@
aliases().insert(aliases_begin, aliases_end);
}
- virtual const std::string& get_name() const;
- virtual void set_name(const std::string& name);
-
virtual StringSet& aliases();
virtual StringSet& attributes();
protected:
virtual void do_output(std::ostream& o, const OutputFormatter& op) const;
- void init();
- virtual void copy(const Type& other);
TypeImpl* impl;
+ private:
+ void init();
};
typedef boost::shared_ptr<Type> TypePtr;
@@ -58,20 +56,17 @@
//
struct AttributeImpl;
- class Attribute : public Node
+ class Attribute : public Symbol
{
public:
Attribute();
Attribute(const std::string& name);
Attribute(const Attribute& other);
virtual ~Attribute();
- virtual void operator=(const Attribute& other);
+ virtual Attribute& operator=(const Attribute& other);
- virtual const std::string& get_name() const;
- virtual void set_name(const std::string& name);
protected:
virtual void do_output(std::ostream& o, const OutputFormatter& op) const;
- virtual void copy(const Attribute& other);
AttributeImpl* impl;
};
typedef boost::shared_ptr<Attribute> AttributePtr;
@@ -87,7 +82,7 @@
TypeAttribute();
TypeAttribute(const TypeAttribute& other);
virtual ~TypeAttribute();
- virtual void operator=(const TypeAttribute& other);
+ virtual TypeAttribute& operator=(const TypeAttribute& other);
template<class T>
TypeAttribute(const std::string& name, T attrs_begin,
@@ -103,9 +98,9 @@
virtual StringSet& attributes();
protected:
virtual void do_output(std::ostream& o, const OutputFormatter& op) const;
- void init();
- virtual void copy(const TypeAttribute& other);
TypeAttributeImpl* impl;
+ private:
+ void init();
};
typedef boost::shared_ptr<TypeAttribute> TypeAttributePtr;
@@ -120,7 +115,7 @@
TypeAlias();
TypeAlias(const TypeAlias& other);
virtual ~TypeAlias();
- virtual void operator=(const TypeAlias& other);
+ virtual TypeAlias& operator=(const TypeAlias& other);
template<class T>
TypeAlias(const std::string& name, T attrs_begin,
@@ -136,13 +131,12 @@
virtual StringSet& aliases();
protected:
virtual void do_output(std::ostream& o, const OutputFormatter& op) const;
- void init();
- virtual void copy(const TypeAlias& other);
TypeAliasImpl* impl;
+ private:
+ void init();
};
typedef boost::shared_ptr<TypeAlias> TypeAliasPtr;
-
} // namespace policyrep
#endif
Modified: branches/policyrep/libpolicyrep/include/policyrep/user.hpp
===================================================================
--- branches/policyrep/libpolicyrep/include/policyrep/user.hpp 2008-01-28 13:45:06 UTC (rev 2768)
+++ branches/policyrep/libpolicyrep/include/policyrep/user.hpp 2008-01-28 18:46:46 UTC (rev 2769)
@@ -5,6 +5,7 @@
#include <policyrep/policy_base.hpp>
#include <policyrep/mls.hpp>
+#include <policyrep/symbol.hpp>
namespace policyrep
{
@@ -14,14 +15,14 @@
//
struct UserImpl;
- class User : public Node
+ class User : public Symbol
{
public:
User();
User(const std::string& name);
User(const User& other);
virtual ~User();
- virtual void operator=(const User& other);
+ virtual User& operator=(const User& other);
template<class T>
User(const std::string& name, T roles_begin, T end)
@@ -43,9 +44,6 @@
set_range_high(high);
}
-
- virtual const std::string& get_name() const;
- virtual void set_name(const std::string& name);
virtual void set_level(LevelPtr level);
virtual void set_range_low(LevelPtr low);
virtual void set_range_high(LevelPtr high);
@@ -54,8 +52,9 @@
virtual StringSet& roles();
protected:
virtual void do_output(std::ostream& o, const OutputFormatter& op) const;
- void init();
UserImpl* impl;
+ private:
+ void init();
};
typedef boost::shared_ptr<User> UserPtr;
Modified: branches/policyrep/libpolicyrep/src/conditional.cpp
===================================================================
--- branches/policyrep/libpolicyrep/src/conditional.cpp 2008-01-28 13:45:06 UTC (rev 2768)
+++ branches/policyrep/libpolicyrep/src/conditional.cpp 2008-01-28 18:46:46 UTC (rev 2769)
@@ -33,25 +33,23 @@
struct CondBoolImpl
{
- std::string name;
bool default_value;
};
- CondBool::CondBool() : impl(new CondBoolImpl)
+ CondBool::CondBool() : Symbol(), impl(new CondBoolImpl)
{
}
CondBool::CondBool(const std::string& name, bool v)
- : impl(new CondBoolImpl)
+ :Symbol(name), impl(new CondBoolImpl)
{
- impl->name = name;
impl->default_value = v;
}
- CondBool::CondBool(const CondBool& other) : Node(), impl(new CondBoolImpl)
+ CondBool::CondBool(const CondBool& other) : Symbol(other), impl(new CondBoolImpl)
{
- copy(other);
+ *impl = *other.impl;
}
CondBool::~CondBool()
@@ -59,21 +57,13 @@
delete impl;
}
- void CondBool::operator=(const CondBool& other)
+ CondBool& CondBool::operator=(const CondBool& other)
{
- copy(other);
+ Symbol::operator=(other);
+ *impl = *other.impl;
+ return *this;
}
- void CondBool::set_name(const std::string& name)
- {
- impl->name = name;
- }
-
- const std::string& CondBool::get_name() const
- {
- return impl->name;
- }
-
void CondBool::set_default_value(bool v)
{
impl->default_value = v;
@@ -86,19 +76,13 @@
void CondBool::do_output(std::ostream& o, const OutputFormatter& op) const
{
- o << "bool " << impl->name << " ";
+ o << "bool " << get_name() << " ";
if (impl->default_value)
o << "true;";
else
o << "false;";
}
- void CondBool::copy(const CondBool& other)
- {
- Node::copy(other);
- *impl = *other.impl;
- }
-
//
// CondOp
//
@@ -136,9 +120,10 @@
delete impl;
}
- void CondOp::operator=(const CondOp& other)
+ CondOp& CondOp::operator=(const CondOp& other)
{
*impl = *other.impl;
+ return *this;
}
void CondOp::set_bool(const std::string& b)
@@ -190,7 +175,6 @@
return o;
}
-
//
// CondBlock
//
@@ -213,9 +197,9 @@
append_child(else_);
}
- CondBlock::CondBlock(const CondBlock& other) : PolicyBlock(), impl(new CondBlockImpl)
+ CondBlock::CondBlock(const CondBlock& other) : PolicyBlock(other), impl(new CondBlockImpl)
{
- copy(other);
+ *impl = *other.impl;
}
CondBlock::~CondBlock()
@@ -223,18 +207,13 @@
delete impl;
}
- void CondBlock::operator=(const CondBlock& other)
+ CondBlock& CondBlock::operator=(const CondBlock& other)
{
- copy(other);
- }
-
- void CondBlock::copy(const CondBlock& other)
- {
- PolicyBlock::copy(other);
+ PolicyBlock::operator=(other);
*impl = *other.impl;
+ return *this;
}
-
//
// CondBranch
//
@@ -249,9 +228,9 @@
}
- CondBranch::CondBranch(const CondBranch& other) : PolicyBranch(), impl(new CondBranchImpl)
+ CondBranch::CondBranch(const CondBranch& other) : PolicyBranch(other), impl(new CondBranchImpl)
{
- copy(other);
+ *impl = *other.impl;
}
CondBranch::~CondBranch()
@@ -259,9 +238,11 @@
delete impl;
}
- void CondBranch::operator=(const CondBranch& other)
+ CondBranch& CondBranch::operator=(const CondBranch& other)
{
- copy(other);
+ PolicyBranch::operator=(other);
+ *impl = *other.impl;
+ return *this;
}
CondExpr& CondBranch::expr()
@@ -299,10 +280,4 @@
}
- void CondBranch::copy(const CondBranch& other)
- {
- PolicyBranch::copy(other);
- *impl = *other.impl;
- }
-
}
Modified: branches/policyrep/libpolicyrep/src/idset.cpp
===================================================================
--- branches/policyrep/libpolicyrep/src/idset.cpp 2008-01-28 13:45:06 UTC (rev 2768)
+++ branches/policyrep/libpolicyrep/src/idset.cpp 2008-01-28 18:46:46 UTC (rev 2769)
@@ -27,6 +27,7 @@
{
IdSetImpl() : compliment(false) { }
StringSet ids;
+ StringSet neg_ids;
bool compliment;
};
@@ -35,19 +36,23 @@
impl = new IdSetImpl;
}
- IdSet::IdSet() { init(); }
+ IdSet::IdSet()
+ {
+ impl = new IdSetImpl;
+ }
IdSet::IdSet(const IdSet& other)
{
- init();
+ impl = new IdSetImpl;
*impl = *other.impl;
}
IdSet::~IdSet() { delete impl; }
- void IdSet::operator=(const IdSet& other)
+ IdSet& IdSet::operator=(const IdSet& other)
{
*impl = *other.impl;
+ return *this;
}
void IdSet::set_compl(bool val)
@@ -65,4 +70,9 @@
return impl->ids;
}
+ StringSet& IdSet::neg_ids()
+ {
+ return impl->neg_ids;
+ }
+
} // namespace policyre
Modified: branches/policyrep/libpolicyrep/src/mls.cpp
===================================================================
--- branches/policyrep/libpolicyrep/src/mls.cpp 2008-01-28 13:45:06 UTC (rev 2768)
+++ branches/policyrep/libpolicyrep/src/mls.cpp 2008-01-28 18:46:46 UTC (rev 2769)
@@ -29,7 +29,6 @@
struct SensitivityImpl
{
- std::string name;
StringSet aliases;
};
@@ -38,38 +37,36 @@
impl = new SensitivityImpl;
}
- Sensitivity::Sensitivity() { init(); }
+ Sensitivity::Sensitivity()
+ :Symbol()
+ {
+ impl = new SensitivityImpl;
+ }
Sensitivity::Sensitivity(const std::string& name)
+ :Symbol(name)
{
- init();
- impl->name = name;
+ impl = new SensitivityImpl;
}
Sensitivity::Sensitivity(const Sensitivity& other)
- : Node()
+ :Symbol(other)
{
- init();
+ impl = new SensitivityImpl;
*impl = *other.impl;
}
- Sensitivity::~Sensitivity() { delete impl; }
-
- void Sensitivity::operator=(const Sensitivity& other)
+ Sensitivity::~Sensitivity()
{
- *impl = *other.impl;
+ delete impl;
}
- const std::string& Sensitivity::get_name() const
+ Sensitivity& Sensitivity::operator=(const Sensitivity& other)
{
- return impl->name;
+ *impl = *other.impl;
+ return *this;
}
- void Sensitivity::set_name(const std::string& name)
- {
- impl->name = name;
- }
-
StringSet& Sensitivity::aliases()
{
return impl->aliases;
@@ -77,7 +74,7 @@
void Sensitivity::do_output(std::ostream& o, const OutputFormatter& op) const
{
- o << "sensitivity " << impl->name;
+ o << "sensitivity " << get_name();
if (!impl->aliases.empty()) {
o << " alias ";
bracket_output_container(o, impl->aliases.begin(),
@@ -100,20 +97,25 @@
impl = new DominanceImpl;
}
- Dominance::Dominance() { init(); }
+ Dominance::Dominance()
+ :Node()
+ {
+ impl = new DominanceImpl;
+ }
Dominance::Dominance(const Dominance& other)
- : Node()
+ :Node(other)
{
- init();
+ impl = new DominanceImpl;
*impl = *other.impl;
}
Dominance::~Dominance() { delete impl; }
- void Dominance::operator=(const Dominance& other)
+ Dominance& Dominance::operator=(const Dominance& other)
{
*impl = *other.impl;
+ return *this;
}
StringVector& Dominance::ordering()
@@ -137,7 +139,6 @@
struct CategoryImpl
{
- std::string name;
StringSet aliases;
};
@@ -146,38 +147,36 @@
impl = new CategoryImpl;
}
- Category::Category() { init(); }
+ Category::Category()
+ :Symbol()
+ {
+ impl = new CategoryImpl;
+ }
Category::Category(const std::string& name)
+ :Symbol(name)
{
- init();
- impl->name = name;
+ impl = new CategoryImpl;
}
Category::Category(const Category& other)
- : Node()
+ :Symbol(other)
{
init();
*impl = *other.impl;
}
- Category::~Category() { delete impl; }
-
- void Category::operator=(const Category& other)
+ Category::~Category()
{
- *impl = *other.impl;
+ delete impl;
}
- const std::string& Category::get_name() const
+ Category& Category::operator=(const Category& other)
{
- return impl->name;
+ *impl = *other.impl;
+ return *this;
}
- void Category::set_name(const std::string& name)
- {
- impl->name = name;
- }
-
StringSet& Category::aliases()
{
return impl->aliases;
@@ -185,7 +184,7 @@
void Category::do_output(std::ostream& o, const OutputFormatter& op) const
{
- o << "category " << impl->name;
+ o << "category " << get_name();
if (!impl->aliases.empty()) {
o << " alias ";
bracket_output_container(o, impl->aliases.begin(),
@@ -209,18 +208,22 @@
impl = new LevelImpl;
}
- Level::Level() { init(); }
+ Level::Level()
+ :Symbol()
+ {
+ impl = new LevelImpl;
+ }
Level::Level(const std::string& name)
+ :Symbol(name)
{
- init();
- impl->name = name;
+ impl = new LevelImpl;
}
Level::Level(const Level& other)
- : Node()
+ :Symbol(other)
{
- init();
+ impl = new LevelImpl;
*impl = *other.impl;
}
@@ -228,21 +231,12 @@
delete impl;
}
- void Level::operator=(const Level& other)
+ Level& Level::operator=(const Level& other)
{
*impl = *other.impl;
+ return *this;
}
- const std::string& Level::get_name() const
- {
- return impl->name;
- }
-
- void Level::set_name(const std::string& name)
- {
- impl->name = name;
- }
-
StringSet& Level::categories()
{
return impl->categories;
@@ -250,7 +244,7 @@
void Level::do_output_brief(std::ostream& o, const OutputFormatter& op) const
{
- o << impl->name;
+ o << get_name();
if (!impl->categories.empty()) {
o << ":";
bracket_output_container(o, impl->categories.begin(),
@@ -277,26 +271,26 @@
Range::Range()
{
- init();
+ impl = new RangeImpl;
}
Range::Range(LevelPtr low)
{
- init();
+ impl = new RangeImpl;
impl->low = low;
}
Range::Range(LevelPtr low, LevelPtr high)
{
- init();
+ impl = new RangeImpl;
impl->low = low;
impl->high = high;
}
Range::Range(const Range& other)
- : Node()
+ :Node(other)
{
- init();
+ impl = new RangeImpl;
*impl = *(other.impl);
}
@@ -305,9 +299,10 @@
delete impl;
}
- void Range::operator=(const Range& other)
+ Range& Range::operator=(const Range& other)
{
*impl = *(other.impl);
+ return *this;
}
const LevelPtr& Range::get_low(void) const
@@ -339,10 +334,4 @@
}
}
- void Range::init()
- {
- impl = new RangeImpl;
- }
-
-
} // namespace policyrep
Modified: branches/policyrep/libpolicyrep/src/object_class.cpp
===================================================================
--- branches/policyrep/libpolicyrep/src/object_class.cpp 2008-01-28 13:45:06 UTC (rev 2768)
+++ branches/policyrep/libpolicyrep/src/object_class.cpp 2008-01-28 18:46:46 UTC (rev 2769)
@@ -28,39 +28,36 @@
struct CommonPermsImpl
{
- std::string name;
StringSet perms;
};
- void CommonPerms::init() { impl = new CommonPermsImpl; }
-
- CommonPerms::CommonPerms() { init(); }
-
- CommonPerms::CommonPerms(const CommonPerms& other)
- : Node()
+ void CommonPerms::init()
{
- init();
- copy(other);
+ impl = new CommonPermsImpl;
}
- CommonPerms::~CommonPerms()
+ CommonPerms::CommonPerms()
{
- delete impl;
+ impl = new CommonPermsImpl;
}
- void CommonPerms::operator=(const CommonPerms& other)
+ CommonPerms::CommonPerms(const CommonPerms& other)
+ :Symbol(other)
{
- copy(other);
+ impl = new CommonPermsImpl;
+ *impl = *other.impl;
}
- const std::string& CommonPerms::get_name() const
+ CommonPerms::~CommonPerms()
{
- return impl->name;
+ delete impl;
}
- void CommonPerms::set_name(const std::string& name)
+ CommonPerms& CommonPerms::operator=(const CommonPerms& other)
{
- impl->name = name;
+ Symbol::operator=(other);
+ *impl = *other.impl;
+ return *this;
}
StringSet& CommonPerms::perms()
@@ -70,43 +67,48 @@
void CommonPerms::do_output(std::ostream& o, const OutputFormatter& op) const
{
- o << "common " << impl->name << " ";
+ o << "common " << get_name() << " ";
output_set_space(o, impl->perms);
}
- void CommonPerms::copy(const CommonPerms& other)
- {
- Node::copy(other);
- *impl = *other.impl;
- }
-
//
// ObjectClass
//
struct ObjectClassImpl
{
- std::string name;
StringSet perms;
std::string common_perms;
};
- void ObjectClass::init() { impl = new ObjectClassImpl; }
+ void ObjectClass::init()
+ {
+ impl = new ObjectClassImpl;
+ }
- ObjectClass::ObjectClass() { init(); }
+ ObjectClass::ObjectClass()
+ {
+ impl = new ObjectClassImpl;
+ }
+ ObjectClass::ObjectClass(const std::string &name)
+ :Symbol(name)
+ {
+ impl = new ObjectClassImpl;
+ }
+
ObjectClass::ObjectClass(const std::string& name, const std::string& commons)
+ :Symbol(name)
{
- init();
- set_name(name);
+ impl = new ObjectClassImpl;
set_common_perms(commons);
}
ObjectClass::ObjectClass(const ObjectClass& other)
- : Node()
+ :Symbol(other)
{
- init();
- copy(other);
+ impl = new ObjectClassImpl;
+ *impl = *other.impl;
}
ObjectClass::~ObjectClass()
@@ -114,21 +116,13 @@
delete impl;
}
- void ObjectClass::operator=(const ObjectClass& other)
+ ObjectClass& ObjectClass::operator=(const ObjectClass& other)
{
- copy(other);
+ Symbol::operator=(other);
+ *impl = *other.impl;
+ return *this;
}
- const std::string& ObjectClass::get_name() const
- {
- return impl->name;
- }
-
- void ObjectClass::set_name(const std::string& name)
- {
- impl->name = name;
- }
-
StringSet& ObjectClass::perms()
{
return impl->perms;
@@ -146,7 +140,7 @@
void ObjectClass::do_output(std::ostream& o, const OutputFormatter& op) const
{
- o << "class " << impl->name;
+ o << "class " << get_name();
if (impl->common_perms != "")
o << " inherits " << impl->common_perms;
if (!impl->perms.empty()) {
@@ -155,11 +149,4 @@
}
}
- void ObjectClass::copy(const ObjectClass& other)
- {
- Node::copy(other);
- *impl = *other.impl;
- }
-
-
} // namespace policyrep
Modified: branches/policyrep/libpolicyrep/src/optional.cpp
===================================================================
--- branches/policyrep/libpolicyrep/src/optional.cpp 2008-01-28 13:45:06 UTC (rev 2768)
+++ branches/policyrep/libpolicyrep/src/optional.cpp 2008-01-28 18:46:46 UTC (rev 2769)
@@ -30,9 +30,9 @@
}
- OptionalBlock::OptionalBlock(const OptionalBlock& other) : PolicyBlock()
+ OptionalBlock::OptionalBlock(const OptionalBlock& other) : PolicyBlock(other)
{
- copy(other);
+ *impl = *other.impl;
}
OptionalBlock::OptionalBlock(OptionalBranchPtr true_)
@@ -52,15 +52,11 @@
delete impl;
}
- void OptionalBlock::operator=(const OptionalBlock& other)
+ OptionalBlock& OptionalBlock::operator=(const OptionalBlock& other)
{
- copy(other);
- }
-
- void OptionalBlock::copy(const OptionalBlock& other)
- {
- PolicyBlock::copy(other);
+ PolicyBlock::operator=(other);
*impl = *other.impl;
+ return *this;
}
struct OptionalBranchImpl { };
@@ -71,9 +67,9 @@
}
OptionalBranch::OptionalBranch(const OptionalBranch& other)
- : PolicyBranch(), impl(new OptionalBranchImpl)
+ : PolicyBranch(other), impl(new OptionalBranchImpl)
{
- copy(other);
+ *impl = *other.impl;
}
OptionalBranch::~OptionalBranch()
@@ -81,9 +77,11 @@
delete impl;
}
- void OptionalBranch::operator=(const OptionalBranch& other)
+ OptionalBranch& OptionalBranch::operator=(const OptionalBranch& other)
{
- copy(other);
+ PolicyBranch::operator=(other);
+ *impl = *other.impl;
+ return *this;
}
void OptionalBranch::do_output(std::ostream& o, const OutputFormatter& op) const
@@ -99,10 +97,4 @@
}
}
- void OptionalBranch::copy(const OptionalBranch& other)
- {
- PolicyBranch::copy(other);
- }
-
-
}
Modified: branches/policyrep/libpolicyrep/src/parse.cpp
===================================================================
--- branches/policyrep/libpolicyrep/src/parse.cpp 2008-01-28 13:45:06 UTC (rev 2768)
+++ branches/policyrep/libpolicyrep/src/parse.cpp 2008-01-28 18:46:46 UTC (rev 2769)
@@ -46,9 +46,10 @@
Parser::~Parser() { delete impl; }
- void Parser::operator=(const Parser& other)
+ Parser& Parser::operator=(const Parser& other)
{
*impl = *other.impl;
+ return *this;
}
ModulePtr Parser::parse(const std::string& f)
Modified: branches/policyrep/libpolicyrep/src/policy.cpp
===================================================================
--- branches/policyrep/libpolicyrep/src/policy.cpp 2008-01-28 13:45:06 UTC (rev 2768)
+++ branches/policyrep/libpolicyrep/src/policy.cpp 2008-01-28 18:46:46 UTC (rev 2769)
@@ -40,16 +40,18 @@
: impl(new PolicyImpl(mls)) { }
Policy::Policy(const Policy& other)
- : Parent(), impl(new PolicyImpl)
+ : Parent(other), impl(new PolicyImpl)
{
- copy(other);
+ *impl = *other.impl;
}
Policy::~Policy() { delete impl; }
- void Policy::operator=(const Policy& other)
+ Policy& Policy::operator=(const Policy& other)
{
- copy(other);
+ Parent::operator=(other);
+ *impl = *other.impl;
+ return *this;
}
bool Policy::get_mls() const
@@ -67,12 +69,6 @@
return true;
}
- void Policy::copy(const Policy& other)
- {
- Parent::copy(other);
- *impl = *other.impl;
- }
-
//
// Module
//
@@ -91,16 +87,18 @@
: impl(new ModuleImpl(name, version)) { }
Module::Module(const Module& other)
- : Parent(), impl(new ModuleImpl)
+ : Parent(other), impl(new ModuleImpl)
{
- copy(other);
+ *impl = *other.impl;
}
Module::~Module() { delete impl; }
- void Module::operator=(const Module& other)
+ Module& Module::operator=(const Module& other)
{
- copy(other);
+ Parent::operator=(other);
+ *impl = *other.impl;
+ return *this;
}
const std::string& Module::get_name() const
@@ -135,64 +133,40 @@
return true;
}
- void Module::copy(const Module& other)
- {
- Parent::copy(other);
- *impl = *other.impl;
- }
-
-
//
// InitialSid
//
struct InitialSidImpl
{
- std::string name;
};
InitialSid::InitialSid()
- : impl(new InitialSidImpl) { }
+ :Symbol(), impl(new InitialSidImpl) { }
InitialSid::InitialSid(const std::string& name)
- : impl(new InitialSidImpl)
+ :Symbol(name), impl(new InitialSidImpl)
{
- impl->name = name;
}
InitialSid::InitialSid(const InitialSid& other)
- : Node(), impl(new InitialSidImpl)
+ : Symbol(other), impl(new InitialSidImpl)
{
- copy(other);
+ *impl = *other.impl;
}
InitialSid::~InitialSid() { delete impl; }
- void InitialSid::operator=(const InitialSid& other)
+ InitialSid& InitialSid::operator=(const InitialSid& other)
{
- copy(other);
+ Symbol::operator=(other);
+ *impl = *other.impl;
+ return *this;
}
- const std::string& InitialSid::get_name() const
- {
- return impl->name;
- }
-
- void InitialSid::set_name(const std::string& name)
- {
- impl->name = name;
- }
-
void InitialSid::do_output(std::ostream& o, const OutputFormatter& op) const
{
- o << "sid " << impl->name;
+ o << "sid " << get_name();
}
- void InitialSid::copy(const InitialSid& other)
- {
- Node::copy(other);
- *impl = *other.impl;
- }
-
-
} // namespace Policyrep
Modified: branches/policyrep/libpolicyrep/src/policy_base.cpp
===================================================================
--- branches/policyrep/libpolicyrep/src/policy_base.cpp 2008-01-28 13:45:06 UTC (rev 2768)
+++ branches/policyrep/libpolicyrep/src/policy_base.cpp 2008-01-28 18:46:46 UTC (rev 2769)
@@ -99,9 +99,10 @@
delete impl;
}
- void OutputFormatter::operator=(const OutputFormatter& other)
+ OutputFormatter& OutputFormatter::operator=(const OutputFormatter& other)
{
*impl = *other.impl;
+ return *this;
}
OutputFormatter& OutputFormatter::operator()(const Node& n, bool end)
@@ -199,7 +200,7 @@
Node::Node(const Node& other)
: node_impl(new NodeImpl)
{
- copy(other);
+ *node_impl = *other.node_impl;
}
Node::~Node()
@@ -207,10 +208,11 @@
delete node_impl;
}
- void Node::operator=(const Node& other)
+ Node& Node::operator=(const Node& other)
{
std::cout << "node" << std::endl;
- copy(other);
+ *node_impl = *other.node_impl;
+ return *this;
}
void Node::set_parent(Parent* parent)
@@ -290,11 +292,6 @@
}
}
- void Node::copy(const Node& other)
- {
- *node_impl = *other.node_impl;
- }
-
//
// TreeIterator
//
@@ -342,9 +339,10 @@
delete impl;
}
- void TreeIterator::operator=(const TreeIterator& other)
+ TreeIterator& TreeIterator::operator=(const TreeIterator& other)
{
*impl = *other.impl;
+ return *this;
}
bool TreeIterator::get_visited() const
@@ -437,10 +435,10 @@
: parent_impl(new ParentImpl) { }
Parent::Parent(const Parent& other)
- : Node()
+ :Node(other)
{
parent_impl = new ParentImpl;
- copy(other);
+ *parent_impl = *other.parent_impl;
}
Parent::~Parent()
@@ -448,9 +446,11 @@
delete parent_impl;
}
- void Parent::operator=(const Parent& other)
+ Parent& Parent::operator=(const Parent& other)
{
- copy(other);
+ Node::operator=(other);
+ *parent_impl = *other.parent_impl;
+ return *this;
}
void Parent::make_child(NodePtr node)
@@ -502,12 +502,6 @@
}
- void Parent::copy(const Parent& other)
- {
- Node::copy(other);
- *parent_impl = *other.parent_impl;
- }
-
//
// PolicyBlock
//
@@ -530,9 +524,9 @@
append_child(false_);
}
- PolicyBlock::PolicyBlock(const PolicyBlock& other) : Parent(), block_impl(new PolicyBlockImpl)
+ PolicyBlock::PolicyBlock(const PolicyBlock& other) : Parent(other), block_impl(new PolicyBlockImpl)
{
- copy(other);
+ *block_impl = *other.block_impl;
}
PolicyBlock::~PolicyBlock()
@@ -540,9 +534,11 @@
delete block_impl;
}
- void PolicyBlock::operator=(const PolicyBlock& other)
+ PolicyBlock& PolicyBlock::operator=(const PolicyBlock& other)
{
- copy(other);
+ Parent::operator=(other);
+ *block_impl = *other.block_impl;
+ return *this;
}
void PolicyBlock::append_child(PolicyBranchPtr node)
@@ -621,12 +617,6 @@
return true;
}
- void PolicyBlock::copy(const PolicyBlock& other)
- {
- Parent::copy(other);
- *block_impl = *other.block_impl;
- }
-
//
// PolicyBranch
@@ -642,9 +632,9 @@
}
- PolicyBranch::PolicyBranch(const PolicyBranch& other) : Parent(), branch_impl(new PolicyBranchImpl)
+ PolicyBranch::PolicyBranch(const PolicyBranch& other) : Parent(other), branch_impl(new PolicyBranchImpl)
{
- copy(other);
+ *branch_impl = *other.branch_impl;
}
PolicyBranch::~PolicyBranch()
@@ -652,9 +642,11 @@
delete branch_impl;
}
- void PolicyBranch::operator=(const PolicyBranch& other)
+ PolicyBranch& PolicyBranch::operator=(const PolicyBranch& other)
{
- copy(other);
+ Parent::operator=(other);
+ *branch_impl = *other.branch_impl;
+ return *this;
}
void PolicyBranch::set_isfalse(bool v)
@@ -667,11 +659,4 @@
return branch_impl->isfalse;
}
- void PolicyBranch::copy(const PolicyBranch& other)
- {
- Parent::copy(other);
- *branch_impl = *other.branch_impl;
- }
-
-
} // namespace policyrep
Modified: branches/policyrep/libpolicyrep/src/policyrep_python.cpp
===================================================================
--- branches/policyrep/libpolicyrep/src/policyrep_python.cpp 2008-01-28 13:45:06 UTC (rev 2768)
+++ branches/policyrep/libpolicyrep/src/policyrep_python.cpp 2008-01-28 18:46:46 UTC (rev 2769)
@@ -58,10 +58,10 @@
//
class_<Node>("Node")
- .add_property("parent",
- make_function(&Node::get_parent,
- return_value_policy<reference_existing_object>()),
- &Node::set_parent)
+// .add_property("parent",
+// make_function(&Node::get_parent,
+// return_value_policy<reference_existing_object>()),
+// &Node::set_parent)
.add_property("visited", &Node::get_visited, &Node::set_visited)
.def("__str__", &Node::to_string)
.def("to_string_end", &Node::to_string_end)
@@ -99,20 +99,20 @@
class_<Module, bases<Parent> >("Module")
- .add_property("name",
- make_function(&Module::get_name,
- return_value_policy<copy_const_reference>()),
- &Module::set_name)
- .add_property("version", make_function(&Module::get_version,
- return_value_policy<copy_const_reference>()),
- &Module::set_version)
+// .add_property("name",
+// make_function(&Module::get_name,
+// return_value_policy<copy_const_reference>()),
+// &Module::set_name)
+// .add_property("version", make_function(&Module::get_version,
+// return_value_policy<copy_const_reference>()),
+// &Module::set_version)
;
register_ptr_to_python<ModulePtr>();
class_<InitialSid, bases<Node> >("InitialSid")
- .add_property("name", make_function(&InitialSid::get_name,
- return_value_policy<reference_existing_object>()),
- &InitialSid::set_name)
+// .add_property("name", make_function(&InitialSid::get_name,
+// return_value_policy<reference_existing_object>()),
+// &InitialSid::set_name)
;
register_ptr_to_python<InitialSidPtr>();
@@ -121,10 +121,10 @@
//
class_<Type, bases<Node> >("Type")
- .add_property("name",
- make_function(&Type::get_name,
- return_value_policy<copy_const_reference>()),
- &Type::set_name)
+// .add_property("name",
+// make_function(&Type::get_name,
+// return_value_policy<copy_const_reference>()),
+// &Type::set_name)
.add_property("aliases"
, make_function(
&Type::aliases,
@@ -139,18 +139,18 @@
register_ptr_to_python<TypePtr>();
class_<Attribute, bases<Node> >("Attribute")
- .add_property("name",
- make_function(&Attribute::get_name,
- return_value_policy<copy_const_reference>()),
- &Attribute::set_name)
+// .add_property("name",
+// make_function(&Attribute::get_name,
+// return_value_policy<copy_const_reference>()),
+// &Attribute::set_name)
;
register_ptr_to_python<AttributePtr>();
class_<TypeAttribute, bases<Node> >("TypeAttribute")
- .add_property("name",
- make_function(&TypeAttribute::get_name,
- return_value_policy<copy_const_reference>()),
- &TypeAttribute::set_name)
+// .add_property("name",
+// make_function(&TypeAttribute::get_name,
+// return_value_policy<copy_const_reference>()),
+// &TypeAttribute::set_name)
.add_property("attributes",
make_function(&TypeAttribute::attributes,
return_value_policy<reference_existing_object>()))
@@ -158,10 +158,10 @@
register_ptr_to_python<TypeAttributePtr>();
class_<TypeAlias, bases<Node> >("TypeAlias")
- .add_property("name",
- make_function(&TypeAlias::get_name,
- return_value_policy<copy_const_reference>()),
- &TypeAlias::set_name)
+// .add_property("name",
+// make_function(&TypeAlias::get_name,
+// return_value_policy<copy_const_reference>()),
+// &TypeAlias::set_name)
.add_property("aliases",
make_function(&TypeAlias::aliases,
return_value_policy<reference_existing_object>()))
@@ -176,10 +176,10 @@
//
class_<CommonPerms, bases<Node> >("CommonPerms")
- .add_property("name",
- make_function(&CommonPerms::get_name,
- return_value_policy<copy_const_reference>()),
- &CommonPerms::set_name)
+// .add_property("name",
+// make_function(&CommonPerms::get_name,
+// return_value_policy<copy_const_reference>()),
+// &CommonPerms::set_name)
.add_property("perms",
make_function(&CommonPerms::perms,
return_value_policy<reference_existing_object>()))
@@ -187,14 +187,14 @@
register_ptr_to_python<CommonPermsPtr>();
class_<ObjectClass, bases<Node> >("ObjectClass")
- .add_property("name",
- make_function(&ObjectClass::get_name,
- return_value_policy<copy_const_reference>()),
- &ObjectClass::set_name)
- .add_property("common_perms",
- make_function(&ObjectClass::get_common_perms,
- return_value_policy<copy_const_reference>()),
- &ObjectClass::set_common_perms)
+// .add_property("name",
+// make_function(&ObjectClass::get_name,
+// return_value_policy<copy_const_reference>()),
+// &ObjectClass::set_name)
+// .add_property("common_perms",
+// make_function(&ObjectClass::get_common_perms,
+// return_value_policy<copy_const_reference>()),
+// &ObjectClass::set_common_perms)
.add_property("perms",
make_function(&ObjectClass::perms,
return_value_policy<reference_existing_object>()))
Modified: branches/policyrep/libpolicyrep/src/rbac.cpp
===================================================================
--- branches/policyrep/libpolicyrep/src/rbac.cpp 2008-01-28 13:45:06 UTC (rev 2768)
+++ branches/policyrep/libpolicyrep/src/rbac.cpp 2008-01-28 18:46:46 UTC (rev 2769)
@@ -29,7 +29,6 @@
struct RoleImpl
{
- std::string name;
StringSet types;
};
@@ -38,38 +37,37 @@
impl = new RoleImpl;
}
- Role::Role() { init(); }
+ Role::Role()
+ :Symbol()
+ {
+ impl = new RoleImpl;
+ }
Role::Role(const std::string& name)
+ :Symbol(name)
{
- init();
- impl->name = name;
+ impl = new RoleImpl;
}
Role::Role(const Role& other)
- : Node()
+ :Symbol(other)
{
- init();
+ impl = new RoleImpl;
*impl = *other.impl;
}
- Role::~Role() { delete impl; }
-
- void Role::operator=(const Role& other)
+ Role::~Role()
{
- *impl = *other.impl;
+ delete impl;
}
- const std::string& Role::get_name() const
+ Role& Role::operator=(const Role& other)
{
- return impl->name;
+ Symbol::operator=(other);
+ *impl = *other.impl;
+ return *this;
}
- void Role::set_name(const std::string& name)
- {
- impl->name = name;
- }
-
StringSet& Role::types()
{
return impl->types;
@@ -77,7 +75,7 @@
void Role::do_output(std::ostream& o, const OutputFormatter& op) const
{
- o << "role " << impl->name;
+ o << "role " << get_name();
if (!impl->types.empty()) {
o << " types ";
output_set_comma(o, impl->types);
Modified: branches/policyrep/libpolicyrep/src/rule.cpp
===================================================================
--- branches/policyrep/libpolicyrep/src/rule.cpp 2008-01-28 13:45:06 UTC (rev 2768)
+++ branches/policyrep/libpolicyrep/src/rule.cpp 2008-01-28 18:46:46 UTC (rev 2769)
@@ -36,22 +36,17 @@
IdSet perms;
};
- void AVRule::init()
- {
- impl = new AVRuleImpl;
- }
-
AVRule::AVRule(Type type)
{
- init();
+ impl = new AVRuleImpl;
impl->type = type;
}
AVRule::AVRule(const AVRule& other)
- : Node()
+ :Node(other)
{
- init();
- copy(other);
+ impl = new AVRuleImpl;
+ *impl = *other.impl;
}
AVRule::~AVRule()
@@ -59,9 +54,11 @@
delete impl;
}
- void AVRule::operator=(const AVRule& other)
+ AVRule& AVRule::operator=(const AVRule& other)
{
- copy(other);
+ Node::operator=(other);
+ *impl = *other.impl;
+ return *this;
}
void AVRule::set_type(AVRule::Type type)
@@ -128,12 +125,6 @@
}
- void AVRule::copy(const AVRule& other)
- {
- Node::copy(other);
- *impl = *other.impl;
- }
-
//
// TypeRule
//
@@ -147,22 +138,17 @@
std::string target;
};
- void TypeRule::init()
- {
- impl = new TypeRuleImpl;
- }
-
TypeRule::TypeRule(Type type)
{
- init();
+ impl = new TypeRuleImpl;
impl->type = type;
}
TypeRule::TypeRule(const TypeRule& other)
- : Node()
+ :Node(other)
{
- init();
- copy(other);
+ impl = new TypeRuleImpl;
+ *impl = *other.impl;
}
TypeRule::~TypeRule()
@@ -170,9 +156,11 @@
delete impl;
}
- void TypeRule::operator=(const TypeRule& other)
+ TypeRule& TypeRule::operator=(const TypeRule& other)
{
- copy(other);
+ Node::operator=(other);
+ *impl = *other.impl;
+ return *this;
}
void TypeRule::set_type(TypeRule::Type type)
@@ -237,11 +225,4 @@
}
- void TypeRule::copy(const...
[truncated message content] |