CfgManipulator is a powerful tool for manipulating configuration files.

OS
Windows 10
Linux
Mac OS Not tested

CfgManipulator Build Status

CfgManipulator is a powerful tool for manipulating configuration files.

Before starting, you should have installed

  • GCC 4.8 or higher

It can

  • Read the value of variables and change it.
  • Create sections.
  • Format the file in its own style.
  • Detect errors

How to use

  • Copy the files CfgManipulator.cpp and CfgManipulaor.hpp to your project folder.
  • Include the CfgManipulator.hpp file in your project.
  • Compile CfgManipulator.cpp with other source files.

Explanation

  • void CfgFile::open(const std::string &path) - Opens the configuration file
  • void CfgFile::close() - Closes the configuration file.
  • bool CfgFile::is_open() - Returns true if the file is open, false if closed.
  • string CfgFile::read(const string &key) - Reads the value of a variable.
  • string CfgFile::read(const std::string &section, const std::string &key) - Reads the value of a variable from a specific section.
  • std::string CfgFile::get_path() - Returns the path to the file.
  • void CfgFile::change_value(const string &key, const string &value) - Changes the value of a variable.
  • void CfgFile::change_value(const string &section, const string &key, const string &value) - Changes the value of a variable from a specific section.

Code example

using namespace std; CfgManipulator::CfgFile CfgFile; int main() { CfgFile.open("config.cfg"); cout << CfgFile.read("line") << endl; cout << CfgFile.read("section", "line"); CfgFile.change_value("line", "value"); CfgFile.change_value("section", "line", "value"); }">
//main.cpp

#include "CfgManipulator.hpp"

#include <iostream>

using namespace std;

CfgManipulator::CfgFile CfgFile;

int main() {
    CfgFile.open("config.cfg");

    cout << CfgFile.read("line") << endl;

    cout << CfgFile.read("section", "line");

    CfgFile.change_value("line", "value");

    CfgFile.change_value("section", "line", "value");
}
# config.cfg

line = "value" # comment

[section]
    line = "value" # comment

Compilation command: g++ -std=c++11 -Wall -Werror main.cpp CfgManipulator.cpp

License: MIT

Similar Resources

C++ library and cmdline tools for parsing and manipulating VCF files

vcflib A C++ library for parsing and manipulating VCF files. overview The Variant Call Format (VCF) is a flat-file, tab-delimited textual format that

Sep 21, 2022

Phorklift is an HTTP server and proxy daemon, with clear, powerful and dynamic configuration.

Phorklift is an HTTP server and proxy daemon, with clear, powerful and dynamic configuration.

Mar 1, 2022

C++ (with python bindings) library for easily reading/writing/manipulating common animation particle formats such as PDB, BGEO, PTC. See the discussion group @ http://groups.google.com/group/partio-discuss

Partio - A library for particle IO and manipulation This is the initial source code release of partio a tool we used for particle reading/writing. It

Sep 29, 2022

C library for encoding, decoding and manipulating JSON data

Jansson README Jansson is a C library for encoding, decoding and manipulating JSON data. Its main features and design principles are: Simple and intui

Sep 26, 2022

A C++ header-only library for creating, displaying, iterating and manipulating dates

The ASAP date/time library for beautiful C++ code ASAP is a small, header-only date-time library for C++11 and beyond. It is heavily inspired by my gr

Sep 5, 2022

Slow5tools is a toolkit for converting (FAST5 - SLOW5), compressing, viewing, indexing and manipulating data in SLOW5 format.

slow5tools Slow5tools is a simple toolkit for converting (FAST5 - SLOW5), compressing, viewing, indexing and manipulating data in SLOW5 format. Abou

Sep 9, 2022

Cross-platform C++ library providing a simple API to read and write INI-style configuration files

simpleini A cross-platform library that provides a simple API to read and write INI-style configuration files. It supports data files in ASCII, MBCS a

Sep 24, 2022

Welcome to my dungeon. Here, I keep all my configuration files in case I have a stroke and lose all my memory. You're very welcome to explore and use anything in this repository. Have fun!

Fr1nge's Dotfiles Welcome to my dungeon. Here, I keep all my configuration files in case I have a stroke an d lose all my memory. You're very welcome

Apr 16, 2022

Common files for Packet Batch. Read this for configuration guidance and more!

Packet Batch (Common) Description This is a repository for Packet Batch that includes common files for all versions of Packet Batch to use (standard,

Oct 1, 2022

A program that automatically generates CMake and Meson configuration files for your Vala project

Autovala is a program and a library designed to help in the creation of projects with Vala and CMake. It also has support for Genie.

Apr 7, 2021

A repo of game server configuration files used by LinuxGSM

Game Server Config Files Note: This repo is very new and currently missing most config files. More will be added over time. This is a repo of config f

Sep 26, 2022

Mast is setup tool for Linux Mint configuration which provides this functionalities

Mast is setup tool for Linux Mint configuration which provides this functionalities

Mast Mint Additional Setup Tool discord what is Mast? Mast is setup tool for Linux Mint configuration which provides this functionalities

Dec 25, 2021

User space configuration tool for RME HDSPe MADI / AES / RayDAT / AIO and AIO Pro cards driven by the snd-hdspe driver.

hdspeconf User space configuration tool for RME HDSPe MADI / AES / RayDAT / AIO and AIO Pro cards, driven by the snd-hdspe driver. Building hdspeconf

Jun 15, 2022

Powerful automated tool for reverse engineering Unity IL2CPP binaries

Powerful automated tool for reverse engineering Unity IL2CPP binaries

Powerful automated tool for reverse engineering Unity IL2CPP binaries

Sep 26, 2022

A Powerful, Easy-to-Use, Compact, Cross-Platform and Installation-Free Crypto Tool. 一个强大,易用,小巧,跨平台且免安装的加密解密签名工具。

A Powerful, Easy-to-Use, Compact, Cross-Platform and Installation-Free Crypto Tool. 一个强大,易用,小巧,跨平台且免安装的加密解密签名工具。

GpgFrontend GpgFrontend is a Powerful, Easy-to-Use, Compact, Cross-Platform, and Installation-Free OpenPGP Crypto Tool. By using GpgFrontend, you can

Sep 26, 2022

A powerful and fast search tool using regular expressions

A powerful and fast search tool using regular expressions

A powerful and fast search tool using regular expressions

Sep 26, 2022

Small configuration file parser library for C.

libConfuse Introduction Documentation Examples Build & Install Origin & References Introduction libConfuse is a configuration file parser library writ

Sep 20, 2022

Universal configuration library parser

LIBUCL Table of Contents generated with DocToc Introduction Basic structure Improvements to the json notation General syntax sugar Automatic arrays cr

Sep 24, 2022

log4cplus is a simple to use C++ logging API providing thread-safe, flexible, and arbitrarily granular control over log management and configuration. It is modelled after the Java log4j API.

% log4cplus README Short Description log4cplus is a simple to use C++17 logging API providing thread--safe, flexible, and arbitrarily granular control

Sep 23, 2022
Mast is setup tool for Linux Mint configuration which provides this functionalities
Mast is setup tool for Linux Mint configuration which provides this functionalities

Mast Mint Additional Setup Tool discord what is Mast? Mast is setup tool for Linux Mint configuration which provides this functionalities

Dec 25, 2021
Small configuration file parser library for C.

libConfuse Introduction Documentation Examples Build & Install Origin & References Introduction libConfuse is a configuration file parser library writ

Sep 20, 2022
config-loader is a static reflection framework written in C++17 from parse configuration file to native data structure.

config-loader is a static reflection framework written in C++17 from parse configuration file to native data structure.

Sep 22, 2022
Lua as an advanced configuration language for wayfire

wf-lua Experiment to use Lua as an advanced configuration language for wayfire. wf-lua is meant for use-cases where writing an actual wayfire plugin s

Aug 3, 2022
Device configuration for Redmi K30 Ultra
Device configuration for Redmi K30 Ultra

The Redmi K30 Ultra (codenamed "cezanne") is a high-end smartphone from Xiaomi.

Apr 9, 2022
CfgManipulator is a fast and powerful tool for working with configuration files for the C++ language
CfgManipulator is a fast and powerful tool for working with configuration files for the C++ language

CfgManipulator is a fast and powerful tool for working with configuration files for the C++ language. It can read, create strings and sections, change the value of a string and much more.

Jan 28, 2022
Sep 30, 2022
C++ library and cmdline tools for parsing and manipulating VCF files

vcflib A C++ library for parsing and manipulating VCF files. overview The Variant Call Format (VCF) is a flat-file, tab-delimited textual format that

Sep 21, 2022
This is a collection of tools for creating and manipulating BitTorrent v2 torrent files

torrent tools This is a collection of tools for creating and manipulating BitTorrent v2 torrent files. torrent-new can create hybrid torrents, but the

Jun 1, 2022
A combined suite of utilities for manipulating binary data files.

BinaryTools A combined suite of utilities for manipulating binary data files. It was developed for use on Windows but might compile on other systems.

Jul 12, 2022