Git Product home page Git Product logo

mini's Issues

Warnings on Windows with VS2022 MSVC /W4

mINI @ b5f0dc2

mini/ini.h(352,32): warning C4310: cast truncates constant value
mini/ini.h(352,59): warning C4310: cast truncates constant value
mini/ini.h(352,86): warning C4310: cast truncates constant value
mini/ini.h(711,38): warning C4310: cast truncates constant value
mini/ini.h(711,50): warning C4310: cast truncates constant value
mini/ini.h(711,62): warning C4310: cast truncates constant value

const std::string

There are several places in code you're using const std::string to define whitespace and end-of-line strings. There are a couple of issues with this.

First, these aren't inline, meaning that an instance is created for every translation unit.

Second, because you're using std::string, this performs an unnecessary allocation in debug mode (it disappears in release due to SSO). This is causing me problems with my leak detection, since the deallocation order isn't guaranteed, and is occurring after my leak check exit point.

It would be best to simply replace these several instances with inline const char* This will avoid any allocations, and works exactly like before.

inline const char* whitespaceDelimiters = " \t\n\r\f\v";
...
#ifdef _WIN32
    inline const char* endl = "\r\n";
#else
    inline const char* endl = "\n";
#endif

Support for std::wstring

Hi, I write ini files in arabic paths which makes the app crash when passing a wide char* or a wstring path
Like: C:/somefoler/مجلد/settings.ini
Is there a feature for wstring filenames and what not?

Location of the file in linux

Hi,
what should be the location of the .ini file in linux?

I used to have the ini file along with my application in /usr/bin, but if I launch the application within a different directory it does not read the ini file.

Example (myapplication is the name of the application, it has a myapplication.ini file):

root@localhost:~# myapplication  // The application does not find the ini file
root@localhost:~#  cd /usr/bin
root@localhost:/usr/bin# myapplication // The application does find the ini file

Is there a way to tell the path where to look for the ini file?
Thanks!

no support comment to the right value

  • no support comment to the right value

I added this.

if (equalsAt != std::string::npos)
{
auto key = line.substr(0, equalsAt);
INIStringUtil::trim(key);
INIStringUtil::replace(key, "\=", "=");
auto value = line.substr(equalsAt + 1);
auto commentAt = value.find_first_of(';');
if (commentAt != std::string::npos)
value = value.erase(commentAt, value.length());
INIStringUtil::trim(value);
parseData.first = key;
parseData.second = value;
return PDataType::PDATA_KEYVALUE;
}

mIni doesn't parse properly strings

Hi !
I realised a problem in mIni as it doesn't parse strings properly, the string should be parsed as A MineServer ! but is instead parsed as A.

Config :

[network]
port = 25565

[display]
motd = A MineServer !

[other]
max-players = 100

Using logging here is what I get :

[DEBUG] 10:34:32 - Parsed port as 25565
[DEBUG] 10:34:32 - Parsed motd as A
[DEBUG] 10:34:32 - Parsed max-players as 100
[INFO]  10:34:32 - Motd : A

Output is being prefixed with gabage

Hello,

I am trying to write a simple program and cannot get past the first part of reading an ini files. I saw you library and downloaded and installed it. It is reading my ini file but the output is being prefix with some sort of gabage. For now I only have the ini portion of the code so here it is:

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include
#include
#include "mini/ini.h"

using namespace std;

int main()
{
mINI::INIFile file("clean-folders.ini");
mINI::INIStructure ini;
file.read(ini);

std::string dFolder = ini.get("folder").get("location");
std::string delay = ini.get("purge-minutes").get("min");

printf("%s" "%s" "%s", dFolder, delay, "\n");

return 0;

}

trailing comments on all lines

Would it be possible to add support for trailing comments on key/value lines? It would be nice to leave a comment here and there for the end users (or myself) of my program. Maybe a relatively crude method would suffice? Store everything after the value as a comment, no matter how much whitespace, etc.?

key = value ; This is the background color

While writing, simply append the stored string back to the value.

Pretty please.

error while using std::stoi with string from mINI.

Hi,
I'm trying to use the int from the ini file but I can't because when I run it I get the message:
terminate called after throwing an instance of 'std::invalid_argument'
what(): stands
Does anyone know how to fix this?
Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.