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) {
348 TextFile keyList(keyListFile.expanded());
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() ) {
721 for (
int i = 0 ; i < keyword.
size() ; i++) {
722 values << keyword[i];
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) {
QStringList allValues(const QString &key) const
Gets all the values associated with a keyword in the PvlFlatMap.
PvlKeywordIterator end()
Return the ending iterator.
int size() const
Returns the number of values stored in this keyword.
bool isNull(const QString &key, const int index=0) const
Determines if the value of a keyword is Null.
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.
PvlKeywordIterator begin()
Return the beginning iterator.
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.
QString operator()(const QString &name) const
Gets the first value of a keyword in the PvlFlatMap.
int count(const QString &key) const
Returns the number of values associated with a given keyword.
bool isExcluded(const QString &name) const
Determines if a PvlObject or PvlGroup is excluded.
Provides a flat map of PvlKeywords.
virtual ~PvlFlatMap()
Destructor.
Contains multiple PvlContainers.
#define _FILEINFO_
Macro for the filename and line number.
QString name() const
Returns the keyword name.
void append(const PvlKeyword &key)
Appends the given PvlKeyword's values to the PvlFlatMap.
A single keyword-value pair.
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 includeSize() const
Returns the number of PvlObjects and PvlGroups to include.
int merge(const PvlFlatMap &other)
Adds the keywords from another PvlFlatMap.
int loadGroups(const PvlObject &object, const PvlConstraints &constraints)
Loads PvlGroups into the PvlFlatMap.
int keyListSize() const
Returns the number of PvlKeywords to include.
Provides access to sequential ASCII stream I/O.
PvlKeyword keyword(const QString &key) const
Finds a keyword in the PvlFlatMap.
bool erase(const QString &key)
Erases a keyword from the PvlFlatMap.
int excludeSize() const
Returns the number of PvlObjects and PvlGroups to exclude.
PvlFlatMap()
Default constructor.
QList< PvlKeyword >::const_iterator ConstPvlKeywordIterator
The const keyword iterator.
Contains Pvl Groups and Pvl Objects.
bool exists(const QString &key) const
Determines whether a given keyword exists in the PvlFlatMap.
bool isKeyInList(const QString &name) const
Determines if a PvlKeyword is included.
QString get(const QString &key, const int &index=0) const
Gets the value of a keyword in the PvlFlatMap.
int loadObject(const PvlObject &object, const PvlConstraints &constraints)
Loads PvlObjects into the PvlFlatMap.
bool isIncluded(const QString &name) const
Determines if a PvlObject or PvlGroup is included.
QString name() const
Returns the container name.
int loadGroup(const PvlGroup &group, const PvlConstraints &constraints)
Loads a PvlGroup into the PvlFlatMap.