Commit 6b098eef authored by Johnny Jazeix's avatar Johnny Jazeix
Browse files

Remove of some comments. True includes for render_opengl.hpp (useful for

codeblocks and others)

Improvment of the drawDiagram (it misses only one thing when there are a 
lot of containers printed).

parent fb0f9ff2
......@@ -6,12 +6,12 @@ Definition::Definition(){
_event_name.erase();
}
Definition::Definition(std::string& eventname){
Definition::Definition(string& eventname){
_event_name = eventname;
}
void Definition::store(std::string name, std::string type){
void Definition::store(string name, string type){
Field e;
e._name = name;
......@@ -30,8 +30,7 @@ void Definition::print() const{
}
string Definition::print_string() const{
string definition ("");
definition += _event_name;
string definition = _event_name;
const unsigned int field_size = _fields.size();
for(unsigned int i = 0 ; i < field_size ; i ++){
......
......@@ -10,12 +10,9 @@ Line::Line(Line &){
}
Line::Line(string &filename){
open(filename.c_str());
open(filename.c_str());
}
Line::Line(const char *filename){
open(filename);
}
Line::~Line(){
if(!_tokens.empty()){
......@@ -24,9 +21,9 @@ Line::~Line(){
}
void Line::open(const char *filename){
_line_count = 0;
_source.open(filename);
_is_eof = false;
_line_count = 0;
_source.open(filename);
_is_eof = false;
}
void Line::print() const{
......@@ -34,7 +31,7 @@ void Line::print() const{
cout << "-" ;
for(unsigned int i = 0 ; i < token_size ; i ++)
cout << _tokens[i] << " " ;
cout << "-" <<endl ;
cout << "-" << endl;
}
bool Line::starts_with(const string &s) const{
......
......@@ -15,7 +15,7 @@
/*! \class Line Line.hpp "../parser/src/Line.hpp"
/*! \class Line Line.hpp "../source/src/parser/Line.hpp"
* \brief Line object stand for paje format syntax unit .
*/
......@@ -49,12 +49,6 @@ public:
*/
Line(std::string &filename);
/*!
* \brief Constructor for the line
* \param filename : a filename
*/
Line(const char* filename);
/*!
* \brief Destructor
* Destroy the line
......
......@@ -27,60 +27,63 @@ void ParserEventDecoder::store_event(const Definition &definition, Line &line, T
map<std::string, Value *> extra_fields;
unsigned int i = 1;
vector<Field> fields = definition.get_fields();
unsigned int number_of_values = fields.size();
const vector<Field> fields = definition.get_fields();
const unsigned int number_of_values = fields.size();
while(i < number_of_values+1) {
string current_value;
const string current_field_name = fields[i-1]._name;
const string current_field_type = fields[i-1]._type;
if (!line.item(i, current_value)) {
Error::set(Error::_LINE_TOO_SHORT_EVENT, line.get_line_count(), Error::_WARNING);
return;
}
else if (fields[i-1]._name == "Alias") {
else if (current_field_name == "Alias") {
alias = current_value;
alias_is_initialized = true;
}
else if (fields[i-1]._name == "Name") {
else if (current_field_name == "Name") {
name = current_value;
name_is_initialized = true;
}
else if (fields[i-1]._name == "ContainerType") {
else if (current_field_name == "ContainerType") {
container_type = current_value;
}
else if (fields[i-1]._name == "SourceContainerType") {
else if (current_field_name == "SourceContainerType") {
source_container_type = current_value;
}
else if (fields[i-1]._name == "DestContainerType") {
else if (current_field_name == "DestContainerType") {
dest_container_type = current_value;
}
else if (fields[i-1]._name == "EntityType") {
else if (current_field_name == "EntityType") {
entity_type = current_value;
}
else if (fields[i-1]._name == "Time") {
else if (current_field_name == "Time") {
if(!Date::instantiate(current_value, time)) {
Error::set(Error::_INCOMPATIBLE_VALUE_IN_EVENT + current_value + " (expecting a \"date\")", line.get_line_count(), Error::_WARNING);
return;
}
}
else if (fields[i-1]._name == "Type") {
else if (current_field_name == "Type") {
type = current_value;
}
else if (fields[i-1]._name == "Container") {
else if (current_field_name == "Container") {
container = current_value;
}
else if (fields[i-1]._name == "Value") {
if(fields[i-1]._type == "double") {
else if (current_field_name == "Value") {
if(current_field_type == "double") {
if(!Double::instantiate(current_value, value_double)) {
Error::set(Error::_INCOMPATIBLE_VALUE_IN_EVENT + current_value + " (expecting a \"double\")", line.get_line_count(), Error::_WARNING);
return;
......@@ -91,64 +94,64 @@ void ParserEventDecoder::store_event(const Definition &definition, Line &line, T
}
}
else if (fields[i-1]._name == "SourceContainer") {
else if (current_field_name == "SourceContainer") {
source_container = current_value;
}
else if (fields[i-1]._name == "DestContainer") {
else if (current_field_name == "DestContainer") {
dest_container = current_value;
}
else if (fields[i-1]._name == "Key") {
else if (current_field_name == "Key") {
key = current_value;
}
else {
if(fields[i-1]._type == "string") {
extra_fields[fields[i-1]._name] = new String(current_value);
if(current_field_type == "string") {
extra_fields[current_field_name] = new String(current_value);
}
else if(fields[i-1]._type == "double") {
else if(current_field_type == "double") {
Double value;
if(!Double::instantiate(current_value, value)) {
Error::set(Error::_INCOMPATIBLE_VALUE_IN_EVENT + current_value + " (expecting a \"double\")", line.get_line_count(), Error::_WARNING);
return;
}
extra_fields[fields[i-1]._name] = new Double(value);
extra_fields[current_field_name] = new Double(value);
}
else if(fields[i-1]._type == "hex") {
else if(current_field_type == "hex") {
Hex value;
if(!Hex::instantiate(current_value, value)) {
Error::set(Error::_INCOMPATIBLE_VALUE_IN_EVENT + current_value + " (expecting a \"hex\")", line.get_line_count(), Error::_WARNING);
return;
}
extra_fields[fields[i-1]._name] = new Hex(value);
extra_fields[current_field_name] = new Hex(value);
}
else if(fields[i-1]._type == "date") {
else if(current_field_type == "date") {
Date value;
if(!Date::instantiate(current_value, value)) {
Error::set(Error::_INCOMPATIBLE_VALUE_IN_EVENT + current_value + " (expecting a \"date\")", line.get_line_count(), Error::_WARNING);
return;
}
extra_fields[fields[i-1]._name] = new Date(value);
extra_fields[current_field_name] = new Date(value);
}
else if(fields[i-1]._type == "int") {
else if(current_field_type == "int") {
Integer value;
if(!Integer::instantiate(current_value, value)) {
Error::set(Error::_INCOMPATIBLE_VALUE_IN_EVENT + current_value + " (expecting an \"int\")", line.get_line_count(), Error::_WARNING);
return;
}
extra_fields[fields[i-1]._name] = new Integer(value);
extra_fields[current_field_name] = new Integer(value);
}
else if(fields[i-1]._type == "color") {
else if(current_field_type == "color") {
Color value;
if(!Color::instantiate(current_value, value)) {
Error::set(Error::_INCOMPATIBLE_VALUE_IN_EVENT + current_value + " (expecting a \"color\")", line.get_line_count(), Error::_WARNING);
return;
}
extra_fields[fields[i-1]._name] = new Color(value);
extra_fields[current_field_name] = new Color(value);
}
else {
Error::set(Error::_FIELD_TYPE_UNKNOWN + fields[i-1]._type, line.get_line_count(), Error::_WARNING);
Error::set(Error::_FIELD_TYPE_UNKNOWN + current_field_type, line.get_line_count(), Error::_WARNING);
return;
}
}
......@@ -170,7 +173,7 @@ void ParserEventDecoder::store_event(const Definition &definition, Line &line, T
}
string event_name = definition.get_event_name();
const string event_name = definition.get_event_name();
if(event_name == "PajeDefineContainerType") {
ContainerType *temp_container_type = trace.search_container_type(container_type);
......
......@@ -50,12 +50,10 @@ void TokenSource::open(const char *filename){
_file.open(filename, ios::in);
// throw Error::_OPEN;
_file.seekg (0, ios::end);
TokenSource::_filesize = _file.tellg();
_file.seekg (0, ios::beg);
// throw Error::_FSTAT;
#else
struct stat buf;
......
......@@ -216,8 +216,8 @@ void Render_opengl::resizeGL(int width, int height) {
void Render_opengl::paintGL(){
list<Element_pos>::iterator it_pos;
list<string>::iterator it_txt;
list<Element_pos>::const_iterator it_pos;
list<string>::const_iterator it_txt;
Element_pos buf_x;
Element_pos buf_y;
string buf_txt;
......
......@@ -8,13 +8,13 @@
class Render_opengl;
/* Global informations */
#include "info/info.hpp"
#include "../info/info.hpp"
#include "../interface/interface_console.hpp"
#include "render.hpp"
#include "resource.hpp"
#include "interface_graphic.hpp"
#include "../interface/interface_graphic.hpp"
......@@ -89,14 +89,14 @@ struct Selection_{
*/
class Render_opengl : public QGLWidget, public Render {
Q_OBJECT
protected:
/*!
* \brief Contains container text coordinates.
*/
std::list<Element_pos> _text_pos;
/*!
* \brief Contains container strings.
*/
......@@ -116,7 +116,7 @@ protected:
* \brief Contains the previous selection coordinates.
*/
std::stack<Selection_> _previous_selection;
/*!
* \brief Contains the parent instance.
*/
......@@ -133,7 +133,7 @@ protected:
* \brief State when there is no file opened.
*/
static const int DRAWING_STATE_WAITING;
/*!
* \brief State when the application is drawing traces.
*/
......@@ -150,22 +150,22 @@ protected:
bool _mouse_pressed;
/*!
* \brief Used to store the mouse last x position.
* \brief Used to store the mouse last x position.
*/
int _mouse_x;
/*!
* \brief Used to store the mouse last y position.
* \brief Used to store the mouse last y position.
*/
int _mouse_y;
/*!
* \brief Used to store the mouse current x position.
* \brief Used to store the mouse current x position.
*/
int _new_mouse_x;
/*!
* \brief Used to store the mouse current y position.
* \brief Used to store the mouse current y position.
*/
int _new_mouse_y;
......@@ -183,7 +183,7 @@ protected:
* \brief Define the minimum width and height to draw the selection rectangle (avoid bas manipulations).
*/
Element_pos _minimum_distance_for_selection;
/*!
* \brief Define the scrolling factor when CTRL key is pressed.
*/
......@@ -193,18 +193,18 @@ protected:
* \brief Define the scrolling factor when CTRL key is pressed.
*/
static const int _ctrl_zoom_factor;
/***********************************
*
* The wait screen drawing.
*
**********************************/
/***********************************
* The wait list Attributes.
**********************************/
/*!
* \brief The wait GLu list.
*/
......@@ -224,14 +224,14 @@ protected:
* \brief Time in ms between two frames for the waiting screen.
*/
static const int DRAWING_TIMER_DEFAULT;
/*!
* \brief Wait animation seconds per frame.
*/
int _wait_spf;
/*!
* \brief Timer to animate the wait.
* \brief Timer to animate the wait.
*/
QTimer* _wait_timer;
......@@ -244,11 +244,11 @@ protected:
*
**********************************/
/***********************************
* The drawing list Attributes.
**********************************/
/*!
* \brief Used for draw counter.
*/
......@@ -343,7 +343,7 @@ protected:
* \brief The y base of state area draw.
*/
Element_pos _state_y_min;
/*!
* \brief z position for the ruler.
*/
......@@ -360,12 +360,12 @@ protected:
Element_pos _z_ruler_under;
/*!
* \brief z position for containers.
* \brief z position for containers.
*/
Element_pos _z_container;
/*!
* \brief z position for objects under containers.
* \brief z position for objects under containers.
*/
Element_pos _z_container_under;
......@@ -408,7 +408,7 @@ protected:
* Highness of the ruler.
*/
Element_pos _ruler_y;
/*!
* Width of the ruler.
*/
......@@ -448,27 +448,27 @@ protected:
* \brief The y position of the vertical scroll bar.
*/
Element_pos _y_scroll_pos;
/***********************************
*
* Default QGLWidget functions.
*
**********************************/
/*!
* \brief Call by the system to initialize the OpenGL render area.
*/
void initializeGL();
/*!
* \brief Call by the system when the render area was resized (occurs during a window resizement).
* \param width : the new width of the render area.
* \param height : the new height of the render area.
* \param height : the new height of the render area.
*/
void resizeGL(int width, int height);
/*!
* \brief Call by the system each time the render area need to be updated.
*/
......@@ -478,7 +478,7 @@ protected:
* \brief This functions receives all mouse press events.
* \param event The event triggered by mouse.
*/
void mousePressEvent(QMouseEvent * event);
void mousePressEvent(QMouseEvent * event);
/*!
* \brief If user press, this functions receives all mouse move events until user release mouse.
......@@ -490,14 +490,14 @@ protected:
* \brief This functions receives all mouse release events.
* \param event The event triggered by mouse.
*/
void mouseReleaseEvent(QMouseEvent * event);
void mouseReleaseEvent(QMouseEvent * event);
/*!
* \brief This functions receives all mouse wheel events.
* \param event The event triggered by the mouse wheel.
*/
void wheelEvent(QWheelEvent * event);
/*!
* \brief This functions receives all keyboard events.
* \param event The event triggered by the keyboard event.
......@@ -510,7 +510,7 @@ protected:
*/
void keyReleaseEvent(QKeyEvent * event);
/***********************************
......@@ -518,7 +518,7 @@ protected:
* Render OpenGL drawing functions.
*
**********************************/
/*!
* \brief Display a wait on the screen if there is no file opened.
* \return Asset value of the wait.
......@@ -547,7 +547,7 @@ protected:
void set_total_time(Times);
/*!
* \brief display the scale
* \brief display the scale
*/
void display_time_scale();
......@@ -580,7 +580,7 @@ public:
* Scaling and scrolling functions.
*
**********************************/
/*!
* \brief Change the scale of state drawing.
......@@ -629,24 +629,24 @@ public:
* \param id The pre registered translation id.
*/
void registered_translate(int id);
/*!
* \brief Refresh scroll bar positions when shortcuts execute movements
* \param LENGTH_CHANGED If true the total length of the scroll bar will be updated.
*/
void refresh_scroll_bars(bool LENGTH_CHANGED = false);
/*!
* \brief Change the percentage taken by container display in the render area.
* \param view_size The new percentage (between 0 to 100).
*/
void change_scale_container_state(int view_size);/* temporary -> to change the size of container view */
/*!
* \brief This function updates the visible interval value (for export).
*/
void update_visible_interval_value();
/*!
* \brief Scale the current view to the zoom box shape.
* \param x_min the x minimum position.
......@@ -770,7 +770,7 @@ public:
* \brief Closes the container display list.
*/
void end_draw_containers();
/*!
* \brief Creates and opens the display list for stater draws.
*/
......@@ -840,7 +840,7 @@ public:
* \brief Creates and opens the display list for counter draws.
*/
void start_draw_counter();
/*!
* \brief Draw a point of the counter.
* \param x x position of the point.
......@@ -849,7 +849,7 @@ public:
* Each time counter is increased, this function is called with the coordinates of the new point.
*/
void draw_counter(const Element_pos x, const Element_pos y);
/*!
* \brief Closes the counter display list.
*/
......@@ -859,8 +859,8 @@ public:
* \brief Do nothing (it is present for compatibility of the Render class).
*/
void end_draw();
};
......@@ -897,7 +897,7 @@ inline void Render_opengl::start_draw_containers(){
_list_containers = glGenLists(1);/* create the list */
if (_list_containers == 0) {
// _parent->warning("Error when creating list");
}
......@@ -922,13 +922,13 @@ inline void Render_opengl::draw_container(const Element_pos x, const Element_pos
if ((x+w)>_container_x_max)
_container_x_max = x+w;
if ((y+h)>_container_y_max)
_container_y_max = y+h;
if (_container_x_min > x)
_container_x_min = x;
if (_container_y_min > y)
_container_y_min = y;
......@@ -936,9 +936,9 @@ inline void Render_opengl::draw_container(const Element_pos x, const Element_pos
#ifdef DEBUG_MODE_RENDER_AREA
std::cerr << __FILE__ << " l." << __LINE__ << ":" << std::endl;
std::cerr << __FILE__ << " l." << __LINE__ << ":" << std::endl;