DeepCover Embedded Security in IoT: Public-key Secured Data Paths

Dependencies:   MaximInterface

The MAXREFDES155# is an internet-of-things (IoT) embedded-security reference design, built to authenticate and control a sensing node using elliptic-curve-based public-key cryptography with control and notification from a web server.

The hardware includes an ARM® mbed™ shield and attached sensor endpoint. The shield contains a DS2476 DeepCover® ECDSA/SHA-2 coprocessor, Wifi communication, LCD push-button controls, and status LEDs. The sensor endpoint is attached to the shield using a 300mm cable and contains a DS28C36 DeepCover ECDSA/SHA-2 authenticator, IR-thermal sensor, and aiming laser for the IR sensor. The MAXREFDES155# is equipped with a standard Arduino® form-factor shield connector for immediate testing using an mbed board such as the MAX32600MBED#. The combination of these two devices represent an IoT device. Communication to the web server is accomplished with the shield Wifi circuitry. Communication from the shield to the attached sensor module is accomplished over I2C . The sensor module represents an IoT endpoint that generates small data with a requirement for message authenticity/integrity and secure on/off operational control.

The design is hierarchical with each mbed platform and shield communicating data from the sensor node to a web server that maintains a centralized log and dispatches notifications as necessary. The simplicity of this design enables rapid integration into any star-topology IoT network to provide security with the low overhead and cost provided by the ECDSA-P256 asymmetric-key and SHA-256 symmetric-key algorithms.

More information about the MAXREFDES155# is available on the Maxim Integrated website.

Committer:
IanBenzMaxim
Date:
Tue Dec 03 12:56:25 2019 -0600
Revision:
18:c2631e985780
Parent:
16:a004191a79ab
Updated MaximInterface to version 2.1.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
IanBenzMaxim 0:33d4e66780c0 1 // Tencent is pleased to support the open source community by making RapidJSON available.
IanBenzMaxim 0:33d4e66780c0 2 //
IanBenzMaxim 0:33d4e66780c0 3 // Copyright (C) 2015 THL A29 Limited, a Tencent company, and Milo Yip. All rights reserved.
IanBenzMaxim 0:33d4e66780c0 4 //
IanBenzMaxim 0:33d4e66780c0 5 // Licensed under the MIT License (the "License"); you may not use this file except
IanBenzMaxim 0:33d4e66780c0 6 // in compliance with the License. You may obtain a copy of the License at
IanBenzMaxim 0:33d4e66780c0 7 //
IanBenzMaxim 0:33d4e66780c0 8 // http://opensource.org/licenses/MIT
IanBenzMaxim 0:33d4e66780c0 9 //
IanBenzMaxim 0:33d4e66780c0 10 // Unless required by applicable law or agreed to in writing, software distributed
IanBenzMaxim 0:33d4e66780c0 11 // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
IanBenzMaxim 0:33d4e66780c0 12 // CONDITIONS OF ANY KIND, either express or implied. See the License for the
IanBenzMaxim 0:33d4e66780c0 13 // specific language governing permissions and limitations under the License.
IanBenzMaxim 0:33d4e66780c0 14
IanBenzMaxim 0:33d4e66780c0 15 #ifndef RAPIDJSON_PRETTYWRITER_H_
IanBenzMaxim 0:33d4e66780c0 16 #define RAPIDJSON_PRETTYWRITER_H_
IanBenzMaxim 0:33d4e66780c0 17
IanBenzMaxim 0:33d4e66780c0 18 #include "writer.h"
IanBenzMaxim 0:33d4e66780c0 19
IanBenzMaxim 0:33d4e66780c0 20 #ifdef __GNUC__
IanBenzMaxim 0:33d4e66780c0 21 RAPIDJSON_DIAG_PUSH
IanBenzMaxim 0:33d4e66780c0 22 RAPIDJSON_DIAG_OFF(effc++)
IanBenzMaxim 0:33d4e66780c0 23 #endif
IanBenzMaxim 0:33d4e66780c0 24
IanBenzMaxim 0:33d4e66780c0 25 #if defined(__clang__)
IanBenzMaxim 0:33d4e66780c0 26 RAPIDJSON_DIAG_PUSH
IanBenzMaxim 0:33d4e66780c0 27 RAPIDJSON_DIAG_OFF(c++98-compat)
IanBenzMaxim 0:33d4e66780c0 28 #endif
IanBenzMaxim 0:33d4e66780c0 29
IanBenzMaxim 0:33d4e66780c0 30 RAPIDJSON_NAMESPACE_BEGIN
IanBenzMaxim 0:33d4e66780c0 31
IanBenzMaxim 0:33d4e66780c0 32 //! Combination of PrettyWriter format flags.
IanBenzMaxim 0:33d4e66780c0 33 /*! \see PrettyWriter::SetFormatOptions
IanBenzMaxim 0:33d4e66780c0 34 */
IanBenzMaxim 0:33d4e66780c0 35 enum PrettyFormatOptions {
IanBenzMaxim 0:33d4e66780c0 36 kFormatDefault = 0, //!< Default pretty formatting.
IanBenzMaxim 0:33d4e66780c0 37 kFormatSingleLineArray = 1 //!< Format arrays on a single line.
IanBenzMaxim 0:33d4e66780c0 38 };
IanBenzMaxim 0:33d4e66780c0 39
IanBenzMaxim 0:33d4e66780c0 40 //! Writer with indentation and spacing.
IanBenzMaxim 0:33d4e66780c0 41 /*!
IanBenzMaxim 0:33d4e66780c0 42 \tparam OutputStream Type of ouptut os.
IanBenzMaxim 0:33d4e66780c0 43 \tparam SourceEncoding Encoding of source string.
IanBenzMaxim 0:33d4e66780c0 44 \tparam TargetEncoding Encoding of output stream.
IanBenzMaxim 0:33d4e66780c0 45 \tparam StackAllocator Type of allocator for allocating memory of stack.
IanBenzMaxim 0:33d4e66780c0 46 */
IanBenzMaxim 0:33d4e66780c0 47 template<typename OutputStream, typename SourceEncoding = UTF8<>, typename TargetEncoding = UTF8<>, typename StackAllocator = CrtAllocator, unsigned writeFlags = kWriteDefaultFlags>
IanBenzMaxim 0:33d4e66780c0 48 class PrettyWriter : public Writer<OutputStream, SourceEncoding, TargetEncoding, StackAllocator, writeFlags> {
IanBenzMaxim 0:33d4e66780c0 49 public:
IanBenzMaxim 0:33d4e66780c0 50 typedef Writer<OutputStream, SourceEncoding, TargetEncoding, StackAllocator> Base;
IanBenzMaxim 0:33d4e66780c0 51 typedef typename Base::Ch Ch;
IanBenzMaxim 0:33d4e66780c0 52
IanBenzMaxim 0:33d4e66780c0 53 //! Constructor
IanBenzMaxim 0:33d4e66780c0 54 /*! \param os Output stream.
IanBenzMaxim 0:33d4e66780c0 55 \param allocator User supplied allocator. If it is null, it will create a private one.
IanBenzMaxim 0:33d4e66780c0 56 \param levelDepth Initial capacity of stack.
IanBenzMaxim 0:33d4e66780c0 57 */
IanBenzMaxim 0:33d4e66780c0 58 explicit PrettyWriter(OutputStream& os, StackAllocator* allocator = 0, size_t levelDepth = Base::kDefaultLevelDepth) :
IanBenzMaxim 0:33d4e66780c0 59 Base(os, allocator, levelDepth), indentChar_(' '), indentCharCount_(4), formatOptions_(kFormatDefault) {}
IanBenzMaxim 0:33d4e66780c0 60
IanBenzMaxim 0:33d4e66780c0 61
IanBenzMaxim 0:33d4e66780c0 62 explicit PrettyWriter(StackAllocator* allocator = 0, size_t levelDepth = Base::kDefaultLevelDepth) :
IanBenzMaxim 0:33d4e66780c0 63 Base(allocator, levelDepth), indentChar_(' '), indentCharCount_(4) {}
IanBenzMaxim 0:33d4e66780c0 64
IanBenzMaxim 0:33d4e66780c0 65 #if RAPIDJSON_HAS_CXX11_RVALUE_REFS
IanBenzMaxim 0:33d4e66780c0 66 PrettyWriter(PrettyWriter&& rhs) :
IanBenzMaxim 0:33d4e66780c0 67 Base(std::forward<PrettyWriter>(rhs)), indentChar_(rhs.indentChar_), indentCharCount_(rhs.indentCharCount_), formatOptions_(rhs.formatOptions_) {}
IanBenzMaxim 0:33d4e66780c0 68 #endif
IanBenzMaxim 0:33d4e66780c0 69
IanBenzMaxim 0:33d4e66780c0 70 //! Set custom indentation.
IanBenzMaxim 0:33d4e66780c0 71 /*! \param indentChar Character for indentation. Must be whitespace character (' ', '\\t', '\\n', '\\r').
IanBenzMaxim 0:33d4e66780c0 72 \param indentCharCount Number of indent characters for each indentation level.
IanBenzMaxim 0:33d4e66780c0 73 \note The default indentation is 4 spaces.
IanBenzMaxim 0:33d4e66780c0 74 */
IanBenzMaxim 0:33d4e66780c0 75 PrettyWriter& SetIndent(Ch indentChar, unsigned indentCharCount) {
IanBenzMaxim 0:33d4e66780c0 76 RAPIDJSON_ASSERT(indentChar == ' ' || indentChar == '\t' || indentChar == '\n' || indentChar == '\r');
IanBenzMaxim 0:33d4e66780c0 77 indentChar_ = indentChar;
IanBenzMaxim 0:33d4e66780c0 78 indentCharCount_ = indentCharCount;
IanBenzMaxim 0:33d4e66780c0 79 return *this;
IanBenzMaxim 0:33d4e66780c0 80 }
IanBenzMaxim 0:33d4e66780c0 81
IanBenzMaxim 0:33d4e66780c0 82 //! Set pretty writer formatting options.
IanBenzMaxim 0:33d4e66780c0 83 /*! \param options Formatting options.
IanBenzMaxim 0:33d4e66780c0 84 */
IanBenzMaxim 0:33d4e66780c0 85 PrettyWriter& SetFormatOptions(PrettyFormatOptions options) {
IanBenzMaxim 0:33d4e66780c0 86 formatOptions_ = options;
IanBenzMaxim 0:33d4e66780c0 87 return *this;
IanBenzMaxim 0:33d4e66780c0 88 }
IanBenzMaxim 0:33d4e66780c0 89
IanBenzMaxim 0:33d4e66780c0 90 /*! @name Implementation of Handler
IanBenzMaxim 0:33d4e66780c0 91 \see Handler
IanBenzMaxim 0:33d4e66780c0 92 */
IanBenzMaxim 0:33d4e66780c0 93 //@{
IanBenzMaxim 0:33d4e66780c0 94
IanBenzMaxim 0:33d4e66780c0 95 bool Null() { PrettyPrefix(kNullType); return Base::WriteNull(); }
IanBenzMaxim 0:33d4e66780c0 96 bool Bool(bool b) { PrettyPrefix(b ? kTrueType : kFalseType); return Base::WriteBool(b); }
IanBenzMaxim 0:33d4e66780c0 97 bool Int(int i) { PrettyPrefix(kNumberType); return Base::WriteInt(i); }
IanBenzMaxim 0:33d4e66780c0 98 bool Uint(unsigned u) { PrettyPrefix(kNumberType); return Base::WriteUint(u); }
IanBenzMaxim 0:33d4e66780c0 99 bool Int64(int64_t i64) { PrettyPrefix(kNumberType); return Base::WriteInt64(i64); }
IanBenzMaxim 0:33d4e66780c0 100 bool Uint64(uint64_t u64) { PrettyPrefix(kNumberType); return Base::WriteUint64(u64); }
IanBenzMaxim 0:33d4e66780c0 101 bool Double(double d) { PrettyPrefix(kNumberType); return Base::WriteDouble(d); }
IanBenzMaxim 0:33d4e66780c0 102
IanBenzMaxim 0:33d4e66780c0 103 bool RawNumber(const Ch* str, SizeType length, bool copy = false) {
IanBenzMaxim 0:33d4e66780c0 104 RAPIDJSON_ASSERT(str != 0);
IanBenzMaxim 0:33d4e66780c0 105 (void)copy;
IanBenzMaxim 0:33d4e66780c0 106 PrettyPrefix(kNumberType);
IanBenzMaxim 0:33d4e66780c0 107 return Base::WriteString(str, length);
IanBenzMaxim 0:33d4e66780c0 108 }
IanBenzMaxim 0:33d4e66780c0 109
IanBenzMaxim 0:33d4e66780c0 110 bool String(const Ch* str, SizeType length, bool copy = false) {
IanBenzMaxim 0:33d4e66780c0 111 RAPIDJSON_ASSERT(str != 0);
IanBenzMaxim 0:33d4e66780c0 112 (void)copy;
IanBenzMaxim 0:33d4e66780c0 113 PrettyPrefix(kStringType);
IanBenzMaxim 0:33d4e66780c0 114 return Base::WriteString(str, length);
IanBenzMaxim 0:33d4e66780c0 115 }
IanBenzMaxim 0:33d4e66780c0 116
IanBenzMaxim 0:33d4e66780c0 117 #if RAPIDJSON_HAS_STDSTRING
IanBenzMaxim 0:33d4e66780c0 118 bool String(const std::basic_string<Ch>& str) {
IanBenzMaxim 0:33d4e66780c0 119 return String(str.data(), SizeType(str.size()));
IanBenzMaxim 0:33d4e66780c0 120 }
IanBenzMaxim 0:33d4e66780c0 121 #endif
IanBenzMaxim 0:33d4e66780c0 122
IanBenzMaxim 0:33d4e66780c0 123 bool StartObject() {
IanBenzMaxim 0:33d4e66780c0 124 PrettyPrefix(kObjectType);
IanBenzMaxim 0:33d4e66780c0 125 new (Base::level_stack_.template Push<typename Base::Level>()) typename Base::Level(false);
IanBenzMaxim 0:33d4e66780c0 126 return Base::WriteStartObject();
IanBenzMaxim 0:33d4e66780c0 127 }
IanBenzMaxim 0:33d4e66780c0 128
IanBenzMaxim 0:33d4e66780c0 129 bool Key(const Ch* str, SizeType length, bool copy = false) { return String(str, length, copy); }
IanBenzMaxim 0:33d4e66780c0 130
IanBenzMaxim 0:33d4e66780c0 131 #if RAPIDJSON_HAS_STDSTRING
IanBenzMaxim 0:33d4e66780c0 132 bool Key(const std::basic_string<Ch>& str) {
IanBenzMaxim 0:33d4e66780c0 133 return Key(str.data(), SizeType(str.size()));
IanBenzMaxim 0:33d4e66780c0 134 }
IanBenzMaxim 0:33d4e66780c0 135 #endif
IanBenzMaxim 0:33d4e66780c0 136
IanBenzMaxim 0:33d4e66780c0 137 bool EndObject(SizeType memberCount = 0) {
IanBenzMaxim 0:33d4e66780c0 138 (void)memberCount;
IanBenzMaxim 0:33d4e66780c0 139 RAPIDJSON_ASSERT(Base::level_stack_.GetSize() >= sizeof(typename Base::Level));
IanBenzMaxim 0:33d4e66780c0 140 RAPIDJSON_ASSERT(!Base::level_stack_.template Top<typename Base::Level>()->inArray);
IanBenzMaxim 0:33d4e66780c0 141 bool empty = Base::level_stack_.template Pop<typename Base::Level>(1)->valueCount == 0;
IanBenzMaxim 0:33d4e66780c0 142
IanBenzMaxim 0:33d4e66780c0 143 if (!empty) {
IanBenzMaxim 0:33d4e66780c0 144 Base::os_->Put('\n');
IanBenzMaxim 0:33d4e66780c0 145 WriteIndent();
IanBenzMaxim 0:33d4e66780c0 146 }
IanBenzMaxim 0:33d4e66780c0 147 bool ret = Base::WriteEndObject();
IanBenzMaxim 0:33d4e66780c0 148 (void)ret;
IanBenzMaxim 0:33d4e66780c0 149 RAPIDJSON_ASSERT(ret == true);
IanBenzMaxim 0:33d4e66780c0 150 if (Base::level_stack_.Empty()) // end of json text
IanBenzMaxim 0:33d4e66780c0 151 Base::os_->Flush();
IanBenzMaxim 0:33d4e66780c0 152 return true;
IanBenzMaxim 0:33d4e66780c0 153 }
IanBenzMaxim 0:33d4e66780c0 154
IanBenzMaxim 0:33d4e66780c0 155 bool StartArray() {
IanBenzMaxim 0:33d4e66780c0 156 PrettyPrefix(kArrayType);
IanBenzMaxim 0:33d4e66780c0 157 new (Base::level_stack_.template Push<typename Base::Level>()) typename Base::Level(true);
IanBenzMaxim 0:33d4e66780c0 158 return Base::WriteStartArray();
IanBenzMaxim 0:33d4e66780c0 159 }
IanBenzMaxim 0:33d4e66780c0 160
IanBenzMaxim 0:33d4e66780c0 161 bool EndArray(SizeType memberCount = 0) {
IanBenzMaxim 0:33d4e66780c0 162 (void)memberCount;
IanBenzMaxim 0:33d4e66780c0 163 RAPIDJSON_ASSERT(Base::level_stack_.GetSize() >= sizeof(typename Base::Level));
IanBenzMaxim 0:33d4e66780c0 164 RAPIDJSON_ASSERT(Base::level_stack_.template Top<typename Base::Level>()->inArray);
IanBenzMaxim 0:33d4e66780c0 165 bool empty = Base::level_stack_.template Pop<typename Base::Level>(1)->valueCount == 0;
IanBenzMaxim 0:33d4e66780c0 166
IanBenzMaxim 0:33d4e66780c0 167 if (!empty && !(formatOptions_ & kFormatSingleLineArray)) {
IanBenzMaxim 0:33d4e66780c0 168 Base::os_->Put('\n');
IanBenzMaxim 0:33d4e66780c0 169 WriteIndent();
IanBenzMaxim 0:33d4e66780c0 170 }
IanBenzMaxim 0:33d4e66780c0 171 bool ret = Base::WriteEndArray();
IanBenzMaxim 0:33d4e66780c0 172 (void)ret;
IanBenzMaxim 0:33d4e66780c0 173 RAPIDJSON_ASSERT(ret == true);
IanBenzMaxim 0:33d4e66780c0 174 if (Base::level_stack_.Empty()) // end of json text
IanBenzMaxim 0:33d4e66780c0 175 Base::os_->Flush();
IanBenzMaxim 0:33d4e66780c0 176 return true;
IanBenzMaxim 0:33d4e66780c0 177 }
IanBenzMaxim 0:33d4e66780c0 178
IanBenzMaxim 0:33d4e66780c0 179 //@}
IanBenzMaxim 0:33d4e66780c0 180
IanBenzMaxim 0:33d4e66780c0 181 /*! @name Convenience extensions */
IanBenzMaxim 0:33d4e66780c0 182 //@{
IanBenzMaxim 0:33d4e66780c0 183
IanBenzMaxim 0:33d4e66780c0 184 //! Simpler but slower overload.
IanBenzMaxim 0:33d4e66780c0 185 bool String(const Ch* str) { return String(str, internal::StrLen(str)); }
IanBenzMaxim 0:33d4e66780c0 186 bool Key(const Ch* str) { return Key(str, internal::StrLen(str)); }
IanBenzMaxim 0:33d4e66780c0 187
IanBenzMaxim 0:33d4e66780c0 188 //@}
IanBenzMaxim 0:33d4e66780c0 189
IanBenzMaxim 0:33d4e66780c0 190 //! Write a raw JSON value.
IanBenzMaxim 0:33d4e66780c0 191 /*!
IanBenzMaxim 0:33d4e66780c0 192 For user to write a stringified JSON as a value.
IanBenzMaxim 0:33d4e66780c0 193
IanBenzMaxim 0:33d4e66780c0 194 \param json A well-formed JSON value. It should not contain null character within [0, length - 1] range.
IanBenzMaxim 0:33d4e66780c0 195 \param length Length of the json.
IanBenzMaxim 0:33d4e66780c0 196 \param type Type of the root of json.
IanBenzMaxim 0:33d4e66780c0 197 \note When using PrettyWriter::RawValue(), the result json may not be indented correctly.
IanBenzMaxim 0:33d4e66780c0 198 */
IanBenzMaxim 0:33d4e66780c0 199 bool RawValue(const Ch* json, size_t length, Type type) {
IanBenzMaxim 0:33d4e66780c0 200 RAPIDJSON_ASSERT(json != 0);
IanBenzMaxim 0:33d4e66780c0 201 PrettyPrefix(type);
IanBenzMaxim 0:33d4e66780c0 202 return Base::WriteRawValue(json, length);
IanBenzMaxim 0:33d4e66780c0 203 }
IanBenzMaxim 0:33d4e66780c0 204
IanBenzMaxim 0:33d4e66780c0 205 protected:
IanBenzMaxim 0:33d4e66780c0 206 void PrettyPrefix(Type type) {
IanBenzMaxim 0:33d4e66780c0 207 (void)type;
IanBenzMaxim 0:33d4e66780c0 208 if (Base::level_stack_.GetSize() != 0) { // this value is not at root
IanBenzMaxim 0:33d4e66780c0 209 typename Base::Level* level = Base::level_stack_.template Top<typename Base::Level>();
IanBenzMaxim 0:33d4e66780c0 210
IanBenzMaxim 0:33d4e66780c0 211 if (level->inArray) {
IanBenzMaxim 0:33d4e66780c0 212 if (level->valueCount > 0) {
IanBenzMaxim 0:33d4e66780c0 213 Base::os_->Put(','); // add comma if it is not the first element in array
IanBenzMaxim 0:33d4e66780c0 214 if (formatOptions_ & kFormatSingleLineArray)
IanBenzMaxim 0:33d4e66780c0 215 Base::os_->Put(' ');
IanBenzMaxim 0:33d4e66780c0 216 }
IanBenzMaxim 0:33d4e66780c0 217
IanBenzMaxim 0:33d4e66780c0 218 if (!(formatOptions_ & kFormatSingleLineArray)) {
IanBenzMaxim 0:33d4e66780c0 219 Base::os_->Put('\n');
IanBenzMaxim 0:33d4e66780c0 220 WriteIndent();
IanBenzMaxim 0:33d4e66780c0 221 }
IanBenzMaxim 0:33d4e66780c0 222 }
IanBenzMaxim 0:33d4e66780c0 223 else { // in object
IanBenzMaxim 0:33d4e66780c0 224 if (level->valueCount > 0) {
IanBenzMaxim 0:33d4e66780c0 225 if (level->valueCount % 2 == 0) {
IanBenzMaxim 0:33d4e66780c0 226 Base::os_->Put(',');
IanBenzMaxim 0:33d4e66780c0 227 Base::os_->Put('\n');
IanBenzMaxim 0:33d4e66780c0 228 }
IanBenzMaxim 0:33d4e66780c0 229 else {
IanBenzMaxim 0:33d4e66780c0 230 Base::os_->Put(':');
IanBenzMaxim 0:33d4e66780c0 231 Base::os_->Put(' ');
IanBenzMaxim 0:33d4e66780c0 232 }
IanBenzMaxim 0:33d4e66780c0 233 }
IanBenzMaxim 0:33d4e66780c0 234 else
IanBenzMaxim 0:33d4e66780c0 235 Base::os_->Put('\n');
IanBenzMaxim 0:33d4e66780c0 236
IanBenzMaxim 0:33d4e66780c0 237 if (level->valueCount % 2 == 0)
IanBenzMaxim 0:33d4e66780c0 238 WriteIndent();
IanBenzMaxim 0:33d4e66780c0 239 }
IanBenzMaxim 0:33d4e66780c0 240 if (!level->inArray && level->valueCount % 2 == 0)
IanBenzMaxim 0:33d4e66780c0 241 RAPIDJSON_ASSERT(type == kStringType); // if it's in object, then even number should be a name
IanBenzMaxim 0:33d4e66780c0 242 level->valueCount++;
IanBenzMaxim 0:33d4e66780c0 243 }
IanBenzMaxim 0:33d4e66780c0 244 else {
IanBenzMaxim 0:33d4e66780c0 245 RAPIDJSON_ASSERT(!Base::hasRoot_); // Should only has one and only one root.
IanBenzMaxim 0:33d4e66780c0 246 Base::hasRoot_ = true;
IanBenzMaxim 0:33d4e66780c0 247 }
IanBenzMaxim 0:33d4e66780c0 248 }
IanBenzMaxim 0:33d4e66780c0 249
IanBenzMaxim 0:33d4e66780c0 250 void WriteIndent() {
IanBenzMaxim 0:33d4e66780c0 251 size_t count = (Base::level_stack_.GetSize() / sizeof(typename Base::Level)) * indentCharCount_;
IanBenzMaxim 0:33d4e66780c0 252 PutN(*Base::os_, static_cast<typename TargetEncoding::Ch>(indentChar_), count);
IanBenzMaxim 0:33d4e66780c0 253 }
IanBenzMaxim 0:33d4e66780c0 254
IanBenzMaxim 0:33d4e66780c0 255 Ch indentChar_;
IanBenzMaxim 0:33d4e66780c0 256 unsigned indentCharCount_;
IanBenzMaxim 0:33d4e66780c0 257 PrettyFormatOptions formatOptions_;
IanBenzMaxim 0:33d4e66780c0 258
IanBenzMaxim 0:33d4e66780c0 259 private:
IanBenzMaxim 0:33d4e66780c0 260 // Prohibit copy constructor & assignment operator.
IanBenzMaxim 0:33d4e66780c0 261 PrettyWriter(const PrettyWriter&);
IanBenzMaxim 0:33d4e66780c0 262 PrettyWriter& operator=(const PrettyWriter&);
IanBenzMaxim 0:33d4e66780c0 263 };
IanBenzMaxim 0:33d4e66780c0 264
IanBenzMaxim 0:33d4e66780c0 265 RAPIDJSON_NAMESPACE_END
IanBenzMaxim 0:33d4e66780c0 266
IanBenzMaxim 0:33d4e66780c0 267 #if defined(__clang__)
IanBenzMaxim 0:33d4e66780c0 268 RAPIDJSON_DIAG_POP
IanBenzMaxim 0:33d4e66780c0 269 #endif
IanBenzMaxim 0:33d4e66780c0 270
IanBenzMaxim 0:33d4e66780c0 271 #ifdef __GNUC__
IanBenzMaxim 0:33d4e66780c0 272 RAPIDJSON_DIAG_POP
IanBenzMaxim 0:33d4e66780c0 273 #endif
IanBenzMaxim 0:33d4e66780c0 274
IanBenzMaxim 0:33d4e66780c0 275 #endif // RAPIDJSON_RAPIDJSON_H_