// General.cpp - Obsahuje definice pomocných funkcí
// Autor:   Jan Benda
// Datum:   16.02.2021
#pragma once
#include "General.h"

namespace General
    {
    int getIndex(const std::string value, const std::vector<std::string> vector)
        {
        for(int i = 0; i < vector.size(); i++)
            if(vector.at(i) == value)
                return i;
        return -1;
        }

    short getID(const std::string classLabel)
        {
        std::string subString = classLabel.substr(1, 2);
        if(subString == "09")
            return 9;
        else if(subString == "10")
            return 10;
        else if(subString == "11")
            return 11;
        else if(subString == "12")
            return 12;
        else
            return -1;
        }

    std::string getFilename(std::string filepath)
        {
        const size_t last_slash_idx = filepath.find_last_of("\\/");
        if(std::string::npos != last_slash_idx)
            filepath.erase(0, last_slash_idx + 1);
            
        return filepath;
        }
    }