Fixed a bad crash that occured when adding a new game target in the launcher

svn-id: r13428
This commit is contained in:
Max Horn 2004-03-29 19:15:23 +00:00
parent 443c7cdb25
commit b6d911a616
2 changed files with 36 additions and 19 deletions

View File

@ -240,9 +240,10 @@ void ConfigManager::writeDomain(FILE *file, const String &name, const Domain &do
const String &value = x->_value;
if (!value.isEmpty()) {
// Write comment (if any)
comment = domain.getKVComment(x->_key);
if (!comment.isEmpty())
if (domain.hasKVComment(x->_key)) {
comment = domain.getKVComment(x->_key);
fprintf(file, "%s", comment.c_str());
}
// Write the key/value pair
fprintf(file, "%s=%s\n", x->_key.c_str(), value.c_str());
}
@ -451,4 +452,30 @@ bool ConfigManager::hasGameDomain(const String &domain) const {
return _gameDomains.contains(domain);
}
#pragma mark -
const String &ConfigManager::Domain::get(const String &key) const {
Node *node = findNode(_root, key);
return node ? node->_value : String::emptyString;
}
void ConfigManager::Domain::setDomainComment(const String &comment) {
_domainComment = comment;
}
const String &ConfigManager::Domain::getDomainComment() const {
return _domainComment;
}
void ConfigManager::Domain::setKVComment(const String &key, const String &comment) {
_keyValueComments[key] = comment;
}
const String &ConfigManager::Domain::getKVComment(const String &key) const {
return _keyValueComments[key];
}
bool ConfigManager::Domain::hasKVComment(const String &key) const {
return _keyValueComments.contains(key);
}
} // End of namespace Common

View File

@ -54,26 +54,16 @@ public:
private:
StringMap _keyValueComments;
String _domainComment;
public:
const String &get(const String &key) const;
const String &get(const String &key) const {
Node *node = findNode(_root, key);
return node ? node->_value : String::emptyString;
}
void setDomainComment(const String &comment);
const String &getDomainComment() const;
void setDomainComment(const String &comment) {
_domainComment = comment;
}
const String &getDomainComment() const {
return _domainComment;
}
void setKVComment(const String &key, const String &comment) {
_keyValueComments[key] = comment;
}
const String &getKVComment(const String &key) const {
return _keyValueComments[key];
}
void setKVComment(const String &key, const String &comment);
const String &getKVComment(const String &key) const;
bool hasKVComment(const String &key) const;
};
typedef Map<String, Domain, IgnoreCaseComparator> DomainMap;