aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-01-21 18:07:15 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-01-21 18:07:15 +0000
commit046afbcd3aa18ba6b7546bed5de1686b9a1513ae (patch)
tree9000d003fdbab7aa1bb0b1558caf56aba2bf5b22
parent7bd6aec3d95aa387f92a59dedb021d4357cd7927 (diff)
downloadpaludis-046afbcd3aa18ba6b7546bed5de1686b9a1513ae.tar.gz
paludis-046afbcd3aa18ba6b7546bed5de1686b9a1513ae.tar.xz
Merge repository_name_validator, repository_name_error into repository_name. Separate files are overkill here.
-rw-r--r--paludis/files.m42
-rw-r--r--paludis/repository_name.cc23
-rw-r--r--paludis/repository_name.hh38
-rw-r--r--paludis/repository_name_error.cc28
-rw-r--r--paludis/repository_name_error.hh53
-rw-r--r--paludis/repository_name_validator.cc40
-rw-r--r--paludis/repository_name_validator.hh51
7 files changed, 59 insertions, 176 deletions
diff --git a/paludis/files.m4 b/paludis/files.m4
index e8493c7..609d365 100644
--- a/paludis/files.m4
+++ b/paludis/files.m4
@@ -98,8 +98,6 @@ add(`qualified_package_name_error', `hh', `cc')
add(`repository', `hh', `cc')
add(`repository_name', `hh', `cc')
add(`repository_name_collection', `hh', `cc')
-add(`repository_name_error', `hh', `cc')
-add(`repository_name_validator', `hh', `cc')
add(`save', `hh', `cc', `test')
add(`sequential_collection', `hh', `cc')
add(`smart_record', `hh', `cc', `test')
diff --git a/paludis/repository_name.cc b/paludis/repository_name.cc
index bc15e15..e9e2b6c 100644
--- a/paludis/repository_name.cc
+++ b/paludis/repository_name.cc
@@ -19,3 +19,26 @@
#include "repository_name.hh"
+using namespace paludis;
+
+void
+RepositoryNameValidator::validate(const std::string & s)
+{
+ do
+ {
+ if (s.empty())
+ break;
+
+ return;
+
+ } while (false);
+
+ Context c("When validating repository name '" + s + "':");
+ throw RepositoryNameError(s);
+}
+
+RepositoryNameError::RepositoryNameError(const std::string & name) throw () :
+ NameError(name, "repository")
+{
+}
+
diff --git a/paludis/repository_name.hh b/paludis/repository_name.hh
index aff7a2b..937968f 100644
--- a/paludis/repository_name.hh
+++ b/paludis/repository_name.hh
@@ -21,18 +21,52 @@
#define PALUDIS_GUARD_PALUDIS_REPOSITORY_NAME_HH 1
#include <paludis/validated.hh>
-#include <paludis/repository_name_validator.hh>
+#include <paludis/private_implementation_pattern.hh>
+#include <paludis/name_error.hh>
#include <string>
/** \file
- * Declaration for the RepositoryName class.
+ * Declaration for RepositoryName and related classes.
*
* \ingroup Database
+ * \ingroup Exception
*/
namespace paludis
{
/**
+ * A RepositoryNameError is thrown if an invalid value is assigned to
+ * a RepositoryName.
+ *
+ * \ingroup Exception
+ * \ingroup Database
+ */
+ class RepositoryNameError : public NameError
+ {
+ public:
+ /**
+ * Constructor.
+ */
+ RepositoryNameError(const std::string & name) throw ();
+ };
+
+ /**
+ * A RepositoryNameValidator handles validation rules for the value
+ * of a RepositoryName.
+ *
+ * \ingroup Database
+ */
+ struct RepositoryNameValidator :
+ private InstantiationPolicy<RepositoryNameValidator, instantiation_method::NonInstantiableTag>
+ {
+ /**
+ * If the parameter is not a valid value for a RepositoryName,
+ * throw a RepositoryNameError.
+ */
+ static void validate(const std::string &);
+ };
+
+ /**
* A RepositoryNamePart holds a std::string that is a valid name for a
* Repository.
*
diff --git a/paludis/repository_name_error.cc b/paludis/repository_name_error.cc
deleted file mode 100644
index 0b13811..0000000
--- a/paludis/repository_name_error.cc
+++ /dev/null
@@ -1,28 +0,0 @@
-/* vim: set sw=4 sts=4 et foldmethod=syntax : */
-
-/*
- * Copyright (c) 2005, 2006 Ciaran McCreesh <ciaranm@gentoo.org>
- *
- * This file is part of the Paludis package manager. Paludis is free software;
- * you can redistribute it and/or modify it under the terms of the GNU General
- * Public License version 2, as published by the Free Software Foundation.
- *
- * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
- * details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
- * Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#include "repository_name_error.hh"
-
-using namespace paludis;
-
-RepositoryNameError::RepositoryNameError(const std::string & name) throw () :
- NameError(name, "repository")
-{
-}
-
diff --git a/paludis/repository_name_error.hh b/paludis/repository_name_error.hh
deleted file mode 100644
index ae03ac5..0000000
--- a/paludis/repository_name_error.hh
+++ /dev/null
@@ -1,53 +0,0 @@
-/* vim: set sw=4 sts=4 et foldmethod=syntax : */
-
-/*
- * Copyright (c) 2005, 2006 Ciaran McCreesh <ciaranm@gentoo.org>
- *
- * This file is part of the Paludis package manager. Paludis is free software;
- * you can redistribute it and/or modify it under the terms of the GNU General
- * Public License version 2, as published by the Free Software Foundation.
- *
- * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
- * details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
- * Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#ifndef PALUDIS_GUARD_PALUDIS_REPOSITORY_NAME_ERROR_HH
-#define PALUDIS_GUARD_PALUDIS_REPOSITORY_NAME_ERROR_HH 1
-
-#include <paludis/name_error.hh>
-#include <string>
-
-/** \file
- * Declaration for the RepositoryNameError exception.
- *
- * \ingroup Exception
- * \ingroup Database
- */
-
-namespace paludis
-{
- /**
- * A RepositoryNameError is thrown if an invalid value is assigned to
- * a RepositoryName.
- *
- * \ingroup Exception
- * \ingroup Database
- */
- class RepositoryNameError : public NameError
- {
- public:
- /**
- * Constructor.
- */
- RepositoryNameError(const std::string & name) throw ();
- };
-}
-
-
-#endif
diff --git a/paludis/repository_name_validator.cc b/paludis/repository_name_validator.cc
deleted file mode 100644
index a1acd99..0000000
--- a/paludis/repository_name_validator.cc
+++ /dev/null
@@ -1,40 +0,0 @@
-/* vim: set sw=4 sts=4 et foldmethod=syntax : */
-
-/*
- * Copyright (c) 2005, 2006 Ciaran McCreesh <ciaranm@gentoo.org>
- *
- * This file is part of the Paludis package manager. Paludis is free software;
- * you can redistribute it and/or modify it under the terms of the GNU General
- * Public License version 2, as published by the Free Software Foundation.
- *
- * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
- * details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
- * Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#include "repository_name_validator.hh"
-#include "repository_name_error.hh"
-
-using namespace paludis;
-
-void
-RepositoryNameValidator::validate(const std::string & s)
-{
- do
- {
- if (s.empty())
- break;
-
- return;
-
- } while (false);
-
- Context c("When validating repository name '" + s + "':");
- throw RepositoryNameError(s);
-}
-
diff --git a/paludis/repository_name_validator.hh b/paludis/repository_name_validator.hh
deleted file mode 100644
index 9d2e562..0000000
--- a/paludis/repository_name_validator.hh
+++ /dev/null
@@ -1,51 +0,0 @@
-/* vim: set sw=4 sts=4 et foldmethod=syntax : */
-
-/*
- * Copyright (c) 2005, 2006 Ciaran McCreesh <ciaranm@gentoo.org>
- *
- * This file is part of the Paludis package manager. Paludis is free software;
- * you can redistribute it and/or modify it under the terms of the GNU General
- * Public License version 2, as published by the Free Software Foundation.
- *
- * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
- * details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
- * Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#ifndef PALUDIS_GUARD_PALUDIS_REPOSITORY_NAME_VALIDATOR_HH
-#define PALUDIS_GUARD_PALUDIS_REPOSITORY_NAME_VALIDATOR_HH 1
-
-#include <string>
-#include <paludis/instantiation_policy.hh>
-
-/** \file
- * Declaration for the RepositoryNameValidator class.
- *
- * \ingroup Database
- */
-
-namespace paludis
-{
- /**
- * A RepositoryNameValidator handles validation rules for the value
- * of a RepositoryName.
- *
- * \ingroup Database
- */
- struct RepositoryNameValidator :
- private InstantiationPolicy<RepositoryNameValidator, instantiation_method::NonInstantiableTag>
- {
- /**
- * If the parameter is not a valid value for a RepositoryName,
- * throw a RepositoryNameError.
- */
- static void validate(const std::string &);
- };
-}
-
-#endif