Commit bff50de1 authored by JINMEI Tatuya's avatar JINMEI Tatuya
Browse files

format fix for Message::toText()


git-svn-id: svn://bind10.isc.org/svn/bind10/branches/parkinglot@543 e5f2f494-b856-4b98-b285-d166d9295462
parent 5c8f340a
......@@ -447,12 +447,10 @@ struct SectionFormatter
section_(section), output_(output) {}
void operator()(const T& entry)
{
output_ += ";; " + string(sectiontext[section_.getCode()]) +
" SECTION:\n";
if (section_ == Section::QUESTION()) {
output_ += ";";
}
output_ += entry->toText() + "\n";
output_ += entry->toText();
}
const Section& section_;
string& output_;
......@@ -493,23 +491,32 @@ Message::toText() const
lexical_cast<string>(impl_->counts_[Section::AUTHORITY().getCode()]);
s += ", ADDITIONAL: " +
lexical_cast<string>(impl_->counts_[Section::ADDITIONAL().getCode()])
+ "\n\n";
+ "\n";
if (!impl_->questions_.empty()) {
s += "\n;; " +
string(sectiontext[Section::QUESTION().getCode()]) + " SECTION:\n";
for_each(impl_->questions_.begin(), impl_->questions_.end(),
SectionFormatter<QuestionPtr>(Section::QUESTION(), s));
}
if (!impl_->rrsets_[sectionCodeToId(Section::ANSWER())].empty()) {
s += "\n;; " +
string(sectiontext[Section::ANSWER().getCode()]) + " SECTION:\n";
for_each(impl_->rrsets_[sectionCodeToId(Section::ANSWER())].begin(),
impl_->rrsets_[sectionCodeToId(Section::ANSWER())].end(),
SectionFormatter<RRsetPtr>(Section::ANSWER(), s));
}
if (!impl_->rrsets_[sectionCodeToId(Section::AUTHORITY())].empty()) {
s += "\n;; " +
string(sectiontext[Section::AUTHORITY().getCode()]) + " SECTION:\n";
for_each(impl_->rrsets_[sectionCodeToId(Section::AUTHORITY())].begin(),
impl_->rrsets_[sectionCodeToId(Section::AUTHORITY())].end(),
SectionFormatter<RRsetPtr>(Section::AUTHORITY(), s));
}
if (!impl_->rrsets_[sectionCodeToId(Section::ADDITIONAL())].empty()) {
s += "\n;; " +
string(sectiontext[Section::ADDITIONAL().getCode()]) +
" SECTION:\n";
for_each(impl_->rrsets_[sectionCodeToId(Section::ADDITIONAL())].begin(),
impl_->rrsets_[sectionCodeToId(Section::ADDITIONAL())].end(),
SectionFormatter<RRsetPtr>(Section::ADDITIONAL(), s));
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment