Commit 381b6962 authored by Summer Stapleton's avatar Summer Stapleton Committed by Makayla Shepherd
Browse files

Added PvlTranslationTable::validateTable() called by the AddTable() methods. Fixes #4900

parent 8f8022b1
Loading
Loading
Loading
Loading
+14 −8
Original line number Diff line number Diff line
@@ -85,19 +85,26 @@ namespace Isis {
   */
  void PvlTranslationTable::AddTable(const QString &transFile) {
    p_trnsTbl.read(FileName(transFile).expanded());
    validateTable();
  }


  /**
   * Adds the contents of a translation table to the searchable groups/keys
   * Also performs a verification, to ensure that the translation table
   * is valid
   *
   * @param transStm The stream to be added.
   */
  void PvlTranslationTable::AddTable(std::istream &transStm) {
    transStm >> p_trnsTbl;
    validateTable();
  }


  /**
  * Performs verification to ensure that p_trnsTbl is valid
  *
  */
  void PvlTranslationTable::validateTable() {
    // pair< name, size > of acceptable keywords.
    // A size of -1 means non-zero size.
    vector< pair<QString, int> > validKeywordSizes = validKeywords();
@@ -458,4 +465,3 @@ namespace Isis {
    return "";
  }
} // end namespace isis
+9 −3
Original line number Diff line number Diff line
@@ -110,6 +110,9 @@ namespace Isis {
   *                          renamed later) now returns a PvlKeyword.
   *  @history 2017-11-04 Jeannie Backer - Modified Translation input value to make a case
   *                          insensitive comparison.
   *  @history 2018-01-09 Summer Stapleton - Added validateTable() method called by both
   *                          AddTable() methods to check for validity of table being added by
   *                          either method. Fixes #4900.
   *
   *
   *
@@ -154,6 +157,9 @@ namespace Isis {
      PvlKeyword &OutputPosition(const QString nName);
      QString OutputName(const QString nName);

      // Ensures that added table entries are valid
      void validateTable();

    private:
      Pvl p_trnsTbl;
  };