46 PvlConstraints::PvlConstraints() {
55 PvlConstraints::PvlConstraints(
const QString &keyListFile) {
97 PvlConstraints::~PvlConstraints() {
108 int PvlConstraints::excludeSize()
const {
109 return (m_excludes.size());
120 int PvlConstraints::includeSize()
const {
121 return (m_includes.size());
134 int PvlConstraints::keyListSize()
const {
135 return (m_keylist.size());
151 void PvlConstraints::addExclude(
const QString &name) {
152 m_excludes.append(name);
167 void PvlConstraints::addInclude(
const QString &name) {
168 m_includes.append(name);
180 void PvlConstraints::addKeyToList(
const QString &name) {
181 m_keylist.append(name);
220 void PvlConstraints::addKeyToList(
const FileName &fileName) {
221 readKeyListFile(fileName);
236 bool PvlConstraints::isExcluded(
const QString &name)
const {
237 return (m_excludes.contains(name, Qt::CaseInsensitive));
251 bool PvlConstraints::isIncluded(
const QString &name)
const {
252 return (m_includes.contains(name, Qt::CaseInsensitive));
265 bool PvlConstraints::isKeyInList(
const QString &name)
const {
266 return (m_keylist.contains(name, Qt::CaseInsensitive));
321 void PvlConstraints::readKeyListFile(
const FileName &keyListFile) {
349 QString keywordName =
"";
350 while (keyList.GetLine(keywordName)) {
351 addKeyToList(keywordName);
454 return (contains(key.toLower()));
488 const int index)
const {
506 const QString &value) {
518 insert(key.
name().toLower(), key);
532 const QString &value) {
550 for (
int i = 0; i < key.
size(); i++) {
551 kw.value().addValue(key[i]);
558 for (
int i = 1; i < key.
size(); i++) {
575 return (
bool (
remove(key.toLower())));
594 const int &index)
const {
597 QString mess =
"Keyword " + key +
" does not exist!";
600 if (index >= k.value().size()) {
601 QString mess =
"Index " +
toString(index) +
" does not exist for keyword " + key +
"!";
605 return (k.value()[index]);
622 const QString &defValue,
623 const int &index)
const {
625 if (end() == k || index >= k.value().size()) {
629 return (k.value()[index]);
680 QString mess =
"Keyword " + key +
" does not exist!";
700 while ( keys != other.end() ) {
754 bool isExcluded = constraints.
isExcluded(
object.name());
755 bool isIncluded = constraints.
isIncluded(
object.name());
767 else if ( isExcluded ) {
782 PvlObject::ConstPvlObjectIterator objs;
783 for (objs =
object.beginObject() ; objs !=
object.endObject() ; ++objs) {
810 PvlObject::ConstPvlGroupIterator group;
811 for (group =
object.beginGroup() ; group !=
object.endGroup() ; group++) {
853 else if ( isExcluded ) {
897 for (key = pvl.
begin() ; key != pvl.
end() ; ++key) {
906 for (key = pvl.
begin() ; key != pvl.
end() ; ++key) {
bool isIncluded(const QString &name) const
Determines if a PvlObject or PvlGroup is included.
PvlKeywordIterator end()
Return the ending iterator.
Unless noted otherwise, the portions of Isis written by the USGS are public domain.
bool isNull(const QString &key, const int index=0) const
Determines if the value of a keyword is Null.
QString operator()(const QString &name) const
Gets the first value of a keyword in the PvlFlatMap.
Contains more than one keyword-value pair.
void addInclude(const QString &name)
Adds a PvlObject/PvlGroup inclusion constraint.
File name manipulation and expansion.
void add(const QString &key, const QString &value)
Adds PvlKeyword with the given name and value to the PvlFlatMap.
int includeSize() const
Returns the number of PvlObjects and PvlGroups to include.
PvlKeywordIterator begin()
Return the beginning iterator.
Namespace for the standard library.
bool exists(const QString &key) const
Determines whether a given keyword exists in the PvlFlatMap.
PvlKeyword keyword(const QString &key) const
Finds a keyword in the PvlFlatMap.
int loadKeywords(const PvlContainer &pvl, const PvlConstraints &constraints)
Loads PvlKeywords within a PvlContainer into the PvlFlatMap.
QString toString(bool boolToConvert)
Global function to convert a boolean to a string.
void addExclude(const QString &name)
Adds a PvlObject/PvlGroup exclusion constraint.
This error is for when a programmer made an API call that was illegal.
QStringList allValues(const QString &key) const
Gets all the values associated with a keyword in the PvlFlatMap.
QString name() const
Returns the container name.
int keyListSize() const
Returns the number of PvlKeywords to include.
int size() const
Returns the number of values stored in this keyword.
QString get(const QString &key, const int &index=0) const
Gets the value of a keyword in the PvlFlatMap.
Provides a flat map of PvlKeywords.
bool isKeyInList(const QString &name) const
Determines if a PvlKeyword is included.
virtual ~PvlFlatMap()
Destructor.
bool isExcluded(const QString &name) const
Determines if a PvlObject or PvlGroup is excluded.
Contains multiple PvlContainers.
#define _FILEINFO_
Macro for the filename and line number.
void append(const PvlKeyword &key)
Appends the given PvlKeyword's values to the PvlFlatMap.
A single keyword-value pair.
QString expanded() const
Returns a QString of the full file name including the file path, excluding the attributes.
This class can be used to define import/export behavior of Pvl structures when used in the PvlFlatMap...
static QStringList keywordValues(const PvlKeyword &keyword)
Gets all of a PvlKeyword's values.
QMap< QString, PvlKeyword >::iterator PvlFlatMapIterator
An iterator for the underlying QMap that PvlFlatMap is built on.
int merge(const PvlFlatMap &other)
Adds the keywords from another PvlFlatMap.
int loadGroups(const PvlObject &object, const PvlConstraints &constraints)
Loads PvlGroups into the PvlFlatMap.
Provides access to sequential ASCII stream I/O.
bool erase(const QString &key)
Erases a keyword from the PvlFlatMap.
QString name() const
Returns the keyword name.
Namespace for ISIS/Bullet specific routines.
PvlFlatMap()
Default constructor.
int excludeSize() const
Returns the number of PvlObjects and PvlGroups to exclude.
QList< PvlKeyword >::const_iterator ConstPvlKeywordIterator
The const keyword iterator.
Contains Pvl Groups and Pvl Objects.
int loadObject(const PvlObject &object, const PvlConstraints &constraints)
Loads PvlObjects into the PvlFlatMap.
int count(const QString &key) const
Returns the number of values associated with a given keyword.
int loadGroup(const PvlGroup &group, const PvlConstraints &constraints)
Loads a PvlGroup into the PvlFlatMap.