aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Piotr Jaroszyński <peper@gentoo.org> 2007-04-28 12:55:20 +0000
committerAvatar Piotr Jaroszyński <peper@gentoo.org> 2007-04-28 12:55:20 +0000
commit9dba31b07f8ba8f8018bfdeb392000d4ea88fd1d (patch)
treee813f1978d1708fdf1f1af6e35e3919ea2cf0368
parent87c9eb30b5bedb7fec2b8a3c5eb0ebed4468e888 (diff)
downloadpaludis-9dba31b07f8ba8f8018bfdeb392000d4ea88fd1d.tar.gz
paludis-9dba31b07f8ba8f8018bfdeb392000d4ea88fd1d.tar.xz
Change UseFlagState, VersionOperatorValue and LogContext to smart enums.
-rw-r--r--paludis/environment_implementation.cc3
-rw-r--r--paludis/environments/adapted/adapted_environment.cc3
-rw-r--r--paludis/environments/paludis/paludis_environment.cc6
-rw-r--r--paludis/environments/portage/portage_environment.cc3
-rw-r--r--paludis/files.m44
-rw-r--r--paludis/match_package.cc3
-rw-r--r--paludis/name.cc1
-rw-r--r--paludis/name.hh12
-rw-r--r--paludis/name.se19
-rw-r--r--paludis/util/files.m42
-rw-r--r--paludis/util/log.cc2
-rw-r--r--paludis/util/log.hh12
-rw-r--r--paludis/util/log.se18
-rw-r--r--paludis/version_operator.cc2
-rw-r--r--paludis/version_operator.hh18
-rw-r--r--paludis/version_operator.se24
16 files changed, 90 insertions, 42 deletions
diff --git a/paludis/environment_implementation.cc b/paludis/environment_implementation.cc
index 141864e..bdf4946 100644
--- a/paludis/environment_implementation.cc
+++ b/paludis/environment_implementation.cc
@@ -392,6 +392,9 @@ EnvironmentImplementation::query_use(const UseFlagName & f, const PackageDatabas
case use_enabled:
return true;
+
+ case last_use:
+ ;
}
throw InternalError(PALUDIS_HERE, "bad state");
diff --git a/paludis/environments/adapted/adapted_environment.cc b/paludis/environments/adapted/adapted_environment.cc
index afb9183..dba2c22 100644
--- a/paludis/environments/adapted/adapted_environment.cc
+++ b/paludis/environments/adapted/adapted_environment.cc
@@ -94,6 +94,9 @@ AdaptedEnvironment::query_use(const UseFlagName & u, const PackageDatabaseEntry
case use_unspecified:
return _imp->env->query_use(u, e);
+
+ case last_use:
+ ;
}
throw InternalError(PALUDIS_HERE, "Bad state");
diff --git a/paludis/environments/paludis/paludis_environment.cc b/paludis/environments/paludis/paludis_environment.cc
index eee556e..ced42a9 100644
--- a/paludis/environments/paludis/paludis_environment.cc
+++ b/paludis/environments/paludis/paludis_environment.cc
@@ -169,6 +169,9 @@ PaludisEnvironment::query_use(const UseFlagName & f, const PackageDatabaseEntry
case use_unspecified:
continue;
+
+ case last_use:
+ ;
}
throw InternalError(PALUDIS_HERE, "bad state");
} while (false);
@@ -184,6 +187,9 @@ PaludisEnvironment::query_use(const UseFlagName & f, const PackageDatabaseEntry
case use_enabled:
return true;
+
+ case last_use:
+ ;
}
throw InternalError(PALUDIS_HERE, "bad state");
diff --git a/paludis/environments/portage/portage_environment.cc b/paludis/environments/portage/portage_environment.cc
index 7714f79..ce88c3d 100644
--- a/paludis/environments/portage/portage_environment.cc
+++ b/paludis/environments/portage/portage_environment.cc
@@ -456,6 +456,9 @@ PortageEnvironment::query_use(const UseFlagName & f, const PackageDatabaseEntry
case use_enabled:
return true;
+
+ case last_use:
+ ;
}
throw InternalError(PALUDIS_HERE, "bad state");
diff --git a/paludis/files.m4 b/paludis/files.m4
index 9131ee8..4bf2fdc 100644
--- a/paludis/files.m4
+++ b/paludis/files.m4
@@ -23,7 +23,7 @@ add(`hooker', `hh', `cc', `test', `testscript')
add(`host_tuple_name', `hh', `cc', `sr', `test')
add(`mask_reasons', `hh', `cc', `se')
add(`match_package', `hh', `cc')
-add(`name', `hh', `cc', `test', `sr')
+add(`name', `hh', `cc', `test', `sr', `se')
add(`package_database', `hh', `cc', `test')
add(`package_database_entry', `hh', `cc', `sr')
add(`paludis', `hh', `cc')
@@ -35,7 +35,7 @@ add(`repository_name_cache', `hh', `cc', `test', `testscript')
add(`set_file', `hh', `cc', `se', `sr', `test', `testscript')
add(`syncer', `hh', `cc', `sr')
add(`version_metadata', `hh', `cc', `sr')
-add(`version_operator', `hh', `cc', `test')
+add(`version_operator', `hh', `cc', `se', `test')
add(`version_requirements', `hh', `cc', `sr')
add(`version_spec', `hh', `cc', `sr', `test')
diff --git a/paludis/match_package.cc b/paludis/match_package.cc
index c2eaeb6..890a2e1 100644
--- a/paludis/match_package.cc
+++ b/paludis/match_package.cc
@@ -103,6 +103,9 @@ paludis::match_package(
if (env.query_use(u->first, entry))
return false;
continue;
+
+ case last_use:
+ ;
}
throw InternalError(PALUDIS_HERE, "bad UseFlagState");
}
diff --git a/paludis/name.cc b/paludis/name.cc
index b0e9436..c6b3f3c 100644
--- a/paludis/name.cc
+++ b/paludis/name.cc
@@ -31,6 +31,7 @@
using namespace paludis;
#include <paludis/name-sr.cc>
+#include <paludis/name-se.cc>
QualifiedPackageNameError::QualifiedPackageNameError(const std::string & s) throw () :
NameError(s, "qualified package name")
diff --git a/paludis/name.hh b/paludis/name.hh
index 6cc6179..fe313b5 100644
--- a/paludis/name.hh
+++ b/paludis/name.hh
@@ -370,17 +370,7 @@ namespace paludis
*/
typedef SortedCollection<KeywordName> KeywordNameCollection;
- /**
- * A USE flag can be on, off or unspecified.
- *
- * \ingroup grpnames
- */
- enum UseFlagState
- {
- use_unspecified, /// unspecified
- use_disabled, /// disabled
- use_enabled /// enabled
- };
+#include <paludis/name-se.hh>
/**
* A SetNameValidator handles validation rules for the value of a
diff --git a/paludis/name.se b/paludis/name.se
new file mode 100644
index 0000000..4daad11
--- /dev/null
+++ b/paludis/name.se
@@ -0,0 +1,19 @@
+#!/bin/bash
+# vim: set sw=4 sts=4 et ft=sh :
+
+make_enum_UseFlagState()
+{
+ prefix use
+
+ key use_unspecified "unspecified"
+ key use_disabled "disabled"
+ key use_enabled "enabled"
+
+ doxygen_comment << "END"
+ /**
+ * A USE flag can be on, off or unspecified.
+ *
+ * \ingroup grpnames
+ */
+END
+}
diff --git a/paludis/util/files.m4 b/paludis/util/files.m4
index d3a84f4..f95a557 100644
--- a/paludis/util/files.m4
+++ b/paludis/util/files.m4
@@ -25,7 +25,7 @@ add(`iterator', `hh', `test')
add(`instantiation_policy', `hh', `test')
add(`is_file_with_extension', `hh', `cc', `se', `test', `testscript')
add(`join', `hh', `test')
-add(`log', `hh', `cc', `test')
+add(`log', `hh', `cc', `se', `test')
add(`options', `hh', `cc', `test')
add(`pipe', `hh', `cc')
add(`private_implementation_pattern', `hh')
diff --git a/paludis/util/log.cc b/paludis/util/log.cc
index 1b59d0b..5cfda2d 100644
--- a/paludis/util/log.cc
+++ b/paludis/util/log.cc
@@ -29,6 +29,8 @@
using namespace paludis;
+#include <paludis/util/log-se.cc>
+
namespace paludis
{
/**
diff --git a/paludis/util/log.hh b/paludis/util/log.hh
index 6fdd60d..74fb517 100644
--- a/paludis/util/log.hh
+++ b/paludis/util/log.hh
@@ -54,17 +54,7 @@ namespace paludis
initial_ll = ll_debug ///< Initial value
};
- /**
- * Specifies whether a log message has context.
- *
- * \ingroup grplog
- */
- enum LogContext
- {
- lc_no_context,
- lc_context,
- last_lc
- };
+#include <paludis/util/log-se.hh>
class LogMessageHandler;
diff --git a/paludis/util/log.se b/paludis/util/log.se
new file mode 100644
index 0000000..ea0c869
--- /dev/null
+++ b/paludis/util/log.se
@@ -0,0 +1,18 @@
+#!/bin/bash
+# vim: set sw=4 sts=4 et ft=sh :
+
+make_enum_LogContext()
+{
+ prefix lc
+
+ key lc_no_context "No context"
+ key lc_context "Context"
+
+ doxygen_comment << "END"
+ /**
+ * Specifies whether a log message has context.
+ *
+ * \ingroup grplog
+ */
+END
+}
diff --git a/paludis/version_operator.cc b/paludis/version_operator.cc
index 74cd58d..a10ea7d 100644
--- a/paludis/version_operator.cc
+++ b/paludis/version_operator.cc
@@ -29,6 +29,8 @@
using namespace paludis;
+#include <paludis/version_operator-se.cc>
+
VersionOperatorValue
VersionOperator::_decode(const std::string & v)
{
diff --git a/paludis/version_operator.hh b/paludis/version_operator.hh
index d2ce91d..e7d9174 100644
--- a/paludis/version_operator.hh
+++ b/paludis/version_operator.hh
@@ -36,23 +36,7 @@ namespace paludis
{
class VersionSpec;
- /**
- * Represents an operator attached to a VersionSpec.
- *
- * \ingroup grpversions
- */
- enum VersionOperatorValue
- {
- vo_less_equal, ///< <= dependency
- vo_less, ///< < dependency
- vo_equal, ///< = dependency
- vo_tilde, ///< ~ dependency
- vo_greater, ///< > dependency
- vo_greater_equal, ///< >= dependency
- vo_equal_star, ///< =* dependency
- vo_tilde_greater, ///< ~> dependency (gems)
- last_vo ///< number of items
- };
+#include <paludis/version_operator-se.hh>
/**
* An operator attached to a VersionSpec, validated.
diff --git a/paludis/version_operator.se b/paludis/version_operator.se
new file mode 100644
index 0000000..a6e0137
--- /dev/null
+++ b/paludis/version_operator.se
@@ -0,0 +1,24 @@
+#!/bin/bash
+# vim: set sw=4 sts=4 et ft=sh :
+
+make_enum_VersionOperatorValue()
+{
+ prefix vo
+
+ key vo_less_equal "<= dependency"
+ key vo_less "< dependency"
+ key vo_equal "= dependency"
+ key vo_tilde "~ dependency"
+ key vo_greater "> dependency"
+ key vo_greater_equal ">= dependency"
+ key vo_equal_star "=* dependency"
+ key vo_tilde_greater "~> dependency (gems)"
+
+ doxygen_comment << "END"
+ /**
+ * Represents an operator attached to a VersionSpec.
+ *
+ * \ingroup grpversions
+ */
+END
+}