Commit c5bdcd5c authored by kaltenbe's avatar kaltenbe

added missing directory to lms7002m

parent f1298f80
The MIT License (MIT)
Copyright (c) 2014 Turbine1991
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
\ No newline at end of file
feather-ini-parser
==================
Simple like your girlfriend, fast, lightweight, header, portable INI parser for ANSI C++.
Why use feather-ini-parser? It's a fast, intuitive, uses C++, supports native data types, wide char support (enable), converting to data types simply by setting a default value or providing the type as a template parameter.
##Methods
Statement | Return Type
------------- | -------------
ini(filename, doParse)|constructor
ini(data, dataSize, doParse)|constructor
ini.parse()|bool
ini.merge(other INI, retainValues)|void
ini.create(section)|bool
ini.select(section)|bool
ini.set(key, value)|bool
ini.get(key, dvalue = value_t())|dvalue_t
ini.save(filename = "")|bool
ini.clear()|bool
ini[section][key]|value_t&
ini[section]|keys_t&
##Example
```
#include <iostream>
#include "INI.h"
using namespace std;
```
...
```
typedef INI<> ini_t;
//or
//typedef INI<section_t, key_t, value_t> ini_t;
ini_t ini("filename.ini", true);
ini.create("section1"); //Create and select section1
ini.set("key", "value");
cout << ini.get("keynumeric", -1) << endl;
ini["section2"]["key"] = "value";
ini.save();
```
##More
Please see the example .cpp file and Code::Blocks .cbp project for a compilable GCC and VSC++ example. Additionally includes enabling wide char support and iterating through contents.
#include <iostream>
#include <cstring>
#include <stdint.h>
#include "../INI.h"
using namespace std;
void centerString(string str); //Printing to console
std::string getStringFromFile(const std::string& path); //Source for data loading from memory.
int main()
{
///Declare
typedef INI<> ini_t; //Makes things shorter/easier to write <Section, Key, Value>
//or
//typedef INI<string, string, string> ini_t; //Equivelant to previous line when wide characters are disabled
ini_t ini("file.ini", true); //File to open/default save filename. The constuctor is set to parse by default, unless specified as false
///Manipulate and access contents
centerString("########## Access & Manipulate Contents ##########");
//Common usage
ini.create("Section 1");
ini.create("Section 2");
ini.get("Key1", "DefaultValue");
ini.select("Section 1");
ini.set("Key2", "Value");
ini.save(); //Save contents to file, optional filename parameter available
ini.clear(); //Clear INI contents from memory
//Extended usage
ini["Section Name"]["Key"] = "Value"; //You are not required to create a section first
ini.create("Section1"); //Also selects as current section
ini.create("Section2"); //Current
ini.set("Key1", "Value1"); //Added pair under section "Section2"
ini.select("Section1"); //Current
cout << ini.get("Key1", "-1") << endl; //Returns "-1" as no key exists, no default will return NULL for data type, eg int() is 0
ini.select("Section2");
ini.set("Key1", "1.123");
cout << ini.get("Key1", -1.0) << endl; //Return value as double
ini.set(123, 123); //Will convert to provided INI data type for key/value, in this case string for both
ini.save();
ini.clear();
ini.parse(); //Parses file into objects in memory
cout << ini["Section2"]["Key1"] << endl; //Returns "Value1", slightly more overhead involved seeking section, avoid using excessively
///Iterate through sections and keys for both C++11 and C++98
centerString("########## Iterate Contents ##########");
#ifdef FINI_CPP11
for(auto i: ini.sections)
{
cout << "[" << i.first << "]" << endl;
//for(auto j = i.second->begin(); j != i.second->end(); j++)
for(auto j: *i.second)
{
cout << " " << j.first << "=" << j.second << endl;
}
}
#else
for(ini_t::sectionsit_t i = ini.sections.begin(); i != ini.sections.end(); i++)
{
//Section name as ini_t::section_t
cout << i->first << endl;
if (i->second->size() == 0) //No keys/values in section, skip to next
continue;
for(ini_t::keysit_t j = i->second->begin(); j != i->second->end(); j++)
{
//Name as ini_t::key_t & Value as ini_t::key_t
cout << " " << j->first << "=" << j->second << endl;
}
}
#endif
///Example with different data types
typedef INI <unsigned char, string, float> ini_int_t; //Makes things shorter/easier to write <Section, Key, Value>
ini_int_t ini_int("file_ints.ini", false); //File to open/default save filename. The constuctor is set to parse by default, unless specified as false
for(int i = 1; i <= 200; i++)
{
ini_int.create(i); //Section
ini_int.set("Key", i / 2.f);
}
ini_int.save();
///Wide char support example (please define FINI_WIDE_SUPPORT in project)
/*
ini_t ini_w("file.ini", true);
wcout << ini_w[L"Section2"][L"Key1"] << endl;
*/
///Load from memory
std::string str = getStringFromFile("config/test.ini"); //Allows us to tap into a source for the purpose of this example
ini_t ini_mem((void*)str.c_str(), str.size(), true); //This is the line which parses data from memory
///Merge contents and keep values
ini_t inid("file.ini", true);
ini_t inis("merge.ini", true);
inid.merge(inis, true);
inid.save("merged.ini");
return EXIT_SUCCESS;
}
void centerString(string str)
{
const char* s = str.c_str();
int l = strlen(s);
int pos = (int)((80 - l) / 2);
for(int i = 0; i < pos; i++)
cout << " ";
cout << s << endl;
}
std::string getStringFromFile(const std::string& path) {
std::ostringstream buf;
std::ifstream input (path.c_str());
buf << input.rdbuf();
return buf.str();
}
[200]
Key=100
[199]
Key=99.5
[198]
Key=99
[197]
Key=98.5
[196]
Key=98
[195]
Key=97.5
[194]
Key=97
[193]
Key=96.5
[192]
Key=96
[191]
Key=95.5
[190]
Key=95
[189]
Key=94.5
[188]
Key=94
[187]
Key=93.5
[186]
Key=93
[185]
Key=92.5
[184]
Key=92
[183]
Key=91.5
[182]
Key=91
[181]
Key=90.5
[180]
Key=90
[179]
Key=89.5
[178]
Key=89
[177]
Key=88.5
[176]
Key=88
[175]
Key=87.5
[174]
Key=87
[173]
Key=86.5
[172]
Key=86
[171]
Key=85.5
[170]
Key=85
[169]
Key=84.5
[168]
Key=84
[167]
Key=83.5
[166]
Key=83
[165]
Key=82.5
[164]
Key=82
[163]
Key=81.5
[162]
Key=81
[161]
Key=80.5
[160]
Key=80
[159]
Key=79.5
[158]
Key=79
[157]
Key=78.5
[156]
Key=78
[155]
Key=77.5
[154]
Key=77
[153]
Key=76.5
[152]
Key=76
[151]
Key=75.5
[150]
Key=75
[149]
Key=74.5
[148]
Key=74
[147]
Key=73.5
[146]
Key=73
[145]
Key=72.5
[144]
Key=72
[143]
Key=71.5
[142]
Key=71
[141]
Key=70.5
[140]
Key=70
[139]
Key=69.5
[138]
Key=69
[137]
Key=68.5
[136]
Key=68
[135]
Key=67.5
[134]
Key=67
[133]
Key=66.5
[132]
Key=66
[131]
Key=65.5
[130]
Key=65
[129]
Key=64.5
[128]
Key=64
[127]
Key=63.5
[126]
Key=63
[125]
Key=62.5
[124]
Key=62
[123]
Key=61.5
[122]
Key=61
[121]
Key=60.5
[120]
Key=60
[119]
Key=59.5
[118]
Key=59
[117]
Key=58.5
[116]
Key=58
[115]
Key=57.5
[114]
Key=57
[113]
Key=56.5
[112]
Key=56
[111]
Key=55.5
[110]
Key=55
[109]
Key=54.5
[108]
Key=54
[107]
Key=53.5
[106]
Key=53
[105]
Key=52.5
[104]
Key=52
[103]
Key=51.5
[1]
Key=0.5
[2]
Key=1
[3]
Key=1.5
[4]
Key=2
[5]
Key=2.5
[6]
Key=3
[7]
Key=3.5
[8]
Key=4
[9]
Key=4.5
[10]
Key=5
[11]
Key=5.5
[12]
Key=6
[13]
Key=6.5
[14]
Key=7
[15]
Key=7.5
[16]
Key=8
[17]
Key=8.5
[18]
Key=9
[19]
Key=9.5
[20]
Key=10
[21]
Key=10.5
[22]
Key=11
[23]
Key=11.5
[24]
Key=12
[25]
Key=12.5
[26]
Key=13
[27]
Key=13.5
[28]
Key=14
[29]
Key=14.5
[30]
Key=15
[31]
Key=15.5
[32]
Key=16
[33]
Key=16.5
[34]
Key=17
[35]
Key=17.5
[36]
Key=18
[37]
Key=18.5
[38]
Key=19
[39]
Key=19.5
[40]
Key=20
[41]
Key=20.5
[42]
Key=21
[43]
Key=21.5
[44]
Key=22
[45]
Key=22.5
[46]
Key=23
[47]
Key=23.5
[48]
Key=24
[49]
Key=24.5
[50]
Key=25
[51]
Key=25.5
[52]
Key=26
[53]
Key=26.5
[54]
Key=27
[55]
Key=27.5
[56]
Key=28
[57]
Key=28.5
[58]
Key=29
[59]
Key=29.5
[60]
Key=30
[61]
Key=30.5
[62]
Key=31
[63]
Key=31.5
[64]
Key=32
[65]
Key=32.5
[66]
Key=33
[67]
Key=33.5
[68]
Key=34
[69]
Key=34.5
[70]
Key=35
[71]
Key=35.5
[72]
Key=36
[73]
Key=36.5
[74]
Key=37
[75]
Key=37.5
[76]
Key=38
[77]
Key=38.5
[78]
Key=39
[79]
Key=39.5
[80]
Key=40
[81]
Key=40.5
[82]
Key=41
[83]
Key=41.5
[84]
Key=42
[85]
Key=42.5
[86]
Key=43
[87]
Key=43.5
[88]
Key=44
[89]
Key=44.5
[90]
Key=45
[91]
Key=45.5
[92]
Key=46
[93]
Key=46.5
[94]
Key=47
[95]
Key=47.5
[96]
Key=48
[97]
Key=48.5
[98]
Key=49
[99]
Key=49.5
[100]
Key=50
[101]
Key=50.5
[102]
Key=51
[NewSection]
Key=Value
[Section2]
NewKey=Value
123=456
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocks_project_file>
<FileVersion major="1" minor="6" />
<Project>
<Option title="project" />
<Option pch_mode="2" />
<Option compiler="gcc" />
<Build>
<Target title="gcc_mingw">
<Option output="bin/gcc_mingw/example" prefix_auto="1" extension_auto="1" />
<Option object_output="obj/gcc_mingw/" />
<Option type="1" />
<Option compiler="gcc" />
<Compiler>
<Add option="-O2" />
<Add option="-Wall" />
<Add option="-std=c++0x" />
</Compiler>
</Target>
<Target title="vs_2013">
<Option output="bin/vs/example" prefix_auto="1" extension_auto="1" />
<Option object_output="obj/vs_2013/" />
<Option type="1" />
<Option compiler="microsoft_visual_c_2013" />
<Compiler>
<Add option="/EHa" />
<Add option="/W2" />
<Add directory="C:/Program Files (x86)/Microsoft Visual Studio 12.0/VC/include" />
</Compiler>
<Linker>
<Add directory="C:/Program Files (x86)/Microsoft Visual Studio 12.0/VC/lib" />
<Add directory="C:/Program Files (x86)/Microsoft SDKs/Windows/v7.0A/Lib" />
</Linker>
</Target>
<Target title="vs_2010">
<Option output="bin/vs/example" prefix_auto="1" extension_auto="1" />
<Option object_output="obj/vs_2010/" />
<Option type="1" />
<Option compiler="msvc10" />
<Compiler>
<Add option="/EHa" />
<Add option="/W2" />
</Compiler>
<Linker>
<Add directory="C:/Program Files (x86)/Microsoft SDKs/Windows/v7.0A/Lib" />
</Linker>
</Target>
</Build>
<Unit filename="../INI.h" />
<Unit filename="example.cpp" />
<Extensions>
<code_completion />
<envvars />
<debugger />
</Extensions>
</Project>
</CodeBlocks_project_file>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment