Permalink
Browse files

Add const-correct overloads to Fragment.

Change-Id: I5cf787f7484881d8488536dfb2424c7115f1e1c7
  • Loading branch information...
1 parent 07506a8 commit ad1a4a899d24ad191ea92cd05fa1197e6031bedd @allisonvacanti allisonvacanti committed Oct 10, 2011
Showing with 26 additions and 0 deletions.
  1. +10 −0 libavogadro/src/fragment.cpp
  2. +16 −0 libavogadro/src/fragment.h
@@ -61,6 +61,11 @@ namespace Avogadro {
return m_atoms;
}
+ const QList<unsigned long> & Fragment::atoms() const
+ {
+ return m_atoms;
+ }
+
void Fragment::addBond(unsigned long id)
{
if (!m_bonds.contains(id)) {
@@ -81,4 +86,9 @@ namespace Avogadro {
return m_bonds;
}
+ const QList<unsigned long> & Fragment::bonds() const
+ {
+ return m_bonds;
+ }
+
} // End namespace
View
@@ -73,6 +73,12 @@ namespace Avogadro {
inline QString name() { return m_name; }
/**
+ * @return the name of the fragment.
+ * @note Replaces GetName().
+ */
+ inline const QString & name() const { return m_name; }
+
+ /**
* Set the name of the fragment.
*/
inline void setName(QString name) { m_name = name; }
@@ -93,6 +99,11 @@ namespace Avogadro {
QList<unsigned long> atoms();
/**
+ * @return QList of the unique ids of the atoms in this Fragment.
+ */
+ const QList<unsigned long> & atoms() const;
+
+ /**
* Add a Bond to the Fragment.
*/
void addBond(unsigned long id);
@@ -107,6 +118,11 @@ namespace Avogadro {
*/
QList<unsigned long> bonds();
+ /**
+ * @return QList of the unique ids of the bonds in this Fragment.
+ */
+ const QList<unsigned long> & bonds() const;
+
friend class Molecule;
protected:

0 comments on commit ad1a4a8

Please sign in to comment.