Browse Source

Rafa - haciendo const algunos de los member functions

Rafael Arce Nazario 8 years ago
parent
commit
65f1307034
2 changed files with 18 additions and 13 deletions
  1. 6
    6
      bird.cpp
  2. 12
    7
      bird.h

+ 6
- 6
bird.cpp View File

46
 ///
46
 ///
47
 /// Getter for the eyeColor.
47
 /// Getter for the eyeColor.
48
 ///
48
 ///
49
-QString  Bird::getEyeColor(){
49
+QString  Bird::getEyeColor() const {
50
     return eColor ;
50
     return eColor ;
51
 }
51
 }
52
 
52
 
53
 ///
53
 ///
54
 /// Getter for the faceColor.
54
 /// Getter for the faceColor.
55
 ///
55
 ///
56
-QString  Bird::getFaceColor(){
56
+QString  Bird::getFaceColor() const{
57
     return color ;
57
     return color ;
58
 }
58
 }
59
 
59
 
60
 ///
60
 ///
61
 /// Setter for the eyeColor.
61
 /// Setter for the eyeColor.
62
 ///
62
 ///
63
-void  Bird::setEyeColor(QString eye){
63
+void  Bird::setEyeColor(QString eye) {
64
     eColor = eye ;
64
     eColor = eye ;
65
 }
65
 }
66
 
66
 
74
 ///
74
 ///
75
 /// Getter for the size.
75
 /// Getter for the size.
76
 ///
76
 ///
77
-int Bird::getSize(){
77
+int Bird::getSize() const{
78
     return size ;
78
     return size ;
79
 }
79
 }
80
 
80
 
81
 ///
81
 ///
82
 /// Getter for the Eyebrow.
82
 /// Getter for the Eyebrow.
83
 ///
83
 ///
84
-Bird::EyeBrowType Bird::getEyebrow(){
84
+Bird::EyeBrowType Bird::getEyebrow() const{
85
     return eyeBrow ;
85
     return eyeBrow ;
86
 }
86
 }
87
 
87
 
108
 ///
108
 ///
109
 /// Converts a color specified as string to a Qt::GlobalColor
109
 /// Converts a color specified as string to a Qt::GlobalColor
110
 ///
110
 ///
111
-Qt::GlobalColor Bird::getColor(QString color){
111
+Qt::GlobalColor Bird::getColor(QString color) const{
112
 
112
 
113
     if(color=="red")
113
     if(color=="red")
114
         return Qt::red ;
114
         return Qt::red ;

+ 12
- 7
bird.h View File

29
     
29
     
30
     explicit Bird(QWidget *parent = 0);
30
     explicit Bird(QWidget *parent = 0);
31
     Bird(int , EyeBrowType , QString , QString, QWidget *parent = 0) ;
31
     Bird(int , EyeBrowType , QString , QString, QWidget *parent = 0) ;
32
-    QString  getEyeColor() ;
33
-    QString  getFaceColor() ;
34
-    void  setEyeColor(QString) ;
35
-    void  setFaceColor(QString) ;
36
-    int getSize() ;
37
-    EyeBrowType getEyebrow() ;
32
+
33
+    // getters    
34
+    QString getEyeColor() const;
35
+    QString getFaceColor() const;
36
+    int getSize() const;
37
+    EyeBrowType getEyebrow() const;
38
+    Qt::GlobalColor getColor(QString) const;
39
+
40
+    // setters 
41
+    void setEyeColor(QString) ;
42
+    void setFaceColor(QString) ;
38
     void setSize(int) ;
43
     void setSize(int) ;
39
     void setEyebrow(EyeBrowType) ;
44
     void setEyebrow(EyeBrowType) ;
40
-    Qt::GlobalColor getColor(QString) ;
45
+
41
 
46
 
42
     Bird & operator=(Bird &b);
47
     Bird & operator=(Bird &b);
43
 signals:
48
 signals: