Skip to content
/ Lini Public

A simple cross platform INI parser written in C++

License

Notifications You must be signed in to change notification settings

Bufige/Lini

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Lini

A simple cross platform INI Parser written in C++. It's made to be fast,simple,small and easy to understand.

Inside the .cpp/.h there are comments for better understanding of functions.

Ps: Comment suport wasn't added.

Simple writing example in C++##

#include <iostream>
#include <lini.h>



int main()
{
    Lini test("..\\test.ini");

    if(test.Error())
    {
        //Something went wrong
        std::cout << "Couldn't create/open the file" << std::endl;
        return 1;
    }

    test.Set("Animation","Type","Animation_Name");

    test.Set_Int("Animation","Speed",25);

    test.Set_Int("Audio","Volume",100);

    test.Set_Boolean("Levels","Stage_1",true);

    test.Set_Real("Distance","Rifle",250.5);



    std::cout << "Section:" << std::endl;
    for(auto section : test.Get_Section())
    {
        std::cout << section << std::endl;
    }
    std::cout << std::endl << "Keys:" << std::endl;
    for(auto key : test.Get_Fields("Animation"))
    {
        std::cout << key << std::endl;
    }
    test.Close();

    return 0;
}

Simple reading example in C++ using the same file.##

#include <iostream>
#include <lini.h>



int main()
{
    Lini test("..\\test.ini");

    if(test.Error())
    {
        //Something went wrong
        std::cout << "Couldn't create/open the file" << std::endl;
        return 1;
    }

    std::cout << test.Get("Animation","Type") << std::endl;

    std::cout << test.Get_Int("Animation","Speed") << std::endl;

    std::cout << test.Get_Int("Audio","Volume") << std::endl;

    std::cout << (test.Get_Boolean("Levels","Stage_1") ? ("True") : ("False")) << std::endl;

    std::cout << test.Get_Real("Distance","Rifle") << std::endl;


    test.Close();

    return 0;
}

About

A simple cross platform INI parser written in C++

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages