openframeworks / openframeworks/openFrameworks

Reducing bloated output from ofxXmlSettings (suggestions)

Open
#3,057 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bitesize core feature prelim-analysis
Dominant language
C++
Stars
10.4k
Forks
2.6k
Avg merge
1d 21h
Merged PRs (30d)
9

Description

I realize it's dumb to complain about XML being bloated ("then don't use it!) but:

There are some simple things we could add to reduce the bloating of output produced by ofxXmlSettings, particularly for large files.

The first is to allow floatPrecision in ofxXmlSettings.cpp to be user-adjusted. There are times when I really don't need to know fractions. out to 9 places. This could be another argument passed in to XML.setValue(), or it could be a global variable that's adjusted by the user.

Likewise, I don't see why tinyxml.cpp hardcodes four spaces for indents. I'd like the option of using tabs, or an adjustable number of spaces. There are a number of functions called Print in tinyxml.cpp that would need to be changed:
fprintf( cfile, " " );
which could optionally be replaced with tabs, i.e.
fprintf( cfile, "\t" );

Testing would need to be done to ensure that the files could still be read, of course.

These changes would allow a very large reduction in file size, without compromising the value of the XML output.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading ofxXmlSettings.cpp to understand how floatPrecision is currently used, then inspect the Print functions in tinyxml.cpp that hardcode four-space indentation. Decide how the precision and indentation options should be exposed, and verify that generated files remain readable after both changes.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, xml
Domain
tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.