Merge pull request #1557 from MBoldyrev/doc/fix-uint-case
Documentation: fixed Uint case
This commit is contained in:
commit
2648a732db
@ -79,7 +79,7 @@ The following tables show the data layout of each type. The 32-bit/64-bit column
|
|||||||
| `unsigned u` | 32-bit unsigned integer |4 |4 |
|
| `unsigned u` | 32-bit unsigned integer |4 |4 |
|
||||||
| (zero padding) | 0 |4 |4 |
|
| (zero padding) | 0 |4 |4 |
|
||||||
| (unused) | |4 |8 |
|
| (unused) | |4 |8 |
|
||||||
| `unsigned flags_` | `kNumberType kNumberFlag kUIntFlag kUInt64Flag ...` |4 |4 |
|
| `unsigned flags_` | `kNumberType kNumberFlag kUintFlag kUint64Flag ...` |4 |4 |
|
||||||
|
|
||||||
| Number (Int64) | |32-bit|64-bit|
|
| Number (Int64) | |32-bit|64-bit|
|
||||||
|---------------------|-------------------------------------|:----:|:----:|
|
|---------------------|-------------------------------------|:----:|:----:|
|
||||||
|
@ -79,7 +79,7 @@ SAX 和 DOM API 都依赖于3个额外的概念:`Allocator`、`Encoding` 和 `
|
|||||||
| `unsigned u` | 32位无符号整数 |4 |4 |
|
| `unsigned u` | 32位无符号整数 |4 |4 |
|
||||||
| (零填充) | 0 |4 |4 |
|
| (零填充) | 0 |4 |4 |
|
||||||
| (未使用) | |4 |8 |
|
| (未使用) | |4 |8 |
|
||||||
| `unsigned flags_` | `kNumberType kNumberFlag kUIntFlag kUInt64Flag ...` |4 |4 |
|
| `unsigned flags_` | `kNumberType kNumberFlag kUintFlag kUint64Flag ...` |4 |4 |
|
||||||
|
|
||||||
| Number (Int64) | | 32位 | 64位 |
|
| Number (Int64) | | 32位 | 64位 |
|
||||||
|---------------------|-------------------------------------|:----:|:----:|
|
|---------------------|-------------------------------------|:----:|:----:|
|
||||||
|
@ -37,7 +37,7 @@ Bool(false)
|
|||||||
Key("n", 1, true)
|
Key("n", 1, true)
|
||||||
Null()
|
Null()
|
||||||
Key("i")
|
Key("i")
|
||||||
UInt(123)
|
Uint(123)
|
||||||
Key("pi")
|
Key("pi")
|
||||||
Double(3.1416)
|
Double(3.1416)
|
||||||
Key("a")
|
Key("a")
|
||||||
|
@ -37,7 +37,7 @@ Bool(false)
|
|||||||
Key("n", 1, true)
|
Key("n", 1, true)
|
||||||
Null()
|
Null()
|
||||||
Key("i")
|
Key("i")
|
||||||
UInt(123)
|
Uint(123)
|
||||||
Key("pi")
|
Key("pi")
|
||||||
Double(3.1416)
|
Double(3.1416)
|
||||||
Key("a")
|
Key("a")
|
||||||
|
@ -82,7 +82,7 @@ JSON number type represents all numeric values. However, C++ needs more specific
|
|||||||
~~~~~~~~~~cpp
|
~~~~~~~~~~cpp
|
||||||
assert(document["i"].IsNumber());
|
assert(document["i"].IsNumber());
|
||||||
|
|
||||||
// In this case, IsUint()/IsInt64()/IsUInt64() also return true.
|
// In this case, IsUint()/IsInt64()/IsUint64() also return true.
|
||||||
assert(document["i"].IsInt());
|
assert(document["i"].IsInt());
|
||||||
printf("i = %d\n", document["i"].GetInt());
|
printf("i = %d\n", document["i"].GetInt());
|
||||||
// Alternative (int)document["i"]
|
// Alternative (int)document["i"]
|
||||||
|
@ -82,7 +82,7 @@ JSON Number 类型表示所有数值。然而,C++ 需要使用更专门的类
|
|||||||
~~~~~~~~~~cpp
|
~~~~~~~~~~cpp
|
||||||
assert(document["i"].IsNumber());
|
assert(document["i"].IsNumber());
|
||||||
|
|
||||||
// 在此情况下,IsUint()/IsInt64()/IsUInt64() 也会返回 true
|
// 在此情况下,IsUint()/IsInt64()/IsUint64() 也会返回 true
|
||||||
assert(document["i"].IsInt());
|
assert(document["i"].IsInt());
|
||||||
printf("i = %d\n", document["i"].GetInt());
|
printf("i = %d\n", document["i"].GetInt());
|
||||||
// 另一种用法: (int)document["i"]
|
// 另一种用法: (int)document["i"]
|
||||||
|
@ -57,7 +57,7 @@ int main(int, char*[]) {
|
|||||||
printf("n = %s\n", document["n"].IsNull() ? "null" : "?");
|
printf("n = %s\n", document["n"].IsNull() ? "null" : "?");
|
||||||
|
|
||||||
assert(document["i"].IsNumber()); // Number is a JSON type, but C++ needs more specific type.
|
assert(document["i"].IsNumber()); // Number is a JSON type, but C++ needs more specific type.
|
||||||
assert(document["i"].IsInt()); // In this case, IsUint()/IsInt64()/IsUInt64() also return true.
|
assert(document["i"].IsInt()); // In this case, IsUint()/IsInt64()/IsUint64() also return true.
|
||||||
printf("i = %d\n", document["i"].GetInt()); // Alternative (int)document["i"]
|
printf("i = %d\n", document["i"].GetInt()); // Alternative (int)document["i"]
|
||||||
|
|
||||||
assert(document["pi"].IsNumber());
|
assert(document["pi"].IsNumber());
|
||||||
|
Loading…
x
Reference in New Issue
Block a user