// Tencent is pleased to support the open source community by making RapidJSON available. // // Copyright (C) 2015 THL A29 Limited, a Tencent company, and Milo Yip. All rights reserved. // // Licensed under the MIT License (the "License"); you may not use this file except // in compliance with the License. You may obtain a copy of the License at // // http://opensource.org/licenses/MIT // // Unless required by applicable law or agreed to in writing, software distributed // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR // CONDITIONS OF ANY KIND, either express or implied. See the License for the // specific language governing permissions and limitations under the License.
if (!empty) {
Base::os_->Put('\n');
WriteIndent();
} bool ret = Base::WriteEndObject();
(void)ret;
RAPIDJSON_ASSERT(ret == true); if (Base::level_stack_.Empty()) // end of json text
Base::os_->Flush(); returntrue;
}
if (!empty) {
Base::os_->Put('\n');
WriteIndent();
} bool ret = Base::WriteEndArray();
(void)ret;
RAPIDJSON_ASSERT(ret == true); if (Base::level_stack_.Empty()) // end of json text
Base::os_->Flush(); returntrue;
}
//@} protected: void PrettyPrefix(Type type) {
(void)type; if (Base::level_stack_.GetSize() != 0) { // this value is not at root typename Base::Level* level = Base::level_stack_.template Top<typename Base::Level>();
if (level->inArray) { if (level->valueCount > 0) {
Base::os_->Put(','); // add comma if it is not the first element in array
Base::os_->Put('\n');
} else
Base::os_->Put('\n');
WriteIndent();
} else { // in object if (level->valueCount > 0) { if (level->valueCount % 2 == 0) {
Base::os_->Put(',');
Base::os_->Put('\n');
} else {
Base::os_->Put(':');
Base::os_->Put(' ');
}
} else
Base::os_->Put('\n');
if (level->valueCount % 2 == 0)
WriteIndent();
} if (!level->inArray && level->valueCount % 2 == 0)
RAPIDJSON_ASSERT(type == kStringType); // if it's in object, then even number should be a name
level->valueCount++;
} else {
RAPIDJSON_ASSERT(!Base::hasRoot_); // Should only has one and only one root.
Base::hasRoot_ = true;
}
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.