Commit d27a255d authored by Johnny Jazeix's avatar Johnny Jazeix
Browse files

Removed some useless header, made ViTE Qt4.4 compatible (removed calls

to QList length()), Privatisation of constructors.
parent 4f3dec29
......@@ -41,7 +41,6 @@
**
*/
#include <iostream>
#include <fstream>
#include <string>
#include <sstream>
......@@ -51,6 +50,8 @@
/* -- */
#ifndef VITE_DEBUG
# include "core/Core.hpp"
#else // TODO Include the debug one
# include "core/Core.hpp"
#endif
/* -- */
#include "common/Message.hpp"
......
......@@ -42,7 +42,6 @@
*/
#include <sstream>
#include <iostream>
/* -- */
#include <QObject>
/* -- */
......
......@@ -508,11 +508,11 @@ void Interface_graphic::on_export_file_triggered(){
if (file_dialog.exec()){/* Display the file dialog */
selected_files = file_dialog.selectedFiles();//"/tmp/test.png";//file_dialog.selectedFile();
if (selected_files.length()==1)
if (selected_files.size()==1)
filename = selected_files[0];/* Get the first filename */
else{
if (selected_files.length()==0)
if (selected_files.size()==0)
warning("No file was selected.");
else
warning("Cannot save: too much files were selected.");
......
......@@ -40,7 +40,6 @@
** - VUCHENER Clément
**
*/
#include <iostream>
#include <fstream>
#include <list>
#include <map>
......
......@@ -43,7 +43,6 @@
#include <string>
#include <vector>
#include <iostream>
#include <fstream>
/* -- */
#include <QFile>
......@@ -58,7 +57,7 @@ using namespace std;
File::File() : _filename(""), _current_line(0), _filesize(0.) {
}
void File::open(string filename) {
void File::open(string &filename) {
_filename = filename;
close();
......@@ -82,11 +81,6 @@ void File::get_line(Line &line) {
getline(_file, content);
content.append("\n");
// getline fix ... sometimes it autoduplicates the string...
if((content.substr(0, content.size()/2)) == content.substr(content.size()/2, content.size()/2)) {
content = content.substr(0, content.size()/2)+"\n";
}
try {
line = content;
}
......
......@@ -62,7 +62,8 @@ private:
std::string _filename;
unsigned int _current_line;
int _filesize;
File(const File &);
public:
/*!
* \brief Constructor for the file
......@@ -86,7 +87,7 @@ public:
* \brief Open the file
* \param filename the file name
*/
void open(std::string filename);
void open(std::string &filename);
/*!
* \fn close()
......
......@@ -168,7 +168,7 @@ unsigned int Line::get_line_count() const {
return _line_count;
}
int Line::build_composite_token(string line, int index) {
int Line::build_composite_token(const string &line, int index) {
// line[index] corresponds to the delimiter ie " or '
// We search the first one after this one
const unsigned int delimiter = line.find_first_of(line[index], index+1);
......
......@@ -136,7 +136,7 @@ public:
* \param index from where we start to read the line
* \return the number of char read
*/
int build_composite_token(std::string line, int index);
int build_composite_token(const std::string &line, int index);
/*!
* \fn print() const
......
......@@ -65,7 +65,7 @@ public:
* \param trace the structure of data to fill
* \param finish_trace_after_parse boolean set if we do not have to finish the trace after parsing
*/
virtual void parse(std::string filename, Trace &trace, bool finish_trace_after_parse = true) = 0;
virtual void parse(const std::string &filename, Trace &trace, bool finish_trace_after_parse = true) = 0;
virtual ~Parser() {};
......@@ -93,7 +93,7 @@ public:
* \param filename : the name of the file to parse
* \brief set the name of the file to parse.
*/
virtual void set_file_to_parse(const std::string filename) = 0;
virtual void set_file_to_parse(const std::string &filename) = 0;
/*!
* \fn finish()
......
......@@ -266,6 +266,8 @@ private:
*/
static Color *new_color(int func_id);
ParserDefinitionOTF(const ParserDefinitionOTF&);
public:
/*!
......
......@@ -92,9 +92,9 @@ void ParserDefinitionPaje::enter_definition(const Line &line){
return;
}
Definition current_definition = Definition(definition_name);
Definition current_definition(definition_name);
_definitions.insert(pair<unsigned int,Definition>(definition_identity, current_definition));
_current_definition = definition_identity;
_current_definition_id = definition_identity;
if(line.length() > 4){
Error::set(Error::_EXTRA_TOKEN, line.get_line_count(), Error::_WARNING);
......@@ -112,9 +112,9 @@ void ParserDefinitionPaje::leave_definition(const Line &line){
}
_state = _OUT_A_DEFINITION;
if(!_definitions[_current_definition].check_definition()){
Error::set(Error::_UNKNOWN_EVENT_DEF + _definitions[_current_definition].print_string(), line.get_line_count(), Error::_ERROR);
_definitions.erase(_current_definition);
if(!_definitions[_current_definition_id].check_definition()){
Error::set(Error::_UNKNOWN_EVENT_DEF + _definitions[_current_definition_id].print_string(), line.get_line_count(), Error::_ERROR);
_definitions.erase(_current_definition_id);
return;
}
}
......@@ -138,7 +138,7 @@ void ParserDefinitionPaje::add_field_to_definition(std::string& first_token, con
return;
}
_definitions[_current_definition].store(first_token, field_type);
_definitions[_current_definition_id].store(first_token, field_type);
if(line.length() > 3){
Error::set(Error::_EXTRA_TOKEN, line.get_line_count(), Error::_WARNING);
......
......@@ -55,7 +55,7 @@ class Line;
* \brief Parse the definitions of the trace and stock them.
*
*/
class ParserDefinitionPaje{
class ParserDefinitionPaje {
/**
* Reads line to find events definition
......@@ -66,10 +66,12 @@ private:
/*! \brief Hash table to retrive easily event in Parser Event. */
std::map<unsigned int, Definition> _definitions;
int _state;
unsigned int _current_definition;
unsigned int _current_definition_id;
static const int _OUT_A_DEFINITION;
static const int _IN_A_DEFINITION;
ParserDefinitionPaje(const ParserDefinitionPaje &);
public:
/*!
* \fn ParserDefinitionPaje
......
......@@ -41,7 +41,6 @@
**
*/
#include <iostream>
#include <sstream>
#include <string>
#include <map>
......
......@@ -81,7 +81,7 @@ private:
static int handle_message(void *trace, uint64_t time, uint32_t receiver, uint32_t sender, uint32_t /*group*/, uint32_t /*type*/, uint32_t /*length*/, uint32_t source, bool is_sender_to_receiver);
ParserEventOTF(const ParserEventOTF &);
public:
/*!
* \fn ParserEventOTF()
......
......@@ -41,7 +41,6 @@
**
*/
#include <iostream>
#include <string>
#include <map>
#include <set>
......
......@@ -62,6 +62,8 @@ class ParserEventPaje{
private:
std::map <const String, Container *, String::less_than> _containers;
ParserEventPaje(const ParserEventPaje &);
public:
ParserEventPaje();
......
......@@ -41,7 +41,6 @@
**
*/
#include <iostream>
#include <fstream>
#include <string>
#include <map>
......@@ -66,7 +65,7 @@ ParserOTF::ParserOTF() {
_is_canceled = false;
}
void ParserOTF::parse(string filename, Trace &trace, bool finish_trace_after_parse) {
void ParserOTF::parse(const string &filename, Trace &trace, bool finish_trace_after_parse) {
set_file_to_parse(filename);
......@@ -122,7 +121,7 @@ void ParserOTF::parse(string filename, Trace &trace, bool finish_trace_after_par
}
void ParserOTF::set_file_to_parse(const string filename) {
void ParserOTF::set_file_to_parse(const string &filename) {
_file_to_parse = filename;
}
......
......@@ -62,6 +62,7 @@ private:
std::string _file_to_parse;
OTF_Reader* _reader;
ParserOTF(const ParserOTF &);
public:
/*!
......@@ -75,14 +76,14 @@ public:
* \param trace : the structure of data to fill
* \param finish_trace_after_parse boolean set if we do not have to finish the trace after parsing
*/
void parse(std::string filename, Trace &trace, bool finish_trace_after_parse = true);
void parse(const std::string &filename, Trace &trace, bool finish_trace_after_parse = true);
/*!
* \fn set_file_to_parse(const std::string filename)
* \param filename : the name of the file to parse
* \brief set the name of the file to parse.
*/
void set_file_to_parse(const std::string filename);
void set_file_to_parse(const std::string &filename);
/*!
* \fn get_size_loaded() const
......
......@@ -41,7 +41,6 @@
**
*/
#include <iostream>
#include <fstream>
#include <string>
#include <set>
......@@ -74,7 +73,7 @@ ParserPaje::~ParserPaje() {
delete parserevent;
}
void ParserPaje::parse(string filename, Trace &trace, bool finish_trace_after_parse) {
void ParserPaje::parse(const string &filename, Trace &trace, bool finish_trace_after_parse) {
set_file_to_parse(filename);
......@@ -138,7 +137,7 @@ void ParserPaje::parse(string filename, Trace &trace, bool finish_trace_after_pa
}
void ParserPaje::set_file_to_parse(const string filename) {
void ParserPaje::set_file_to_parse(const string &filename) {
_file_to_parse = filename;
}
......
......@@ -66,6 +66,8 @@ private:
File _file;
ParserPaje(const ParserPaje &);
public:
/*!
......@@ -84,14 +86,14 @@ public:
* \param trace : the structure of data to fill
* \param finish_trace_after_parse boolean set if we do not have to finish the trace after parsing
*/
void parse(std::string filename, Trace &trace, bool finish_trace_after_parse = true);
void parse(const std::string &filename, Trace &trace, bool finish_trace_after_parse = true);
/*!
* \fn set_file_to_parse(const std::string filename)
* \param filename : the name of the file to parse
* \brief set the name of the file to parse.
*/
void set_file_to_parse(const std::string filename);
void set_file_to_parse(const std::string &filename);
/*!
* \fn get_size_loaded() const
......
Markdown is supported
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