aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-07-09 15:01:06 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-07-09 15:01:06 +0000
commit68941d5d546c407afa6bfaaf4fcc5ec198dcd023 (patch)
treefbada288ea8635ed7d930a6aea9bab6d0a1cfee7
parent305d994f62cd55fbeba135b409326714a4d28bff (diff)
downloadpaludis-68941d5d546c407afa6bfaaf4fcc5ec198dcd023.tar.gz
paludis-68941d5d546c407afa6bfaaf4fcc5ec198dcd023.tar.xz
Replace m4 voodoo with preprocessor voodoo. Improve doxygenation.
-rwxr-xr-xautogen.bash1
-rw-r--r--paludis/util/Makefile.am.m47
-rw-r--r--paludis/util/comparison_policy.hh (renamed from paludis/util/comparison_policy.hh.m4)223
3 files changed, 150 insertions, 81 deletions
diff --git a/autogen.bash b/autogen.bash
index 22ed878..e04a3d5 100755
--- a/autogen.bash
+++ b/autogen.bash
@@ -32,7 +32,6 @@ misc/do_m4.bash paludis/qa/qa.hh || exit $?
misc/do_m4.bash paludis/util/util.hh || exit $?
misc/do_m4.bash paludis/util/Makefile.am || exit $?
misc/do_m4.bash paludis/util/smart_record.hh || exit $?
-misc/do_m4.bash paludis/util/comparison_policy.hh || exit $?
misc/do_m4.bash hooks/Makefile.am || exit $?
run mkdir -p config
run $(get libtoolize 1.5 ) --copy --force --automake
diff --git a/paludis/util/Makefile.am.m4 b/paludis/util/Makefile.am.m4
index 71021e1..7b5363f 100644
--- a/paludis/util/Makefile.am.m4
+++ b/paludis/util/Makefile.am.m4
@@ -29,13 +29,13 @@ include(`paludis/util/files.m4')
CLEANFILES = *~ gmon.out *.gcov *.gcno *.gcda
MAINTAINERCLEANFILES = Makefile.in Makefile.am paludis.hh smart_record.hh \
- hashed_containers.hh comparison_policy.hh util.hh
+ hashed_containers.hh util.hh
AM_CXXFLAGS = -I$(top_srcdir)
DEFS=\
-DSYSCONFDIR=\"$(sysconfdir)\" \
-DLIBEXECDIR=\"$(libexecdir)\"
EXTRA_DIST = util.hh.m4 Makefile.am.m4 files.m4 smart_record.hh.m4 \
- comparison_policy.hh.m4 testscriptlist test_extras.cc
+ testscriptlist test_extras.cc
SUBDIRS = .
libpaludisutil_a_SOURCES = filelist
@@ -59,9 +59,6 @@ Makefile.am : Makefile.am.m4 files.m4
smart_record.hh : smart_record.hh.m4
$(top_srcdir)/misc/do_m4.bash smart_record.hh
-comparison_policy.hh : comparison_policy.hh.m4
- $(top_srcdir)/misc/do_m4.bash comparison_policy.hh
-
util.hh : util.hh.m4 files.m4
$(top_srcdir)/misc/do_m4.bash util.hh
diff --git a/paludis/util/comparison_policy.hh.m4 b/paludis/util/comparison_policy.hh
index adb0e88..31b2748 100644
--- a/paludis/util/comparison_policy.hh.m4
+++ b/paludis/util/comparison_policy.hh
@@ -1,9 +1,3 @@
-#if 0
-ifdef(`__gnu__',`',`errprint(`This is not GNU m4...
-')m4exit(1)') include(`misc/generated-file.txt')
-dnl vim: set ft=cpp et sw=4 sts=4 :
-#endif
-
/*
* Copyright (c) 2005, 2006 Ciaran McCreesh <ciaran.mccreesh@blueyonder.co.uk>
*
@@ -133,6 +127,9 @@ namespace paludis
class ComparisonPolicy<OurType_, comparison_mode::NoComparisonTag, ComparisonMethodTag_>
{
public:
+ ///\name Comparison policy tags
+ ///\{
+
/// Our comparison mode.
typedef comparison_mode::NoComparisonTag ComparisonPolicyModeTag;
@@ -141,6 +138,8 @@ namespace paludis
/// Our comparison policy.
typedef ComparisonPolicy<OurType_, ComparisonPolicyModeTag, ComparisonPolicyMethodTag> ComparisonPolicyType;
+
+ ///\}
};
/**
@@ -157,6 +156,9 @@ namespace paludis
const MemberType_ OurType_::* const _v;
public:
+ ///\name Comparison policy tags
+ ///\{
+
/// Our comparison mode.
typedef comparison_mode::EqualityComparisonTag ComparisonPolicyModeTag;
@@ -166,28 +168,38 @@ namespace paludis
/// Our comparison policy.
typedef ComparisonPolicy<OurType_, ComparisonPolicyModeTag, ComparisonPolicyMethodTag> ComparisonPolicyType;
- /// Constructor.
+ ///\}
+
+ ///\name Basic operations
+ ///\{
+
ComparisonPolicy(const MemberType_ OurType_::* const v) :
_v(v)
{
}
- /// Copy constructor.
ComparisonPolicy(const ComparisonPolicy & other) :
_v(other._v)
{
}
-define(`make_operator', `
- /// $1 operator.
- bool operator$1 (const OurType_ & other) const
- {
- return static_cast<const OurType_ *>(this)->*_v $1 other.*(
- (static_cast<const ComparisonPolicyType *>(&other))->_v);
+ ///\}
+
+ ///\name Comparison operators
+ ///\{
+
+#undef PALUDIS_COMPARISON_POLICY_MAKE_OPERATOR
+#define PALUDIS_COMPARISON_POLICY_MAKE_OPERATOR(op) \
+ bool operator op (const OurType_ & other) const \
+ { \
+ return static_cast<const OurType_ *>(this)->*_v op other.*( \
+ (static_cast<const ComparisonPolicyType *>(&other))->_v); \
}
-')
-make_operator(`==')
-make_operator(`!=')
+
+ PALUDIS_COMPARISON_POLICY_MAKE_OPERATOR(==)
+ PALUDIS_COMPARISON_POLICY_MAKE_OPERATOR(!=)
+
+ ///\}
};
@@ -205,6 +217,9 @@ make_operator(`!=')
bool (OurType_::* const _v)(const OurType_ &) const;
public:
+ ///\name Comparison policy tags
+ ///\{
+
/// Our comparison mode.
typedef comparison_mode::EqualityComparisonTag ComparisonPolicyModeTag;
@@ -214,29 +229,37 @@ make_operator(`!=')
/// Our comparison policy.
typedef ComparisonPolicy<OurType_, ComparisonPolicyModeTag, ComparisonPolicyMethodTag> ComparisonPolicyType;
- /// Constructor.
+ ///\}
+
+ ///\name Basic operations
+ ///\{
+
ComparisonPolicy(bool (OurType_::* const v)(const OurType_ &) const) :
_v(v)
{
}
- /// Copy constructor.
ComparisonPolicy(const ComparisonPolicy & other) :
_v(other._v)
{
}
- /// Equal operator.
+ ///\}
+
+ ///\name Comparison operators
+ ///\{
+
bool operator== (const OurType_ & other) const
{
return (static_cast<const OurType_ *>(this)->*_v)(other);
}
- /// Not equal operator.
bool operator!= (const OurType_ & other) const
{
return ! (static_cast<const OurType_ *>(this)->*_v)(other);
}
+
+ ///\}
};
/**
@@ -253,6 +276,9 @@ make_operator(`!=')
const MemberType_ OurType_::* const _v;
public:
+ ///\name Comparison policy tags
+ ///\{
+
/// Our comparison mode.
typedef comparison_mode::FullComparisonTag ComparisonPolicyModeTag;
@@ -262,33 +288,42 @@ make_operator(`!=')
/// Our comparison policy.
typedef ComparisonPolicy<OurType_, ComparisonPolicyModeTag, ComparisonPolicyMethodTag> ComparisonPolicyType;
- /// Constructor.
+ ///\}
+
+ ///\name Basic operations
+ ///\{
+
ComparisonPolicy(const MemberType_ OurType_::* const v) :
_v(v)
{
}
- /// Copy constructor.
ComparisonPolicy(const ComparisonPolicy & other) :
_v(other._v)
{
}
-define(`make_operator', `
- /// $1 operator.
- bool operator$1 (const OurType_ & other) const
- {
- return static_cast<const OurType_ *>(this)->*_v $1 other.*(
- (static_cast<const ComparisonPolicyType *>(&other))->_v);
+ ///\}
+
+ ///\name Comparison operators
+ ///\{
+
+#undef PALUDIS_COMPARISON_POLICY_MAKE_OPERATOR
+#define PALUDIS_COMPARISON_POLICY_MAKE_OPERATOR(op) \
+ bool operator op (const OurType_ & other) const \
+ { \
+ return static_cast<const OurType_ *>(this)->*_v op other.*( \
+ (static_cast<const ComparisonPolicyType *>(&other))->_v); \
}
-')
-make_operator(`==')
-make_operator(`!=')
-make_operator(`<=')
-make_operator(`>=')
-make_operator(`<')
-make_operator(`>')
+ PALUDIS_COMPARISON_POLICY_MAKE_OPERATOR(==)
+ PALUDIS_COMPARISON_POLICY_MAKE_OPERATOR(!=)
+ PALUDIS_COMPARISON_POLICY_MAKE_OPERATOR(<=)
+ PALUDIS_COMPARISON_POLICY_MAKE_OPERATOR(>=)
+ PALUDIS_COMPARISON_POLICY_MAKE_OPERATOR(<)
+ PALUDIS_COMPARISON_POLICY_MAKE_OPERATOR(>)
+
+ ///\}
};
/**
@@ -305,6 +340,9 @@ make_operator(`>')
int (OurType_::* const _v)(const OurType_ &) const;
public:
+ ///\name Comparison policy tags
+ //\{
+
/// Our comparison mode.
typedef comparison_mode::FullComparisonTag ComparisonPolicyModeTag;
@@ -314,32 +352,41 @@ make_operator(`>')
/// Our comparison policy.
typedef ComparisonPolicy<OurType_, ComparisonPolicyModeTag, ComparisonPolicyMethodTag> ComparisonPolicyType;
- /// Constructor.
+ ///\}
+
+ ///\name Basic operations
+ ///\{
+
ComparisonPolicy(int (OurType_::* v)(const OurType_ &) const) :
_v(v)
{
}
- /// Copy constructor.
ComparisonPolicy(const ComparisonPolicy & other) :
_v(other._v)
{
}
-define(`make_operator', `
- /// $1 operator.
- bool operator$1 (const OurType_ & other) const
- {
- return (static_cast<const OurType_ *>(this)->*_v)(other) $1 0;
+ ///\}
+
+ ///\name Comparison operators
+ ///\{
+
+#undef PALUDIS_COMPARISON_POLICY_MAKE_OPERATOR
+#define PALUDIS_COMPARISON_POLICY_MAKE_OPERATOR(op) \
+ bool operator op (const OurType_ & other) const \
+ { \
+ return (static_cast<const OurType_ *>(this)->*_v)(other) op 0; \
}
-')
-make_operator(`==')
-make_operator(`!=')
-make_operator(`<=')
-make_operator(`>=')
-make_operator(`<')
-make_operator(`>')
+ PALUDIS_COMPARISON_POLICY_MAKE_OPERATOR(==)
+ PALUDIS_COMPARISON_POLICY_MAKE_OPERATOR(!=)
+ PALUDIS_COMPARISON_POLICY_MAKE_OPERATOR(<=)
+ PALUDIS_COMPARISON_POLICY_MAKE_OPERATOR(>=)
+ PALUDIS_COMPARISON_POLICY_MAKE_OPERATOR(<)
+ PALUDIS_COMPARISON_POLICY_MAKE_OPERATOR(>)
+
+ ///\}
};
/**
@@ -356,6 +403,9 @@ make_operator(`>')
MemberType_ (OurType_::* const _v)() const;
public:
+ ///\name Comparison policy tags
+ ///\{
+
/// Our comparison mode.
typedef comparison_mode::EqualityComparisonTag ComparisonPolicyModeTag;
@@ -365,27 +415,37 @@ make_operator(`>')
/// Our comparison policy.
typedef ComparisonPolicy<OurType_, ComparisonPolicyModeTag, ComparisonPolicyMethodTag> ComparisonPolicyType;
- /// Constructor.
+ ///\}
+
+ ///\name Basic operations
+ ///\{
+
ComparisonPolicy(MemberType_ (OurType_::* const v)() const) :
_v(v)
{
}
- /// Copy constructor.
ComparisonPolicy(const ComparisonPolicy & other) :
_v(other._v)
{
}
-define(`make_operator', `
- /// $1 operator.
- bool operator$1 (const OurType_ & other) const
- {
- return (static_cast<const OurType_ *>(this)->*_v)() $1 (other.*other._v)();
+ ///\}
+
+ ///\name Comparison operators
+ ///\{
+
+#undef PALUDIS_COMPARISON_POLICY_MAKE_OPERATOR
+#define PALUDIS_COMPARISON_POLICY_MAKE_OPERATOR(op) \
+ bool operator op (const OurType_ & other) const \
+ { \
+ return (static_cast<const OurType_ *>(this)->*_v)() op (other.*other._v)(); \
}
-')
-make_operator(`==')
-make_operator(`!=')
+
+ PALUDIS_COMPARISON_POLICY_MAKE_OPERATOR(==)
+ PALUDIS_COMPARISON_POLICY_MAKE_OPERATOR(!=)
+
+ ///\}
};
/**
@@ -402,6 +462,9 @@ make_operator(`!=')
MemberType_ (OurType_::* const _v)() const;
public:
+ ///\name Comparison policy tags
+ ///\{
+
/// Our comparison mode.
typedef comparison_mode::FullComparisonTag ComparisonPolicyModeTag;
@@ -411,34 +474,44 @@ make_operator(`!=')
/// Our comparison policy.
typedef ComparisonPolicy<OurType_, ComparisonPolicyModeTag, ComparisonPolicyMethodTag> ComparisonPolicyType;
- /// Constructor.
+ ///\}
+
+ ///\name Basic operations
+ ///\{
+
ComparisonPolicy(MemberType_ (OurType_::* const v)() const) :
_v(v)
{
}
- /// Copy constructor.
ComparisonPolicy(const ComparisonPolicy & other) :
_v(other._v)
{
}
-define(`make_operator', `
- /// $1 operator.
- bool operator$1 (const OurType_ & other) const
- {
- return ((static_cast<const OurType_ *>(this)->*_v)()) $1
- ((other.*(static_cast<const OurType_ *>(&other)->_v))());
+ ///\}
+
+ ///\name Comparison operators
+ ///\{
+
+#undef PALUDIS_COMPARISON_POLICY_MAKE_OPERATOR
+#define PALUDIS_COMPARISON_POLICY_MAKE_OPERATOR(op) \
+ bool operator op (const OurType_ & other) const \
+ { \
+ return ((static_cast<const OurType_ *>(this)->*_v)()) op \
+ ((other.*(static_cast<const OurType_ *>(&other)->_v))()); \
}
-')
-make_operator(`==')
-make_operator(`!=')
-make_operator(`>=')
-make_operator(`<=')
-make_operator(`>')
-make_operator(`<')
+ PALUDIS_COMPARISON_POLICY_MAKE_OPERATOR(==)
+ PALUDIS_COMPARISON_POLICY_MAKE_OPERATOR(!=)
+ PALUDIS_COMPARISON_POLICY_MAKE_OPERATOR(<=)
+ PALUDIS_COMPARISON_POLICY_MAKE_OPERATOR(>=)
+ PALUDIS_COMPARISON_POLICY_MAKE_OPERATOR(<)
+ PALUDIS_COMPARISON_POLICY_MAKE_OPERATOR(>)
+
+ ///\}
};
}
#endif
+