Commit accfaf18 authored by Guillaume Lazzara's avatar Guillaume Lazzara
Browse files

Add missing const references to function arguments.

	* arthur/xml_transform/common.cc,
	* arthur/xml_transform/common.hh,
	* arthur/xml_transform/image_crop.cc,
	* arthur/xml_transform/image_crop.hh,
	* arthur/xml_transform/loader.cc,
	* arthur/xml_transform/loader.hh,
	* arthur/xml_transform/main.cc,
	* arthur/xml_transform/xml_transform.cc,
	* arthur/xml_transform/xml_transform.hh: Here.
parent cb91a95d
2010-09-02 Guillaume Lazzara <z@lrde.epita.fr>
Add missing const references to function arguments.
* arthur/xml_transform/common.cc,
* arthur/xml_transform/common.hh,
* arthur/xml_transform/image_crop.cc,
* arthur/xml_transform/image_crop.hh,
* arthur/xml_transform/loader.cc,
* arthur/xml_transform/loader.hh,
* arthur/xml_transform/main.cc,
* arthur/xml_transform/xml_transform.cc,
* arthur/xml_transform/xml_transform.hh: Here.
2010-08-06 Arthur Crepin-Leblond <crepin@lrde.epita.fr>
Open Document bug warning.
......
# include "common.hh"
QString Common::get_file_name(QString image)
QString Common::get_file_name(const QString& image)
{
QString tmp = image.mid(image.lastIndexOf("/") + 1);
tmp.chop(tmp.size() - tmp.lastIndexOf("."));
return tmp;
}
QString Common::get_file_ext(QString image)
QString Common::get_file_ext(const QString& image)
{
return image.right(image.size() - image.lastIndexOf("."));
}
......@@ -9,8 +9,8 @@ class Common : public QObject
public:
Common() {}
~Common() {}
static QString get_file_name(QString image);
static QString get_file_ext(QString image);
static QString get_file_name(const QString& image);
static QString get_file_ext(const QString& image);
};
#endif // ! COMMON_HH
......@@ -37,10 +37,11 @@
#include <mln/io/magick/load.hh>
#include <mln/io/ppm/all.hh>
ImageCrop::ImageCrop(QString xml, QString img, QString output) :
xml_(xml),
image_(img),
output_dir_(output)
ImageCrop::ImageCrop(const QString& xml, const QString& img,
const QString& output)
: xml_(xml),
image_(img),
output_dir_(output)
{
}
......@@ -48,8 +49,9 @@ ImageCrop::~ImageCrop()
{
}
/* Save image to PNG format in output_dir/img. */
void ImageCrop::save_image(QString out)
void ImageCrop::save_image(const QString& out)
{
using namespace mln;
......@@ -72,8 +74,10 @@ QString ImageCrop::img_to_base64()
return file_content.toBase64();
}
/* Decode the base 64 string str and save into output_dir_/img/img_name. */
bool ImageCrop::img_from_base64(QString str, QString img)
/* Decode the base 64 string str and save into
* output_dir_/img/img_name. */
bool ImageCrop::img_from_base64(const QString& str, const QString& img)
{
QByteArray ba;
......@@ -84,7 +88,8 @@ bool ImageCrop::img_from_base64(QString str, QString img)
return ima.save(output_dir_ + img);
}
/* Read all regions of the XML file and save all base 64 data into output_dir/img */
/* Read all regions of the XML file and save all base 64 data into
* output_dir/img */
void ImageCrop::from_base64()
{
QFile f_in(xml_);
......@@ -125,7 +130,7 @@ void ImageCrop::from_base64()
/* Tranfsorm the input XML file associated with images into a single
XML output containing datas if images in base 64. */
void ImageCrop::to_base64(QString out_file, bool no_crop)
void ImageCrop::to_base64(const QString& out_file, bool no_crop)
{
QFile file(xml_);
file.open(QIODevice::ReadOnly);
......
......@@ -36,6 +36,7 @@ class ImageCrop : public QObject
Q_OBJECT
public:
<<<<<<< HEAD
ImageCrop(QString, QString, QString);
~ImageCrop();
......@@ -45,6 +46,17 @@ class ImageCrop : public QObject
QString img_to_base64();
bool img_from_base64(QString, QString);
void to_base64(QString, bool);
=======
ImageCrop(const QString&, const QString&, const QString&);
~ImageCrop();
void save_image(const QString&);
bool crop_regions(bool temp = false);
QString img_to_base64();
bool img_from_base64(const QString&, const QString&);
void to_base64(const QString&, bool);
>>>>>>> 6f0918c... Add missing const references to function arguments.
void from_base64();
......
......@@ -33,7 +33,7 @@ Loader::~Loader()
{
}
QDomDocument* Loader::xml_to_dom(QString xml_file)
QDomDocument* Loader::xml_to_dom(const QString& xml_file)
{
QFile file(xml_file);
......@@ -68,7 +68,7 @@ bool Loader::set_output(QString& output)
}
void Loader::add_html_templates(bool base64, QString output)
void Loader::add_html_templates(bool base64, const QString& output)
{
QFile gen("templates/html/html_generator.sh");
gen.copy(output + "html_generator.sh");
......@@ -88,7 +88,7 @@ void Loader::add_html_templates(bool base64, QString output)
}
}
void Loader::add_pdf_templates(bool crop, bool base64, QString output)
void Loader::add_pdf_templates(bool crop, bool base64, const QString& output)
{
if (base64)
{
......@@ -126,7 +126,7 @@ void Loader::add_pdf_templates(bool crop, bool base64, QString output)
}
}
void Loader::add_svg_templates(QString output)
void Loader::add_svg_templates(const QString& output)
{
QFile regions("templates/pdf/regions_svg.xsl");
regions.copy(output + "regions.xsl");
......@@ -141,7 +141,7 @@ void Loader::add_svg_templates(QString output)
xsl.copy(output + "main.xsl");
}
void Loader::add_open_templates(QString output)
void Loader::add_open_templates(const QString& output)
{
QFile css("templates/opendoc/css.css");
css.copy(output + "css.css");
......@@ -153,7 +153,7 @@ void Loader::add_open_templates(QString output)
xsl.copy(output + "xsl.xsl");
}
bool Loader::xml_output(QString xml_file, bool html, QString output)
bool Loader::xml_output(const QString& xml_file, bool html, const QString& output)
{
QFile file(xml_file);
......
......@@ -23,11 +23,11 @@
// exception does not however invalidate any other reasons why the
// executable file might be covered by the GNU General Public License.
#ifndef LOADER_HH
# define LOADER_HH
#ifndef LOADER_HH
# define LOADER_HH
# include <QtCore>
#include <QDomDocument>
# include <QDomDocument>
class Loader : public QObject
{
......@@ -37,14 +37,15 @@ class Loader : public QObject
Loader();
~Loader();
// void merge(QString in, QString other, QString output = "output.xml");
bool xml_output(QString xml_file, bool html, QString output);
QDomDocument* xml_to_dom(QString xml_file);
// void merge(const QString& in, const QString& other, const
// QString& output = "output.xml");
bool xml_output(const QString& xml_file, bool html, const QString& output);
QDomDocument* xml_to_dom(const QString& xml_file);
bool set_output(QString& output);
void add_pdf_templates(bool crop, bool base64, QString output);
void add_svg_templates(QString output);
void add_open_templates(QString output);
void add_html_templates(bool base64, QString output);
void add_pdf_templates(bool crop, bool base64, const QString& output);
void add_svg_templates(const QString& output);
void add_open_templates(const QString& output);
void add_html_templates(bool base64, const QString& output);
};
#endif /* !LOADER_HH */
#endif /* !LOADER_HH */
......@@ -2,10 +2,12 @@
#include <string>
#include <string>
#include <cstdlib>
#include <Magick++.h>
#include "xml_transform.hh"
int main(int argc, char **argv)
{
Magick::InitializeMagick(argv[0]);
std::string man;
man = "xml_transform\n"
......
......@@ -29,7 +29,7 @@
# include "common.hh"
# include <iostream>
XmlTransform::XmlTransform(QString xml_file, QString image_file, QString output, QString file) :
XmlTransform::XmlTransform(const QString& xml_file, const QString& image_file, const QString& output, const QString& file) :
xml_file_(xml_file),
image_(image_file),
loader_(new Loader()),
......
......@@ -37,7 +37,8 @@ class XmlTransform : public QObject
Q_OBJECT
public:
XmlTransform(QString xml_file, QString image_file, QString output, QString file = QString::Null());
XmlTransform(const QString& xml_file, const QString& image_file,
const QString& output, const QString& file = QString::Null());
~XmlTransform();
QString out() { return output_dir_; }
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment