Permalink
Browse files

Merge olivia local 20:21

  • Loading branch information...
2 parents e254056 + ccdeedf commit e23dbdc2307caa482493cc29698a7be74d42123f @Lowess committed Jun 20, 2012
Showing with 4,670 additions and 1,947 deletions.
  1. +0 −5 Addition.cpp
  2. +0 −22 Addition.h
  3. +24 −0 Calculatrice.cpp
  4. +43 −0 Calculatrice.h
  5. +469 −0 Calculatrice.log
  6. +11 −35 Calculatrice.pro
  7. +1 −1 Calculatrice.pro.user
  8. +24 −124 Calculatrice.pro.user.1.3
  9. +1 −1 CalculatriceException.cpp
  10. +11 −5 CalculatriceException.h
  11. +208 −25 Complexe.cpp
  12. +0 −32 Complexe.h
  13. +55 −0 Constante.cpp
  14. +39 −0 Constante.cpp.autosave
  15. +21 −4 Constante.h
  16. +0 −3 Division.cpp
  17. +0 −21 Division.h
  18. +125 −41 Entier.cpp
  19. +15 −33 Entier.h
  20. +60 −0 Entier.h.autosave
  21. +40 −0 Exp.cpp
  22. +30 −0 Exp.h
  23. +1 −1 Expression.cpp
  24. +11 −4 Expression.h
  25. +138 −36 Fabrique.cpp
  26. +12 −5 Fabrique.h
  27. +29 −14 Fabrique.h.autosave
  28. +69 −0 Gardien.cpp
  29. +42 −0 Gardien.h
  30. +23 −0 LogMessage.cpp
  31. +22 −0 LogMessage.h
  32. +38 −0 LogSystem.cpp
  33. +18 −0 LogSystem.h
  34. +0 −5 Multiplication.cpp
  35. +0 −21 Multiplication.h
  36. +150 −47 Nombre.cpp
  37. +24 −29 Nombre.h
  38. +443 −1 Operateur.cpp
  39. +0 −27 Operateur.h
  40. +27 −10 OperateurBinaire.cpp
  41. +0 −26 OperateurBinaire.h
  42. +66 −0 OperateurUnaire.cpp
  43. +0 −24 OperateurUnaire.h
  44. +49 −0 Option.cpp
  45. +26 −55 Option.h
  46. BIN Options.save
  47. +152 −0 Pile.cpp
  48. +34 −13 Pile.h
  49. +122 −49 Rationnel.cpp
  50. +10 −10 Rationnel.h
  51. +119 −50 Reel.cpp
  52. +9 −9 Reel.h
  53. +0 −5 Soustraction.cpp
  54. +0 −22 Soustraction.h
  55. +5 −152 main.cpp
  56. +646 −10 mainwindow.cpp
  57. +52 −0 mainwindow.h
  58. +1,156 −970 mainwindow.ui
View
@@ -1,5 +0,0 @@
-/*
-#include "Addition.h"
-
-char op = '+';
-*/
View
@@ -1,22 +0,0 @@
-/*
-#ifndef ADDITION_H
-#define ADDITION_H
-
-#include "Operateur.h"
-
-namespace Calculatrice{
- class Addition: public Operateur {
- private:
- static char op;
-
- public:
- QString getOperateur() const {
- return op;
- }
-
- };
-
-}
-
-#endif // ADDITION_H
-*/
View
@@ -1 +1,25 @@
+#include "Calculatrice.h"
+using namespace LO21;
+using namespace std;
+
+//Initialisation des attributs Statics
+LO21::Calculatrice* LO21::Calculatrice::_calc=0;
+
+//Constructeur
+
+//Méthodes publiques
+LO21::Calculatrice& LO21::Calculatrice::getInstance(){
+ if(_calc==0){
+ _calc=new Calculatrice();
+ LogSystem::ecrireLog(LogMessage("Creation d'une instance de calculatrice ",SYSTEME));
+ }
+ return *_calc;
+}
+
+void LO21::Calculatrice::libereInstance(){
+ if(_calc!=0){
+ delete _calc;
+ }
+ _calc=0;
+}
View
@@ -1,4 +1,47 @@
#ifndef CALCULATRICE_H
#define CALCULATRICE_H
+#include "Pile.h"
+#include "Fabrique.h"
+#include "Gardien.h"
+#include "LogSystem.h"
+
+namespace LO21{
+ class Calculatrice{
+ private:
+ static Calculatrice* _calc;
+ Gardien* _gard;
+ Pile* _pile;
+
+ Calculatrice():_gard(Gardien::getInstance()),_pile(new Pile()){}
+
+ Calculatrice(const Calculatrice& c){
+ delete _pile;
+ _pile=c._pile->clone();
+ }
+
+ ~Calculatrice(){
+ delete _pile;
+ Gardien::libereInstance();
+ }
+ public:
+ static Calculatrice& getInstance();
+ static void libereInstance();
+
+ Pile* get_pile() const{ return _pile; }
+ void set_pile(Pile* p) {
+ //qDebug() << "_pile=" << endl;
+ //_pile->afficherPileCourante();
+
+ //qDebug() << "new pile=" << endl;
+ //p->afficherPileMemoire();
+
+ _pile=p;
+ qDebug() << "Taille de la pile courante" << _pile->size();
+ }
+
+ Gardien* get_gardien() const{ return _gard; }
+
+ };
+}
#endif // CALCULATRICE_H
View

Large diffs are not rendered by default.

Oops, something went wrong.
View
@@ -25,23 +25,12 @@ SOURCES += main.cpp\
Calculatrice.cpp \
Option.cpp \
CalculatriceException.cpp \
- Reel.cpp \
- Rationnel.cpp \
- Pile.cpp \
- Option.cpp \
- Operateur.cpp \
- Nombre.cpp \
- mainwindow.cpp \
- main.cpp \
- Fabrique.cpp \
- Expression.cpp \
- Entier.cpp \
- Constante.cpp \
- Complexe.cpp \
- CalculatriceException.cpp \
- Calculatrice.cpp \
+ OperateurUnaire.cpp \
OperateurBinaire.cpp \
- OperateurUnaire.cpp
+ Exp.cpp \
+ Gardien.cpp \
+ LogMessage.cpp \
+ LogSystem.cpp
HEADERS += mainwindow.h \
Expression.h \
@@ -57,24 +46,11 @@ HEADERS += mainwindow.h \
Calculatrice.h \
Option.h \
CalculatriceException.h \
- Reel.h \
- Rationnel.h \
- Pile.h \
- Option.h \
- Operateur.h \
- Nombre.h \
- mainwindow.h \
- Fabrique.h \
- Expression.h \
- Entier.h \
- Constante.h \
- Complexe.h \
- CalculatriceException.h \
- Calculatrice.h \
OperateurUnaire.h \
- OperateurBinaire.h
-
-FORMS += mainwindow.ui \
- mainwindow.ui
+ OperateurBinaire.h \
+ Exp.h \
+ Gardien.h \
+ LogMessage.h \
+ LogSystem.h
-OTHER_FILES +=
+FORMS += mainwindow.ui
View
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
-<!-- Written by Qt Creator 2.4.1, 2012-06-04T23:11:01. -->
+<!-- Written by Qt Creator 2.4.1, 2012-06-20T20:11:43. -->
<qtcreator>
<data>
<variable>ProjectExplorer.Project.ActiveTarget</variable>
View

Large diffs are not rendered by default.

Oops, something went wrong.
@@ -1,5 +1,5 @@
#include "CalculatriceException.h"
-using namespace Calculatrice;
+using namespace LO21;
CalculatriceException::~CalculatriceException() throw(){}
View
@@ -5,10 +5,10 @@
#include <stdexcept>
-enum CalculatriceExceptionType { MATHS, OTHER };
+enum CalculatriceExceptionType { MATHS, OTHER, PILE, OPTION };
-namespace Calculatrice{
+namespace LO21{
class CalculatriceException : public std::exception{
public:
CalculatriceException(const QString& c, const CalculatriceExceptionType t, const QString& s) throw():_class(c),_type(t),_info(s){}
@@ -21,12 +21,18 @@ namespace Calculatrice{
QString type;
switch (_type){
case MATHS:
- type="MATHS"; break;
+ type="maths"; break;
+ case PILE:
+ type="pile"; break;
+ case OPTION:
+ type="option"; break;
default:
- type="OTHER"; break;
+ type="autre"; break;
}
- QString str("Exception emise par la classe: "+_class+" de type "+type+" Information: "+_info);
+ QString str("Oups... Une exception de type "+ type +" a ete captee:\n\n");
+ str += "Message d'information:\n\n"+_info;
+ str.toUtf8();
return str.toStdString().c_str();
}
Oops, something went wrong.

0 comments on commit e23dbdc

Please sign in to comment.