14using std::ostringstream;
31 DbProfile::DbProfile(
PvlContainer &pvl) : _name(
"Profile"), _keys() {
61 const QString &name) : _name(prof1.Name()),
63 for(
int nk = 0 ; nk < prof2._keys.size() ; nk++) {
64 _keys.
add(prof2._keys.key(nk), prof2._keys.getNth(nk));
152 mess <<
"Error fetching value from key " <<
key;
154 mess <<
" (index=" << nth <<
")";
186 for(
key = pvl.begin() ;
key != pvl.end() ; ++
key) {
192 void DbProfile::printOn(std::ostream &o)
const {
195 typedef CollectorMap<long, const PvlKeyword *> OrderedKeys;
197 DbProfileKeyList::CollectorConstIter keys;
198 for(keys = begin() ; keys != end() ; ++keys) {
199 const DbProfileKey &pk = keys->second;
200 okeys.add(pk._index, &pk.key);
204 PvlGroup propGroup(_group);
205 OrderedKeys::CollectorConstIter okItr;
206 for(okItr = okeys.begin() ; okItr != okeys.end() ; ++okItr) {
207 propGroup.addKeyword(*(okItr->second));
210 o << propGroup << std::endl;
int remove(const K &key)
Removes and entry from the list.
T & get(const K &key)
Returns the value associated with the name provided.
bool exists(const K &key) const
Checks the existance of a particular key in the list.
void add(const K &key, const T &value)
Adds the element to the list.
A DbProfile is a container for access parameters to a database.
QString _name
Name of this profile.
void add(const QString &key, const QString &value="")
Adds a keyword and value pair to the profile.
KeyList _keys
List of keys in profile.
QString value(const QString &key, int nth=0) const
Returns the specified value for the given keyword.
QString operator()(const QString &key, int nth=0) const
Returns the specified value for the given keyword.
void remove(const QString &key)
Removes a keyword from the profile.
void loadkeys(PvlContainer &pvl)
Loads DbProfile keys from the given Pvl construct.
QString key(int nth) const
Returns the nth key in the profile.
void replace(const QString &key, const QString &value="")
Adds a keyword and value pair to the profile.
int count(const QString &key) const
Report number of values in keyword.
@ Programmer
This error is for when a programmer made an API call that was illegal.
Contains more than one keyword-value pair.
QList< PvlKeyword >::iterator PvlKeywordIterator
The keyword iterator.
A single keyword-value pair.
int size() const
Returns the number of values stored in this keyword.
void addValue(QString value, QString unit="")
Adds a value with units.
This is free and unencumbered software released into the public domain.