last-svn-commit-276-g19e5634 Use package metadata macros instead of hard-coded strings in I/Os.

* mln/io/fld/write_header.hh (mln::io::fld::write_header) * mln/io/off/save.hh (mln::io::off::internal::off_saver<I, E>::operator()) * mln/io/pnm/save_header.hh (mln::io::pnm::save_header) * mln/io/vtk/save.hh (mln::io::vtk::internal::vtk_saver<I, E>::operator()): Here. * mln/version.hh.in (OLN_PACKAGE_URL, OLN_PACKAGE_AUTHORS): New macros. --- milena/ChangeLog | 14 ++++++++++++++ milena/mln/io/fld/write_header.hh | 9 ++++++--- milena/mln/io/off/save.hh | 9 ++++++--- milena/mln/io/pnm/save_header.hh | 10 +++++++--- milena/mln/io/vtk/save.hh | 3 ++- milena/mln/version.hh.in | 6 ++++++ 6 files changed, 41 insertions(+), 10 deletions(-) diff --git a/milena/ChangeLog b/milena/ChangeLog index 5b3737b..cebc7f6 100644 --- a/milena/ChangeLog +++ b/milena/ChangeLog @@ -1,5 +1,19 @@ 2011-07-11 Roland Levillain <roland@lrde.epita.fr> + Use package metadata macros instead of hard-coded strings in I/Os. + + * mln/io/fld/write_header.hh (mln::io::fld::write_header) + * mln/io/off/save.hh + (mln::io::off::internal::off_saver<I, E>::operator()) + * mln/io/pnm/save_header.hh (mln::io::pnm::save_header) + * mln/io/vtk/save.hh + (mln::io::vtk::internal::vtk_saver<I, E>::operator()): + Here. + * mln/version.hh.in (OLN_PACKAGE_URL, OLN_PACKAGE_AUTHORS): + New macros. + +2011-07-11 Roland Levillain <roland@lrde.epita.fr> + No longer consider mln/version.hh.in as handled by autoheader. * mln/version.hh.in (OLN_PACKAGE_BUGREPORT, OLN_PACKAGE_NAME) diff --git a/milena/mln/io/fld/write_header.hh b/milena/mln/io/fld/write_header.hh index c803528..d49ac13 100644 --- a/milena/mln/io/fld/write_header.hh +++ b/milena/mln/io/fld/write_header.hh @@ -1,4 +1,4 @@ -// Copyright (C) 2008, 2009, 2010 EPITA Research and Development +// Copyright (C) 2008, 2009, 2010, 2011 EPITA Research and Development // Laboratory (LRDE) // // This file is part of Olena. @@ -34,8 +34,10 @@ # include <iostream> +# include <mln/version.hh> # include <mln/io/fld/header.hh> + namespace mln { @@ -58,8 +60,9 @@ namespace mln write_header(std::ostream& file, const fld_header& h) { file << "# AVS field file" << std::endl; - file << "# Generated by Milena 1.0 http://olena.lrde.epita.fr" << std::endl; - file << "# EPITA Research and Development Laboratory (LRDE)" << std::endl; + file << "# Generated by " OLN_PACKAGE_STRING " (" OLN_PACKAGE_URL ")" + << std::endl + << "# " OLN_PACKAGE_AUTHORS << std::endl; file << "ndim=" << h.ndim << std::endl; for (int i = 0; i < h.ndim; i++) diff --git a/milena/mln/io/off/save.hh b/milena/mln/io/off/save.hh index 1ec747d..ba50d6b 100644 --- a/milena/mln/io/off/save.hh +++ b/milena/mln/io/off/save.hh @@ -1,4 +1,5 @@ -// Copyright (C) 2008, 2009 EPITA Research and Development Laboratory (LRDE) +// Copyright (C) 2008, 2009, 2011 EPITA Research and Development +// Laboratory (LRDE) // // This file is part of Olena. // @@ -40,6 +41,7 @@ # include <string> +# include <mln/version.hh> # include <mln/core/alias/complex_image.hh> # include <mln/core/image/complex_neighborhoods.hh> # include <mln/core/image/complex_neighborhood_piter.hh> @@ -247,8 +249,9 @@ namespace mln ostr << "OFF" << std::endl; // A comment. - ostr << "# Generated by Milena 1.0 http://olena.lrde.epita.fr\n" - << "# EPITA Research and Development Laboratory (LRDE)" + ostr << "# Generated by " OLN_PACKAGE_STRING " (" OLN_PACKAGE_URL ")" + << std::endl + << "# " OLN_PACKAGE_AUTHORS << std::endl; /* ``The next line states the number of vertices, the number diff --git a/milena/mln/io/pnm/save_header.hh b/milena/mln/io/pnm/save_header.hh index 17f3dfe..0f49596 100644 --- a/milena/mln/io/pnm/save_header.hh +++ b/milena/mln/io/pnm/save_header.hh @@ -1,4 +1,5 @@ -// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 EPITA Research and Development Laboratory (LRDE) +// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, +// 2011 EPITA Research and Development Laboratory (LRDE) // // This file is part of Olena. // @@ -33,6 +34,8 @@ # include <iostream> # include <fstream> +# include <mln/version.hh> + # include <mln/io/pnm/max_component.hh> # include <mln/value/rgb.hh> @@ -76,11 +79,12 @@ namespace mln abort(); } file << "P" << type << std::endl; - file << "# Generated by Milena 1.0 http://olena.lrde.epita.fr" << std::endl; - file << "# EPITA Research and Development Laboratory (LRDE)" << std::endl; // We have a two-line comment because xv is buggy for some // tiny binary images and their workaround is to have such a // two-line comment... + file << "# Generated by " OLN_PACKAGE_STRING " (" OLN_PACKAGE_URL ")" + << std::endl + << "# " OLN_PACKAGE_AUTHORS << std::endl; file << geom::ncols(ima) << ' ' << geom::nrows(ima) << std::endl; mln_value(I) i; diff --git a/milena/mln/io/vtk/save.hh b/milena/mln/io/vtk/save.hh index 142608a..e3b8893 100644 --- a/milena/mln/io/vtk/save.hh +++ b/milena/mln/io/vtk/save.hh @@ -41,6 +41,7 @@ # include <string> +# include <mln/version.hh> # include <mln/core/alias/complex_image.hh> # include <mln/core/image/complex_neighborhoods.hh> # include <mln/core/image/complex_neighborhood_piter.hh> @@ -283,7 +284,7 @@ namespace mln character `\n'. The header is 256 characters maximum. The header can be used to describe the data and include any other pertinent information.'' */ - ostr << "Generated by Milena 1.0 http://olena.lrde.epita.fr" + ostr << "Generated by " OLN_PACKAGE_STRING " (" OLN_PACKAGE_URL ")" << std::endl; /* ``3. The next part is the file format. The file format diff --git a/milena/mln/version.hh.in b/milena/mln/version.hh.in index 1dd45dd..6612aa2 100644 --- a/milena/mln/version.hh.in +++ b/milena/mln/version.hh.in @@ -32,4 +32,10 @@ /// The version of this package. #define OLN_PACKAGE_VERSION "@PACKAGE_VERSION@" +/// Home page for this package. +#define OLN_PACKAGE_URL "@PACKAGE_URL@" + +/// Authors of the package. +#define OLN_PACKAGE_AUTHORS "EPITA Research and Development Laboratory (LRDE)" + #endif // ! MLN_VERSION_HH -- 1.7.2.5
participants (1)
-
Roland Levillain