r19929 by jghali - add const qualifier to a few TransactionState functions

scribus-commit scribus-commit at lists.scribus.net
Sun Mar 15 23:59:52 UTC 2015


Author: jghali
Date: Sun Mar 15 23:59:52 2015
New Revision: 19929

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=19929
Log:
add const qualifier to a few TransactionState functions 

Modified:
    trunk/Scribus/scribus/undostate.cpp
    trunk/Scribus/scribus/undostate.h

Modified: trunk/Scribus/scribus/undostate.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19929&path=/trunk/Scribus/scribus/undostate.cpp
==============================================================================
--- trunk/Scribus/scribus/undostate.cpp (original)
+++ trunk/Scribus/scribus/undostate.cpp Sun Mar 15 23:59:52 2015
@@ -205,7 +205,7 @@
 	size_ = 0;
 }
 
-UndoState* TransactionState::at(int index)
+UndoState* TransactionState::at(int index) const
 {
 	if (index >= 0 && static_cast<uint>(index) < sizet())
 		return states_[index];
@@ -213,6 +213,13 @@
 		return 0;
 }
 
+UndoState* TransactionState::last() const
+{
+	if (states_.size() > 0)
+		return states_.at(size_ - 1);
+	return 0;
+}
+
 bool TransactionState::contains(int uid) const
 {
 	for (uint i = 0; i < states_.size(); ++i)
@@ -245,7 +252,7 @@
 	}
 }
 
-uint TransactionState::sizet()
+uint TransactionState::sizet() const
 {
 	return size_;
 }

Modified: trunk/Scribus/scribus/undostate.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19929&path=/trunk/Scribus/scribus/undostate.h
==============================================================================
--- trunk/Scribus/scribus/undostate.h (original)
+++ trunk/Scribus/scribus/undostate.h Sun Mar 15 23:59:52 2015
@@ -342,8 +342,10 @@
 	 * @brief Returns the count of the <code>UndoState</code> objects in this transaction.
 	 * @return count of the <code>UndoState</code> objects in this transaction
 	 */
-	uint sizet();
-	/** @brief Use the name from last action added to this <code>TransactionState</code> */
+	uint sizet() const;
+	/**
+	 * @brief Use the name from last action added to this <code>TransactionState</code>
+	 */
 	void useActionName();
 	/**
 	 * @brief Returns an <code>UndoState</code> object at <code>index</code>.
@@ -352,7 +354,12 @@
 	 * @return <code>UndoState</code> object from <code>index</code> or <code>NULL</code>
 	 * if <code>index</code> is out of scope.
 	 */
-	UndoState* at(int index);
+	UndoState* at(int index) const;
+	/**
+	 * @brief Returns the last UndoState in transaction.
+	 * @return a valid UndoState pointer or 0 if transaction is empty.
+	 */
+	UndoState* last() const;
 	/**
 	 * @brief Returns true if this transaction contains UndoObject with the id <code>uid</code>
 	 * @brief otherwise returns false.




More information about the scribus-commit mailing list