rapidjson icon indicating copy to clipboard operation
rapidjson copied to clipboard

pretty dimensional array

Open Xilinxx opened this issue 8 years ago • 18 comments

While working with a 3D array I found the neat kFormatSingleLineArray option. Anyhow this was not more human-readable than the Default setting and so I created the add-on kFormatPretty2DArray which will limit the print to 1 array per line.

kFormatDefault (one item per line)

"{
  "ThreeDim": [
    [
      [
        32426,
        2,
        0,
        0,
        0,

kFormatSingleLineArray (Neat but human unreadable for large arrays)

"TwoDim": [[11, 12, 13, 14], [21, 22, 23, 24]]

New: kFormatPretty2DArray (limits the format to one array per line and is better human readable.)

"TwoDim": [[11, 12, 13, 14],
    [21, 22, 23, 24]] 

Xilinxx avatar Aug 11 '17 13:08 Xilinxx

Coverage Status

Coverage decreased (-0.07%) to 99.852% when pulling c77b05ef96998f1f948ce701d7eaa5921851a419 on Xilinxx:prettyDimArray into f05edc9296507a9864d99931e203631c2ffd8d4a on miloyip:master.

coveralls avatar Aug 11 '17 13:08 coveralls

Besides the failure in CI, I think that "2D" seems a special case, not a general way to deal with.

miloyip avatar Aug 13 '17 01:08 miloyip

Coverage Status

Coverage decreased (-0.07%) to 99.852% when pulling 1bd2f414901662949a7a166076360adeab314d65 on Xilinxx:prettyDimArray into f05edc9296507a9864d99931e203631c2ffd8d4a on miloyip:master.

coveralls avatar Aug 14 '17 07:08 coveralls

Coverage Status

Coverage decreased (-0.06%) to 99.857% when pulling 0ab7ee7073faa64fd40e8891d870e9c222920053 on Xilinxx:prettyDimArray into f05edc9296507a9864d99931e203631c2ffd8d4a on miloyip:master.

coveralls avatar Aug 14 '17 09:08 coveralls

@miloyip - Can you explain me how you would do it in a General way?
I can think of a SetIdentArray['\n','\n','\t'] -> Changing the ident based on the depth of the array... I'd like to get this change in because I hate maintaining the buildroot patch I have now. The goal is "human readability of multidimensional arrays". Thanks in advance!

Xilinxx avatar Aug 14 '17 09:08 Xilinxx

Coverage Status

Coverage decreased (-0.06%) to 99.857% when pulling c5087e6ba946089e710e1c02288c8966098345d4 on Xilinxx:prettyDimArray into f05edc9296507a9864d99931e203631c2ffd8d4a on miloyip:master.

coveralls avatar Aug 14 '17 21:08 coveralls

Coverage Status

Coverage decreased (-0.06%) to 99.857% when pulling 031f74257a40b124dec3830664556a03c0c38d3d on Xilinxx:prettyDimArray into f05edc9296507a9864d99931e203631c2ffd8d4a on miloyip:master.

coveralls avatar Aug 15 '17 10:08 coveralls

Coverage Status

Coverage decreased (-0.1%) to 99.796% when pulling 6c71ec7dd638819772bcb928b47b5190f4ef9923 on Xilinxx:prettyDimArray into f05edc9296507a9864d99931e203631c2ffd8d4a on miloyip:master.

coveralls avatar Aug 15 '17 11:08 coveralls

Coverage Status

Changes Unknown when pulling 81db5f5df80cd277b5da2ee7a8ed6387e333a140 on Xilinxx:prettyDimArray into ** on Tencent:master**.

coveralls avatar Sep 29 '17 07:09 coveralls

Coverage Status

Coverage decreased (-0.1%) to 99.797% when pulling 2f888b183ebd2f79c0642519ec469b676269034d on Xilinxx:prettyDimArray into 17ae6ffa857173c25708e61610121bc908c0a6cd on Tencent:master.

coveralls avatar Nov 08 '17 14:11 coveralls

Coverage Status

Coverage decreased (-0.1%) to 99.797% when pulling 2f888b183ebd2f79c0642519ec469b676269034d on Xilinxx:prettyDimArray into 17ae6ffa857173c25708e61610121bc908c0a6cd on Tencent:master.

coveralls avatar Nov 08 '17 14:11 coveralls

@miloyip , is there anything I should do to get this Pull-request merged in? (No Idea how I can get the coverage increased...)

Xilinxx avatar Dec 12 '17 13:12 Xilinxx

I have 3 concerns:

  1. Is this general enough for 3D or mixed arrays as mentioned by @pah ?
  2. Coverage was decreased as no unit tests are done for the new option.
  3. An additional member variable will occupy extra memory even if this option is not used.

I think the first is of higher priority than the others.

miloyip avatar Dec 12 '17 16:12 miloyip

@miloyip ,

  1. it's like @pah shows in his last example: a DepthChange of the array triggers a newline. A mixed array will be printed on the same line. The "kFormatPretty2DArray" seems the most human readable format which is not present. So I dare to say it is general enough to get it in. (I'm using buildroot and would like to get rid of my local patch.)
  2. I'll have a look at the unit tests to fix coverage! Thanks for pointing.
  3. The 'Leaf' strategy of printing arrays would take more than 1 additional member. A small sacrifice.

Xilinxx avatar Dec 12 '17 20:12 Xilinxx

Coverage Status

Coverage increased (+0.003%) to 99.919% when pulling d8c151463d7b5d9e946d9e58782bc90ff1d4a430 on Xilinxx:prettyDimArray into 17ae6ffa857173c25708e61610121bc908c0a6cd on Tencent:master.

coveralls avatar Dec 22 '17 11:12 coveralls

Coverage Status

Coverage decreased (-0.001%) to 99.92% when pulling c3058c9f02feca64d50ce25c599fa1dc0f63f596 on Xilinxx:prettyDimArray into 7484e06c589873e1ed80382d262087e4fa80fb63 on Tencent:master.

coveralls avatar Dec 22 '17 15:12 coveralls

CLA assistant check
All committers have signed the CLA.

tencent-adm avatar Feb 19 '19 09:02 tencent-adm

@miloyip how can i contribute here ? Looks like you are all interested in this feature. Currently all i can do is review the code also there looks to be merge conflicts present as this is 4 years old.

sembooooo avatar Apr 25 '23 01:04 sembooooo