12#include "IException.h"
15#include "PvlContainer.h"
16#include "PvlFlatMap.h"
18#include "PvlKeyword.h"
220 return (
m_excludes.contains(name, Qt::CaseInsensitive));
235 return (
m_includes.contains(name, Qt::CaseInsensitive));
249 return (
m_keylist.contains(name, Qt::CaseInsensitive));
332 QString keywordName =
"";
333 while (
keyList.GetLine(keywordName)) {
437 return (contains(key.toLower()));
471 const int index)
const {
489 const QString &value) {
501 insert(key.
name().toLower(), key);
515 const QString &value) {
533 for (
int i = 0; i < key.
size(); i++) {
534 kw.value().addValue(key[i]);
541 for (
int i = 1; i < key.
size(); i++) {
558 return (
bool (remove(key.toLower())));
577 const int &index)
const {
580 QString mess =
"Keyword " + key +
" does not exist!";
583 if (index >= k.value().size()) {
584 QString mess =
"Index " +
toString(index) +
" does not exist for keyword " + key +
"!";
588 return (k.value()[index]);
605 const QString &defValue,
606 const int &index)
const {
608 if (end() == k || index >= k.value().size()) {
612 return (k.value()[index]);
663 QString mess =
"Keyword " + key +
" does not exist!";
683 while ( keys != other.end() ) {
735 int nconsts = constraints.excludeSize() + constraints.includeSize();
737 bool isExcluded = constraints.isExcluded(
object.name());
738 bool isIncluded = constraints.isIncluded(
object.name());
739 bool hasBoth = (constraints.excludeSize() > 0) &&
740 (constraints.includeSize() > 0);
750 else if ( isExcluded ) {
753 else if ( constraints.includeSize() > 0 ) {
765 PvlObject::ConstPvlObjectIterator objs;
766 for (objs =
object.beginObject() ; objs !=
object.endObject() ; ++objs) {
793 PvlObject::ConstPvlGroupIterator group;
794 for (group =
object.beginGroup() ; group !=
object.endGroup() ; group++) {
822 int nconsts = constraints.excludeSize() + constraints.includeSize();
824 bool isExcluded = constraints.isExcluded(group.
name());
825 bool isIncluded = constraints.isIncluded(group.
name());
826 bool hasBoth = (constraints.excludeSize() > 0) &&
827 (constraints.includeSize() > 0);
836 else if ( isExcluded ) {
839 else if ( constraints.includeSize() > 0 ) {
879 if ( constraints.keyListSize() > 0 ) {
880 for (key = pvl.begin() ; key != pvl.end() ; ++key) {
881 if ( constraints.isKeyInList(key->name()) ) {
889 for (key = pvl.begin() ; key != pvl.end() ; ++key) {
File name manipulation and expansion.
@ Programmer
This error is for when a programmer made an API call that was illegal.
This class can be used to define import/export behavior of Pvl structures when used in the PvlFlatMap...
const QStringList & includes() const
Returns the PvlObject/PvlGroup inclusion constraints.
bool isKeyInList(const QString &name) const
Determines if a PvlKeyword is included.
void addInclude(const QString &name)
Adds a PvlObject/PvlGroup inclusion constraint.
void readKeyListFile(const FileName &fname)
Reads PvlKeyword inclusion constraints from a file.
const QStringList & excludes() const
Returns the PvlObject/PvlGroup exclusion constraints.
const QStringList & keyList() const
Returns the PvlKeyword inclusion constraints.
QStringList m_excludes
The names of objects and groups excluded (Excludes keyword)
bool isIncluded(const QString &name) const
Determines if a PvlObject or PvlGroup is included.
void addExclude(const QString &name)
Adds a PvlObject/PvlGroup exclusion constraint.
int excludeSize() const
Returns the number of PvlObjects and PvlGroups to exclude.
QStringList m_includes
The names of objects and groups included (Includes keyword)
int keyListSize() const
Returns the number of PvlKeywords to include.
int includeSize() const
Returns the number of PvlObjects and PvlGroups to include.
static PvlConstraints withExcludes(const QStringList &excludes)
Static method to construct a PvlConstraints object from a list of names for the PvlObjects and PvlGro...
static PvlConstraints withIncludes(const QStringList &includes)
Static method to construct a PvlConstraints object from a list of names for the PvlObjects and PvlGro...
void addKeyToList(const QString &name)
Adds a PvlKeyword inclusion constraint.
virtual ~PvlConstraints()
Destructor.
QStringList m_keylist
The names of keywords to exclusively include (KeyListFile)
PvlConstraints()
Default constructor for an empty PvlConstraints object.
bool isExcluded(const QString &name) const
Determines if a PvlObject or PvlGroup is excluded.
Contains more than one keyword-value pair.
QList< PvlKeyword >::const_iterator ConstPvlKeywordIterator
The const keyword iterator.
QString name() const
Returns the container name.
Provides a flat map of PvlKeywords.
void append(const PvlKeyword &key)
Appends the given PvlKeyword's values to the PvlFlatMap.
PvlKeyword keyword(const QString &key) const
Finds a keyword in the PvlFlatMap.
void add(const QString &key, const QString &value)
Adds PvlKeyword with the given name and value to the PvlFlatMap.
QString operator()(const QString &name) const
Gets the first value of a keyword in the PvlFlatMap.
QStringList allValues(const QString &key) const
Gets all the values associated with a keyword in the PvlFlatMap.
int count(const QString &key) const
Returns the number of values associated with a given keyword.
QString get(const QString &key, const int &index=0) const
Gets the value of a keyword in the PvlFlatMap.
int merge(const PvlFlatMap &other)
Adds the keywords from another PvlFlatMap.
bool erase(const QString &key)
Erases a keyword from the PvlFlatMap.
bool exists(const QString &key) const
Determines whether a given keyword exists in the PvlFlatMap.
virtual ~PvlFlatMap()
Destructor.
int loadGroups(const PvlObject &object, const PvlConstraints &constraints)
Loads PvlGroups into the PvlFlatMap.
PvlFlatMap()
Default constructor.
bool isNull(const QString &key, const int index=0) const
Determines if the value of a keyword is Null.
static QStringList keywordValues(const PvlKeyword &keyword)
Gets all of a PvlKeyword's values.
int loadKeywords(const PvlContainer &pvl, const PvlConstraints &constraints)
Loads PvlKeywords within a PvlContainer into the PvlFlatMap.
QMap< QString, PvlKeyword >::iterator PvlFlatMapIterator
An iterator for the underlying QMap that PvlFlatMap is built on.
int loadGroup(const PvlGroup &group, const PvlConstraints &constraints)
Loads a PvlGroup into the PvlFlatMap.
int loadObject(const PvlObject &object, const PvlConstraints &constraints)
Loads PvlObjects into the PvlFlatMap.
Contains multiple PvlContainers.
A single keyword-value pair.
QString name() const
Returns the keyword name.
int size() const
Returns the number of values stored in this keyword.
Contains Pvl Groups and Pvl Objects.
Provides access to sequential ASCII stream I/O.
This is free and unencumbered software released into the public domain.
This is free and unencumbered software released into the public domain.
QString toString(bool boolToConvert)
Global function to convert a boolean to a string.
Namespace for the standard library.