Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
CellulutLO21
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
LO21_Pin_Noir_Boucher_Bouri_Detree
CellulutLO21
Commits
2c9e9137
Commit
2c9e9137
authored
3 years ago
by
Yann Boucher
Browse files
Options
Downloads
Patches
Plain Diff
Added a bit of missing documentation, added an entry to the .gitignore
parent
050f7f90
No related branches found
No related tags found
No related merge requests found
Pipeline
#77677
passed
3 years ago
Stage: test
Stage: deploy
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
.gitignore
+2
-0
2 additions, 0 deletions
.gitignore
include/propertyvisitors.hpp
+22
-2
22 additions, 2 deletions
include/propertyvisitors.hpp
include/structurereader.hpp
+31
-2
31 additions, 2 deletions
include/structurereader.hpp
src/structurereader.cpp
+8
-0
8 additions, 0 deletions
src/structurereader.cpp
with
63 additions
and
4 deletions
.gitignore
+
2
−
0
View file @
2c9e9137
...
@@ -32,6 +32,8 @@ Makefile*
...
@@ -32,6 +32,8 @@ Makefile*
*.qm
*.qm
*.prl
*.prl
build/
# Qt unit tests
# Qt unit tests
target_wrapper.*
target_wrapper.*
...
...
This diff is collapsed.
Click to expand it.
include/propertyvisitors.hpp
+
22
−
2
View file @
2c9e9137
...
@@ -19,10 +19,17 @@ Fichier contenant diverses classes filles de PropertyVisitor permettant l'affich
...
@@ -19,10 +19,17 @@ Fichier contenant diverses classes filles de PropertyVisitor permettant l'affich
#include
"property.hpp"
#include
"property.hpp"
/**
\class UIBuilderVisitor
Cette classe permet de remplir un widget fourni en argument avec une représentation interactive de Property.
**/
class
UIBuilderVisitor
:
public
PropertyVisitor
class
UIBuilderVisitor
:
public
PropertyVisitor
{
{
public:
public:
// destrucive = true if we want to rebuild the layout of the base_widget passed in parameter
//! Construit le UIBuilderVisitor à partir d'un base_widget.
//! \param base_widget le widget.
//! \param destructive indique si l'on détruit le contenu déjà présent dans base_widget ou non.
UIBuilderVisitor
(
QWidget
*
base_widget
,
bool
destructive
=
true
);
UIBuilderVisitor
(
QWidget
*
base_widget
,
bool
destructive
=
true
);
private:
private:
...
@@ -42,12 +49,18 @@ private:
...
@@ -42,12 +49,18 @@ private:
std
::
stack
<
QWidget
*>
m_widget_hierarchy
;
std
::
stack
<
QWidget
*>
m_widget_hierarchy
;
};
};
/**
\class PropertySaverVisitor
Cette classe permet de sauvegarder un ensemble de Property dans un fichier JSON donné.
**/
class
PropertySaverVisitor
:
public
PropertyVisitor
class
PropertySaverVisitor
:
public
PropertyVisitor
{
{
public:
public:
//! Construit le PropertySaverVisitor.
PropertySaverVisitor
();
PropertySaverVisitor
();
//! Sauvegarde les données des Property visitées au format JSON dans le fichier.
//! \param filename Le nom du fichier.
void
save
(
const
std
::
string
&
filename
);
void
save
(
const
std
::
string
&
filename
);
private:
private:
...
@@ -66,9 +79,16 @@ private:
...
@@ -66,9 +79,16 @@ private:
std
::
stack
<
QVariant
>
m_current_hierarchy
;
std
::
stack
<
QVariant
>
m_current_hierarchy
;
};
};
/**
\class PropertyLoaderVisitor
Cette classe permet de charger un ensemble de Property depuis un fichier JSON donné.
**/
class
PropertyLoaderVisitor
:
public
PropertyVisitor
class
PropertyLoaderVisitor
:
public
PropertyVisitor
{
{
public:
public:
//! Construit le PropertyLoaderVisitor à partir des données contenues dans un fichier JSON.
//! \param filename Le nom du fichier.
PropertyLoaderVisitor
(
const
std
::
string
&
filename
);
PropertyLoaderVisitor
(
const
std
::
string
&
filename
);
private:
private:
...
...
This diff is collapsed.
Click to expand it.
include/structurereader.hpp
+
31
−
2
View file @
2c9e9137
/**
\file structurereader.hpp
\date 07/05/2021
\author Yann Boucher
\version 1
\brief StructureReader
Fichier contenant la classe StructureReader et ses filles, permettant de lire une Structure à partir de différents formats de fichier.
**/
#ifndef STRUCTUREREADER_HPP
#ifndef STRUCTUREREADER_HPP
#define STRUCTUREREADER_HPP
#define STRUCTUREREADER_HPP
...
@@ -6,8 +17,6 @@
...
@@ -6,8 +17,6 @@
class
Structure
;
class
Structure
;
// TODO : documenter ce fichier
// TODO : adapter cettre classe d'Exception en la faisant hériter à notre propre classe d'Exception
// TODO : adapter cettre classe d'Exception en la faisant hériter à notre propre classe d'Exception
class
StructureReaderException
:
public
std
::
exception
class
StructureReaderException
:
public
std
::
exception
{
{
...
@@ -23,24 +32,40 @@ private:
...
@@ -23,24 +32,40 @@ private:
const
std
::
string
m_what
;
const
std
::
string
m_what
;
};
};
//! \class StructureReader
//! Classe abstraite permettant de lire une Structure à partir de différents formats de fichier.
class
StructureReader
class
StructureReader
{
{
public:
public:
//! \brief Constructeur prenant en argument les données du fichier à lire sous forme de std::string
StructureReader
(
const
std
::
string
&
in_data
)
:
StructureReader
(
const
std
::
string
&
in_data
)
:
m_idx
(
0
),
m_data
(
in_data
)
m_idx
(
0
),
m_data
(
in_data
)
{}
{}
//! \brief Retourne la structure lue.
//! \exception StructureReaderException si il y a une erreur lors de la lecture
virtual
Structure
read_structure
()
=
0
;
virtual
Structure
read_structure
()
=
0
;
protected
:
protected
:
//! \brief Retourne le caractère au niveau du curseur actuel.
char
peek
()
const
;
char
peek
()
const
;
//! \brief Lit le caractère actuel sous le curseur, et avance le curseur.
char
read
();
char
read
();
//! \brief Retourne vrai si l'entièreté des données a été lue, faux sinon.
bool
eof
()
const
;
bool
eof
()
const
;
//! \brief Renvoie une exception si les données sous le curseur actuelles sont différentes de str, avance le curseur sinon.
void
expect
(
const
std
::
string
&
str
);
void
expect
(
const
std
::
string
&
str
);
//! \brief Retourne vrai si ls données sous le curseur correspondent à str et avance le curseur, retourne faux sinon.
bool
accept
(
const
std
::
string
&
str
);
bool
accept
(
const
std
::
string
&
str
);
//! \brief Lit un mot délimité par des espaces dans l'entrée.
std
::
string
read_word
();
std
::
string
read_word
();
//! \brief Lit la ligne actuelle dans l'entrée, à partir du curseur.
std
::
string
read_line
();
std
::
string
read_line
();
//! \brief Retourne toutes les données situées à partir du curseur.
std
::
string
data_left
()
const
;
std
::
string
data_left
()
const
;
//! \brief Lit un entier dans l'entrée.
//! \exception StructureReaderException si il y a une erreur lors de la lecture de l'entier
int
read_int
();
int
read_int
();
//! \brief Avance le curseur jusqu'au premier caractère qui n'est pas un espace.
void
read_white
();
void
read_white
();
private
:
private
:
...
@@ -48,6 +73,8 @@ private:
...
@@ -48,6 +73,8 @@ private:
const
std
::
string
&
m_data
;
const
std
::
string
&
m_data
;
};
};
//! \class RLEStructureReader
//! Lit une structure au format Extended RLE de Golly (https://www.conwaylife.com/wiki/Run_Length_Encoded)
class
RLEStructureReader
:
public
StructureReader
class
RLEStructureReader
:
public
StructureReader
{
{
public:
public:
...
@@ -60,6 +87,8 @@ private:
...
@@ -60,6 +87,8 @@ private:
unsigned
read_state
();
unsigned
read_state
();
};
};
//! \class StructureReader
//! Lit une structure au format JSON.
class
JSONStructureReader
:
public
StructureReader
class
JSONStructureReader
:
public
StructureReader
{
{
public:
public:
...
...
This diff is collapsed.
Click to expand it.
src/structurereader.cpp
+
8
−
0
View file @
2c9e9137
/**
\file structurereader.cpp
\date 07/05/2021
\author Yann Boucher
\version 1
\brief StructureReader
**/
#include
"structurereader.hpp"
#include
"structurereader.hpp"
#include
<QByteArray>
#include
<QByteArray>
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment