Skip to content

scl::comment Documentation

WizardCarter edited this page Jul 21, 2018 · 3 revisions

scl::comment

This is the documentation page for the scl::comment class of SCL. This class serves as a small way of adding comments to a file using the generic scl::config_file::put function.

Public Members

scl::comment(std::string cmnt)

The basic constructor for a comment. Takes a string representing the comment that will be stored in the object.

std::string text

The internal variable for storing the comment taken in the constructor.

Example

Write comment before other content

using namespace scl;

//create a new config file
config_file file("example.config", config_file::WRITE);
//add some comments and values
file.put(comment("Menu Settings"));
file.put("num_options", 5);
file.put(comment("In Game Settings"));;
file.put("show_tutorial", false);
file.put("field_of_view", 90);

//write changes to the file
file.write_changes();
//and close it to save memory.
file.close();

This program produces the following output in example.config:

#Menu Settings
num_options=5
#In Game Settings
show_tutorial=0
field_of_view=90
Clone this wiki locally