Re-write IniFile class. It is poorly designed. #94

Closed
opened 4 years ago by Tomatix · 0 comments
Owner

Parse and contain the data in a more data-friendly structure.

Use the C++ standard library for this, no Qt stuff, so that it can also be used in the script engine without any awkward toStdString stuff and the likes.

Ensure the position of the sections and items is in the same order as they appear in the file.
Ensure that the same positioning is kept when writing to the file.

  • Parse and generate internal structure upon construction
  • Exception free, se next point
  • IniFileError error() -- Show any errors after loading from file
  • int count() -- Number of all sections
  • int count(section) -- Number of all items in a section
  • string read(section, item) -- Read value by key name
  • string read(section, itemPos) -- Read value by item position
  • string read(sectionPos, item) -- Read value by key name, by section position
  • string read(sectionPos, itemPos) -- Read value by item position, by section position
  • string key(section, itemPos) -- Read key name by item position
  • string key(sectionPos, itemPos) -- Read key name by item position, by section position
  • string section(sectionPos) -- Read section name by its position
  • void write(section) -- Appends empty section
  • void write(section, item, value) -- Write a value
  • void rename(section) -- Rename section
  • void rename(section, item) -- Rename item
  • void remove(section) -- Removes entire section
  • void remove(section, item) -- Removes item
  • bool exists(section) -- Returns whether or not section exists
  • bool exists(section, item) -- Returns whether or not an item exists
  • IniFileError flush() -- Write current data to file. Also updates the internal error state.
  • IniFileError reload() -- Reads data from file, previous contents is wiped from the internal structure. Also updates the internal error state.
Parse and contain the data in a more data-friendly structure. Use the C++ standard library for this, no Qt stuff, so that it can also be used in the script engine without any awkward toStdString stuff and the likes. Ensure the position of the sections and items is in the same order as they appear in the file. Ensure that the same positioning is kept when writing to the file. - Parse and generate internal structure upon construction - Exception free, se next point - IniFileError error() -- Show any errors after loading from file - int count() -- Number of all sections - int count(section) -- Number of all items in a section - string read(section, item) -- Read value by key name - string read(section, itemPos) -- Read value by item position - string read(sectionPos, item) -- Read value by key name, by section position - string read(sectionPos, itemPos) -- Read value by item position, by section position - string key(section, itemPos) -- Read key name by item position - string key(sectionPos, itemPos) -- Read key name by item position, by section position - string section(sectionPos) -- Read section name by its position - void write(section) -- Appends empty section - void write(section, item, value) -- Write a value - void rename(section) -- Rename section - void rename(section, item) -- Rename item - void remove(section) -- Removes entire section - void remove(section, item) -- Removes item - bool exists(section) -- Returns whether or not section exists - bool exists(section, item) -- Returns whether or not an item exists - IniFileError flush() -- Write current data to file. Also updates the internal error state. - IniFileError reload() -- Reads data from file, previous contents is wiped from the internal structure. Also updates the internal error state.
Tomatix added this to the Version 1.1.0 milestone 4 years ago
Tomatix added the
Improvement
label 4 years ago
Tomatix modified the milestone from Version 1.1.0 to Version 1.0.0 4 years ago
Tomatix added a new dependency 4 years ago
Tomatix self-assigned this 4 years ago
Tomatix closed this issue 4 years ago
Sign in to join this conversation.
Loading…
There is no content yet.