[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[vidalia-svn] r2142: Some more const-correctness tweaks. (in trunk: . src/control)



Author: edmanm
Date: 2007-11-30 11:28:34 -0500 (Fri, 30 Nov 2007)
New Revision: 2142

Modified:
   trunk/
   trunk/src/control/bandwidthevent.h
   trunk/src/control/circuit.cpp
   trunk/src/control/circuit.h
   trunk/src/control/circuitevent.h
   trunk/src/control/logevent.cpp
   trunk/src/control/logevent.h
   trunk/src/control/newdescriptorevent.h
   trunk/src/control/stream.cpp
   trunk/src/control/stream.h
   trunk/src/control/streamevent.h
Log:
 r2165@lysithea:  edmanm | 2007-11-30 11:24:30 -0500
 Some more const-correctness tweaks.



Property changes on: trunk
___________________________________________________________________
 svk:merge ticket from /local/vidalia/trunk [r2165] on 0108964c-5b0b-4c9e-969f-e2288315d100

Modified: trunk/src/control/bandwidthevent.h
===================================================================
--- trunk/src/control/bandwidthevent.h	2007-11-26 21:10:46 UTC (rev 2141)
+++ trunk/src/control/bandwidthevent.h	2007-11-30 16:28:34 UTC (rev 2142)
@@ -40,9 +40,9 @@
   { _bytesRead = bytesRead; _bytesWritten = bytesWritten; }
 
   /** Returns the number of bytes read in the last second */
-  quint64 bytesRead() { return _bytesRead; }
+  quint64 bytesRead() const { return _bytesRead; }
   /** Returns the number of bytes written in the last second */
-  quint64 bytesWritten() { return _bytesWritten; }
+  quint64 bytesWritten() const { return _bytesWritten; }
   
 private:
   quint64 _bytesWritten;

Modified: trunk/src/control/circuit.cpp
===================================================================
--- trunk/src/control/circuit.cpp	2007-11-26 21:10:46 UTC (rev 2141)
+++ trunk/src/control/circuit.cpp	2007-11-30 16:28:34 UTC (rev 2142)
@@ -102,7 +102,7 @@
 
 /** Returns a string representation of the circuit's status. */
 QString
-Circuit::statusString()
+Circuit::statusString() const
 {
   QString status;
   switch (_status) {
@@ -118,7 +118,7 @@
 
 /** Returns true if all fields in this Circuit object are empty. */
 bool
-Circuit::isEmpty()
+Circuit::isEmpty() const
 {
   return (!_circId && (_status == Unknown));
 }

Modified: trunk/src/control/circuit.h
===================================================================
--- trunk/src/control/circuit.h	2007-11-26 21:10:46 UTC (rev 2141)
+++ trunk/src/control/circuit.h	2007-11-30 16:28:34 UTC (rev 2142)
@@ -61,21 +61,21 @@
   static Status toStatus(QString strStatus);
   
   /** Returns true if all fields in this Circuit are empty. */
-  bool isEmpty();
+  bool isEmpty() const;
   
   /** Returns the ID for this circuit */
-  quint64 id() { return _circId; }
+  quint64 id() const { return _circId; }
   /** Returns the status of this circuit */
-  Status status() { return _status; }
+  Status status() const { return _status; }
   /** Returns a string representation of the status of this circuit. */
-  QString statusString();
+  QString statusString() const;
   /** Returns the path chosen for this circuit */
-  QString path() { return _path; }
+  QString path() const { return _path; }
   /** Returns the length of the circuit's path. */
-  uint length() { return hops().size(); }
+  uint length() const { return hops().size(); }
   /** Returns a list of hops on the path. */
-  QStringList hops() { return _path.isEmpty() ? QStringList() 
-                                              : _path.split(","); }
+  QStringList hops() const { return _path.isEmpty() ? QStringList() 
+                                                    : _path.split(","); }
 
 private:
   quint64 _circId; /**< Circuit ID. */

Modified: trunk/src/control/circuitevent.h
===================================================================
--- trunk/src/control/circuitevent.h	2007-11-26 21:10:46 UTC (rev 2141)
+++ trunk/src/control/circuitevent.h	2007-11-30 16:28:34 UTC (rev 2142)
@@ -43,13 +43,13 @@
   { _circuit = circuit; }
 
   /** Returns the Circuit object for this event. */
-  Circuit circuit() { return _circuit; }
+  Circuit circuit() const { return _circuit; }
   /** Returns the ID for this circuit event. */
-  quint64 id() { return _circuit.id(); }
+  quint64 id() const { return _circuit.id(); }
   /** Returns the status of this circuit event. */
-  Circuit::Status status() { return _circuit.status(); }
+  Circuit::Status status() const { return _circuit.status(); }
   /** Returns the path chosen for this circuit event.  */
-  QString path() { return _circuit.path(); }
+  QString path() const { return _circuit.path(); }
   
 private:
   /** Circuit object for this event. */

Modified: trunk/src/control/logevent.cpp
===================================================================
--- trunk/src/control/logevent.cpp	2007-11-26 21:10:46 UTC (rev 2141)
+++ trunk/src/control/logevent.cpp	2007-11-30 16:28:34 UTC (rev 2142)
@@ -77,14 +77,14 @@
 
 /** Returns the severity of this log event */
 LogEvent::Severity
-LogEvent::severity()
+LogEvent::severity() const
 {
   return _severity;
 }
 
 /** Returns the message for this log event */
 QString
-LogEvent::message()
+LogEvent::message() const
 {
   return _message;
 }

Modified: trunk/src/control/logevent.h
===================================================================
--- trunk/src/control/logevent.h	2007-11-26 21:10:46 UTC (rev 2141)
+++ trunk/src/control/logevent.h	2007-11-30 16:28:34 UTC (rev 2142)
@@ -57,9 +57,9 @@
   static QString severityToString(Severity severity);
 
   /** Returns the severity of this log event */
-  Severity severity();  
+  Severity severity() const; 
   /** Returns the message for this log event */
-  QString message();
+  QString message() const;
   
 private:
   Severity _severity;

Modified: trunk/src/control/newdescriptorevent.h
===================================================================
--- trunk/src/control/newdescriptorevent.h	2007-11-26 21:10:46 UTC (rev 2141)
+++ trunk/src/control/newdescriptorevent.h	2007-11-30 16:28:34 UTC (rev 2142)
@@ -41,7 +41,7 @@
   { _idList = idList; }
   
   /** Returns a list of new server IDs. */
-  QStringList descriptorIDs() { return _idList; }
+  QStringList descriptorIDs() const { return _idList; }
   
 private:
   /** A list of new descriptors available. */

Modified: trunk/src/control/stream.cpp
===================================================================
--- trunk/src/control/stream.cpp	2007-11-26 21:10:46 UTC (rev 2141)
+++ trunk/src/control/stream.cpp	2007-11-30 16:28:34 UTC (rev 2142)
@@ -122,7 +122,7 @@
 /** Returns a human-understandable string representation of this 
  * stream's status. */
 QString
-Stream::statusString()
+Stream::statusString() const
 {
   QString status;
   switch (_status) {
@@ -142,7 +142,7 @@
 
 /** Returns true if all fields in this Stream object are empty. */
 bool
-Stream::isEmpty()
+Stream::isEmpty() const
 {
   return (!_streamId && !_circuitId && 
           (_status == Unknown) && _address.isEmpty() && !_port);

Modified: trunk/src/control/stream.h
===================================================================
--- trunk/src/control/stream.h	2007-11-26 21:10:46 UTC (rev 2141)
+++ trunk/src/control/stream.h	2007-11-30 16:28:34 UTC (rev 2142)
@@ -65,22 +65,22 @@
   static Status toStatus(QString strStatus);
 
   /** Returns true if the Stream object's fields are all empty. */
-  bool isEmpty();
+  bool isEmpty() const;
   
   /** Returns the ID for this stream. */
-  quint64 id() { return _streamId; }
+  quint64 id() const { return _streamId; }
   /** Returns the status for this stream. */
-  Status status() { return _status; }
+  Status status() const { return _status; }
   /** Returns a string representation of this stream's status. */
-  QString statusString();
+  QString statusString() const;
   /** Returns the ID of the circuit to which this stream is assigned. */
-  quint64 circuitId() { return _circuitId; }
+  quint64 circuitId() const { return _circuitId; }
   /** Returns the target address and port for this stream. */
-  QString target() { return (_address + ":" + QString::number(_port)); }
+  QString target() const { return (_address + ":" + QString::number(_port)); }
   /** Returns the target address for this stream. */
-  QString targetAddress() { return _address; }
+  QString targetAddress() const { return _address; }
   /** Returns the target port for this stream. */
-  quint16 targetPort() { return _port; }
+  quint16 targetPort() const { return _port; }
 
 private:
   quint64 _streamId;   /**< Unique ID associated with this stream. */

Modified: trunk/src/control/streamevent.h
===================================================================
--- trunk/src/control/streamevent.h	2007-11-26 21:10:46 UTC (rev 2141)
+++ trunk/src/control/streamevent.h	2007-11-30 16:28:34 UTC (rev 2142)
@@ -43,15 +43,15 @@
   { _stream = stream; }
   
   /** Returns the Stream object for this stream event. */
-  Stream stream() { return _stream; }
+  Stream stream() const { return _stream; }
   /** Returns the ID for this stream event. */
-  quint64 id() { return _stream.id(); }
+  quint64 id() const { return _stream.id(); }
   /** Returns the status for this stream event. */
-  Stream::Status status() { return _stream.status(); }
+  Stream::Status status() const { return _stream.status(); }
   /** Returns the ID of the circuit to which this stream is assigned */
-  quint64 circuitId() { return _stream.circuitId(); }
+  quint64 circuitId() const { return _stream.circuitId(); }
   /** Returns the target for this stream event. */
-  QString target() { return _stream.target(); }
+  QString target() const { return _stream.target(); }
   
 private:
   Stream _stream; /**< Stream object for this stream event. */