Commit Graph

34 Commits

Author SHA1 Message Date
Jordan Williams
3b6417de00 fix clang range-loop-analysis warnings 2020-02-11 06:13:55 -06:00
ToruNiina
f6a41d986c feat: handle quotes in strings in the better way
- if a basic string contains any double quote, make it multiline.
  - because 1 or 2 consecutive "s do not require escape sequence in it.
- if a basic string will be sufficiently long, make it multiline.
- if 3 consecutive "s appeared, insert backslash to break it down.
2020-02-05 22:42:10 +09:00
ToruNiina
16fc172b21 feat: check string length before adding newline
In literal strings, only the first newline will be trimmed.
```toml
str = '''
The first newline will be trimmed.'''
```
The previous code always adds this first-newline, but after this commit
it checks the length of the string and adds newline if the string is
sufficiently long.
2020-02-05 22:39:08 +09:00
ToruNiina
5ca3a3c262 refactor: change ifdef UNRELEASED_FEATURE region
to eliminate dead code after returning from a function
2020-02-04 21:05:03 +09:00
ToruNiina
b4b35ea33e feat: allow 0-prefix exponent if the flag is on
If unreleased feature is activated, zero-prefixes in an exponent part of
a floating point is allowed. If the flag TOML11_UNRELEASED_TOML_FEATURES
is turned on, we don't need to check whether there is a zero prefix in
the exponent part that is formatted by a standard library.
2019-10-08 23:23:53 +09:00
ToruNiina
c272188060 fix: check inline table does not include LF 2019-06-29 16:39:54 +09:00
ToruNiina
d5299fef04 feat: add no_comment option to serializer 2019-06-29 14:59:18 +09:00
ToruNiina
0502924d25 feat: add nocomment and showcomment 2019-06-28 19:08:48 +09:00
ToruNiina
3624e4b690 fix: put comment just after non-table values
When non-table value is passed to the `operator<<`, it assumes that the
original C++ code looks like the following.

```cpp
std::cout << "key = " << v << std::endl;
```

In this case, the comment associated to `v` should be put just after
`v`, not before.
```toml
key = # comment <= bad
"value"

key = "value" # comment <= good
```

So, if `v` is not a table it would put comments just after the value.
2019-06-28 17:53:19 +09:00
ToruNiina
79e7511871 feat: add format_key to help serialization 2019-06-28 17:47:19 +09:00
ToruNiina
284f122433 refactor: replace for-loop by comment output 2019-06-28 14:58:47 +09:00
ToruNiina
ecf55f86d6 refactor: add explicit type conversion 2019-06-21 00:25:57 +09:00
ToruNiina
be2d2aec52 refactor: explicitly convert difference_t to size_t 2019-06-20 23:59:16 +09:00
ToruNiina
32d5c9e924 fix: serialize array correctly 2019-06-18 01:27:52 +09:00
ToruNiina
6399d44e3b fix: consider comments while serialization 2019-06-17 22:13:58 +09:00
ToruNiina
7eac3a3028 feat: support serialization of basic_value 2019-06-17 20:34:42 +09:00
ToruNiina
5fe166e375 fix: update value_t::* names in serializer
Although currently serializer does not support basic_value, it compiles.
2019-06-02 21:51:37 +09:00
ToruNiina
4dbd2cb9fe refactor: use as_* to avoid needless checking 2019-05-29 21:22:32 +09:00
ToruNiina
65124a8d2e refactor: use is_something instead of is(...)
to reduce the code size a bit
2019-05-29 21:20:22 +09:00
ToruNiina
4c13085b35 fix: add stream operator for toml::table 2019-03-20 19:30:08 +09:00
ToruNiina
40ccf1d912 feat: add argument to control top-level inlinization 2019-03-19 23:25:26 +09:00
ToruNiina
d6714ec450 feat: detect value type and format as a file
in toml::format
2019-03-19 21:24:51 +09:00
ToruNiina
9b8db6a225 fix: remove extraneous null character after float
the bug was introduced by snprintf
2019-03-15 19:30:36 +09:00
ToruNiina
46b35870c5 style: remove needless type casting 2019-03-13 01:17:27 +09:00
ToruNiina
dddcecb034 fix: use snprintf instead of stringstream
to avoid the effect of locale
2019-03-12 23:37:46 +09:00
ToruNiina
2dd0a78c52 fix: reset stream width before printing
without this, the first line of the serialized result becomes too wide
2019-02-16 23:55:19 +09:00
ToruNiina
a00a906482 fix: add comma at correct position 2019-02-14 16:17:32 +09:00
ToruNiina
19ad7d7c96 fix: remove needless empty line from serialization 2019-02-14 16:17:04 +09:00
ToruNiina
251e55da42 fix: don't ignore std::setw(0) 2019-02-14 15:49:27 +09:00
ToruNiina
32f1b2060a fix: avoid width overflow 2019-02-14 15:49:13 +09:00
ToruNiina
b1c54532df feat: improve array serialization
- make multiline array more clean
- short-circuit for empty array
2019-02-14 15:48:05 +09:00
ToruNiina
38c67f16e8 fix: initialize float precition correctly 2019-02-14 15:47:00 +09:00
ToruNiina
5bdc022627 fix: correctly serialize quoted keys 2019-02-13 13:51:08 +09:00
ToruNiina
d1c76709b0 add serializer #23 2019-02-13 13:37:58 +09:00