~redstrate/libxiv

libxiv/src/exlparser.cpp -rw-r--r-- 508 bytes
f3feece1Joshua Goins Add deprecation notice 7 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#include "exlparser.h"

#include <stdexcept>
#include <fstream>

EXL readEXL(MemorySpan data) {
    auto stream = data.read_as_stream();

    EXL exl;

    std::string line;
    while (std::getline(stream, line)) {
        const size_t comma = line.find_first_of(',');

        std::string name = line.substr(0, comma);

        if(name != "EXLT") {
            std::string id = line.substr(comma + 1, line.length());

            exl.rows.push_back({name, std::stoi(id)});
        }
    }

    return exl;
}