Skip to content

Bibliothèque c++ destinée au PaxOS pour l'analyse de fichiers INI

License

Notifications You must be signed in to change notification settings

paxo-phone/PaxoINI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PaxoINI is a library for analysing INI files. It was developed as part of the Paxo project to provide an INI interface to PaxOS.

Examples

Read

#include "ini.hpp"

...

std::string data = "\n \
    [section] \n\
    key=value \n\
";

try
{
    // initializing document
    ini::doc doc(data);
    
    // You can also use
    /*
        ini::doc doc;
        doc.parse(data);
    */

    // get "key" value
    std::cout << doc.get("section", "key") << std::endl;

    // output: value

}
catch(const std::exception& e)
{
    std::cerr << e.what() << '\n';
}

Write

#include "ini.hpp"

try
{
    std::ofstream output("output.txt");

    /* Intialize INI document */
    ini::doc document;
    
    /* Set values */
    document.set("section-1", "key-1", "value-1");
    document.set("section-1", "key-2", "value-2");

    document.set("section-2", "key-1", "value-1");
    document.set("section-2", "key-2", "value-2");

    /* Write it to output */
    output << document.tostring() << std::endl;

    // output: you now have a file containing the specified data in INI format

}
catch(const std::exception& e)
{
    std::cerr << e.what() << '\n';
}

Read and Write

#include "ini.hpp"

...

std::string data = "\n \
    [section] \n\
    key=value \n\
";

try
{
    std::ofstream output("output.txt");

    /* Intialize INI document */
    ini::doc document(data);
    
    /* Add value */
    document.set("section", "key2", "value2");

    /* Write it to output */
    output << document.tostring() << std::endl;

    // output: you now have a file containing the specified data in INI format

}
catch(const std::exception& e)
{
    std::cerr << e.what() << '\n';
}

License

This project is distributed under the CC0 1.0 Universal License. See LICENSE for more information.

Contact

You can contact us via our Website or our Discord server

Contributors

About

Bibliothèque c++ destinée au PaxOS pour l'analyse de fichiers INI

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published