summaryrefslogtreecommitdiff
path: root/Source/Core/Common/IniFile.cpp
AgeCommit message (Collapse)Author
2020-02-29Common/IniFile: Add Exists function for section name onlyTechjar
2020-01-23Common/Core: Minor rvalue reference related cleanups.Jordan Woyak
2019-07-23StringUtil: Use std::string_view moreJosJuice
2019-06-16Common/IniFile: Make use of std::string_view where applicableLioncash
Now that the std::map less-than comparitor is capable of being used with heterogenous lookup, we're able to convert many of the querying functions that took std::string references over to std::string_view. Now these functions may be used without potentially allocating a std::string instance unnecessarily.
2019-06-16Common/IniFile: Make CaseInsensitiveStringCompare usable with heterogenous ↵Lioncash
lookup Previously, when performing find() operations or indexing operations on the section map, it would need to operate on a std::string key. This means cases like: map.find(some_string_view) aren't usable, which kind of sucks, especially given for most cases, we use regular string literals to perform operations in calling code. However, since C++14, it's possible to use heterogenous lookup to avoid needing to construct exact key types. In otherwords, we can perform the above or use string literals without constructing a std::string instance around them implicitly. We simply need to specify a member type within our comparison struct named is_transparent, to allow std::map to perform automatic type deduction. We also slightly alter the algorithm to an equivalent compatible with std::string_view (which need not be null-terminated), as strcasecmp requires null-terminated strings. While we're at it, we can also provide a helper function to the struct for comparing string equality rather than only less than. This allows removing other usages of strcasecmp in other functions, allowing for the transition of them to std::string_view.
2019-06-07Core/ConfigManager: Use forward declarations where applicableLioncash
Avoids dragging in IniFile, EXI device and SI device headers in this header which is quite widely used throughout the codebase. This also uncovered a few cases where indirect inclusions were being relied upon, which this also fixes.
2019-05-23Merge pull request #8113 from lioncash/ini-keyLéo Lam
Common/IniFile: Simplify Set()
2019-05-22IniFile: Prevent potential out-of-bounds access in ParseLine()Lioncash
While current usages of ParseLine aren't problematic, this is still a public function that can be used for other purposes. Essentially makes the function handle potential external inputs a little nicer.
2019-05-22Common/IniFile: Simplify Set()Lioncash
We can just utilize map's insert_or_assign() function and check the return value to determine whether or not we need to insert the key into the keys_order vector.
2019-02-13Use empty instead of sizeFilip Gawin
2018-12-26IniFile: Minor cleanup. Removed unused function. Improved template usage.Jordan Woyak
2018-06-03IniFile: Use templates for Get()Léo Lam
Gets rid of duplicated code.
2018-06-03IniFile: Use templates for Set()Léo Lam
2018-06-03Move Config ValueToString to StringUtilLéo Lam
An identical implementation is used by IniFile, so move those functions to StringUtil. A future commit will modify IniFile to use them.
2017-07-05Replace StringFromInt with std::to_stringLéo Lam
Updated version of #47. Android should support to_string now that we use a modern version of libc++ when building.
2017-06-15Add a namespace to OpenFStreamJosJuice
For consistency with the other functions in FileUtil.h.
2017-03-22IniFile: Replace a character erase with pop_back()Lioncash
Same thing, more straightforward.
2017-03-22IniFile: Replace string joining code with JoinStringLioncash
2017-03-22IniFile: std::move a std::string in GetLinesLioncash
Also gets rid of an unnecessary string copy.
2017-03-22IniFile: Use character literals instead of string literals where applicableLioncash
Character overloads are generally better overall (range checks aren't necessary, etc).
2017-03-22IniFile: Provide an rvalue reference overload for SetLinesLioncash
Allows moving in vectors instead of performing an unnecessary copy.
2017-03-22IniFile: Make Section's string constructor instances take strings by valueLioncash
As the name is immediately stored into a class member, a move here is a better choice. This also moves the constructor implementations into the cpp file to avoid an otherwise unnecessary inclusion in the header. This is also likely a better choice as Section contains several non-trivial members, so this would avoid potentially inlining a bunch of setup and teardown code related to them as a side-benefit.
2017-03-05Move IniFile section chunk handling to IniFile::SectionRyan Houdek
2017-02-25IniFile: Handle s64/u64 valuesLioncash
2017-02-04Translate Swedish in example strings to EnglishJosJuice
2016-06-24Reformat all the things. Have fun with merge conflicts.Pierre Bourdon
2015-08-19IniFile: Mark getter functions as constLioncash
2015-06-05Skip reading UTF-8 BOM at the beginning of INI filesJosJuice
2015-06-02Fix bug where Gecko codes would be "enabled by default"comex
Actually caused by IniFiles::GetLines leaving the output vector in its old state if the section wasn't found, and Gecko::LoadCodes not checking the return value. Fix by moving lines->clear() up.
2015-05-25Set copyright year to when a file was createdTillmann Karras
2015-05-25Update license headers to GPLv2+Tillmann Karras
2015-03-24DolphinWX/Common: Change some find_first_of usages to findLioncash
It's unnecessary to use find_first_of when all you're searching for is a single character.
2015-02-04Use emplace_* functions where in-place construction is preferableLioncash
2014-11-13Various formatting and consistency fixesStevoisiak
2014-09-04Change IniFile::Section::Set() with default value to use a template.Rachel Bryk
2014-08-13Add the VideoCommon PostProcessing class.Ryan Houdek
This class loads all the common PP shader configuration options and passes those options through to a inherited class that OpenGL or D3D will have. Makes it so all the common code for PP shaders is in VideoCommon instead of duplicating the code across each backend.
2014-06-24Store ini sections in a std::list (rather than vector) to prevent unexpected ↵Jordan Woyak
pointer invalidation with use of GetOrCreateSection.
2014-06-16Use only section-based ini reading.Lioncash
2014-05-28Get rid of the temporary buffer in IniFile's Load function.Lioncash
std::getline is the string-based equivalent.
2014-05-28When reading an ini file, if there is an error, check if it is simply ↵Rachel Bryk
because the eof was reached.
2014-05-23Check for errors when reading lines from ini files.Rachel Bryk
Fixes issue 7283.
2014-05-14Use size_t in std::string operations in IniFile.cpp, not intLioncash
2014-03-17Turn some non-const refs into pointersTillmann Karras
2014-03-11Fixes spacing for "for", "while", "switch" and "if"Matthew Parlane
Also moved && and || to ends of lines instead of start. Fixed misc vertical alignments and some { needed newlining.
2014-03-09clang-modernize -use-nullptrTillmann Karras
and s/\bNULL\b/nullptr/g for *.cpp/h/mm files not compiled on my machine
2014-02-28Various changes suggested by cppcheckTillmann Karras
- remove unused variables - reduce the scope where it makes sense - correct limits (did you know that strcat()'s last parameter does not include the \0 that is always added?) - set some free()'d pointers to NULL
2014-02-22Make Common/ mostly IWYU clean (and fix errors in rest of the project ↵Pierre Bourdon
detected by this change).
2014-02-20Fix more header sorting issues in Common/ (now check-includes clean).Pierre Bourdon
2014-02-18Convert all includes to relative paths.Lioncash
2014-02-13Turn loops into range-based formTillmann Karras
and some things suggested by cppcheck and compiler warnings.