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)) {
353 QMap<QString, PvlKeyword> () {
375 QMap<QString, PvlKeyword> () {
396 QMap<QString, PvlKeyword> () {
417 QMap<QString, PvlKeyword> () {
437 return (contains(key.toLower()));
471 const int index)
const {
489 const QString &value) {
490 add(PvlKeyword(key, value));
501 insert(key.name().toLower(), key);
515 const QString &value) {
516 append(PvlKeyword(key, value));
530 if (
exists(key.name()) ) {
533 for (
int i = 0; i < key.size(); i++) {
534 kw.value().addValue(key[i]);
538 insert(key.name().toLower(), PvlKeyword(key.name(), key[0]));
541 for (
int i = 1; i < key.size(); i++) {
542 append(key.name(), key[i]);
558 return (
bool (remove(key.toLower())));
577 const int &index)
const {
580 QString mess =
"Keyword " + key +
" does not exist!";
581 throw IException(IException::Programmer, mess, _FILEINFO_);
583 if (index >= k.value().size()) {
584 QString mess =
"Index " +
toString(index) +
" does not exist for keyword " + key +
"!";
585 throw IException(IException::Programmer, mess, _FILEINFO_);
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!";
664 throw IException(IException::Programmer, mess, _FILEINFO_);
683 while ( keys != other.end() ) {
704 for (
int i = 0 ; i <
keyword.size() ; i++) {
737 bool isExcluded = constraints.
isExcluded(
object.name());
738 bool isIncluded = constraints.
isIncluded(
object.name());
750 else if ( isExcluded ) {
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++) {
824 bool isExcluded = constraints.
isExcluded(group.name());
825 bool isIncluded = constraints.
isIncluded(group.name());
836 else if ( isExcluded ) {
875 PvlContainer::ConstPvlKeywordIterator key;
880 for (key = pvl.begin() ; key != pvl.end() ; ++key) {
889 for (key = pvl.begin() ; key != pvl.end() ; ++key) {
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.
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.
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(const LinearAlgebra::Vector &vector, int precision)
A global function to format LinearAlgebra::Vector as a QString with the given precision.
Namespace for the standard library.