From 68393d2b072401ea738535ac8b07bbda98af9206 Mon Sep 17 00:00:00 2001 From: Nic0Nic0Nii Date: Wed, 26 Jul 2023 19:53:34 +0000 Subject: [PATCH] Fix indexing and use _ identifiers to please the compiler Co-authored-by: sigonasr2 --- Crawler/Crawler.cpp | 23 ++++++------ Crawler/Crawler.h | 16 ++++---- Crawler/olcUTIL_DataFile.h | 75 ++++++++++++++++++++------------------ 3 files changed, 59 insertions(+), 55 deletions(-) diff --git a/Crawler/Crawler.cpp b/Crawler/Crawler.cpp index 735c948b..0c608b8a 100644 --- a/Crawler/Crawler.cpp +++ b/Crawler/Crawler.cpp @@ -42,11 +42,12 @@ Crawler::Crawler() utils::datafile::Read(DATA,"assets/config/configuration.txt"); - std::string CONFIG_PATH = "config_path"S; + std::string CONFIG_PATH = "config_path"_S; - std::string GFX_CONFIG = CONFIG_PATH + "gfx_config"S; + std::string GFX_CONFIG = CONFIG_PATH + "gfx_config"_S; utils::datafile::Read(DATA,GFX_CONFIG); - WINDOW_SIZE={"WINDOW_SIZE"i[0],"WINDOW_SIZE"i[1]}; + WINDOW_SIZE={"WINDOW_SIZE"_i[0],"WINDOW_SIZE"_i[1]}; + std::cout<data; - std::string key; - public: - inline datafilestringdata(datafile&dat,std::string key) - :data(dat),key(key){}; - std::string operator[](int index){data.get().GetIndexedProperty(key,index).GetString();}; - }; - class datafileintdata - { - std::reference_wrapperdata; - std::string key; - public: - inline datafileintdata(datafile&dat,std::string key) - :data(dat),key(key){}; - int operator[](int index){data.get().GetIndexedProperty(key,index).GetInt();}; - }; - class datafilefloatdata - { - std::reference_wrapperdata; - std::string key; - public: - inline datafilefloatdata(datafile&dat,std::string key) - :data(dat),key(key){}; - float operator[](int index){data.get().GetIndexedProperty(key,index).GetReal();}; - }; - class datafiledoubledata - { - std::reference_wrapperdata; - std::string key; - public: - inline datafiledoubledata(datafile&dat,std::string key) - :data(dat),key(key){}; - double operator[](int index){data.get().GetIndexedProperty(key,index).GetReal();}; - }; class datafile { public: @@ -473,4 +437,43 @@ namespace olc::utils // Used to identify if a property is a comment or not, not user facing bool m_bIsComment = false; }; + + class datafilestringdata + { + std::reference_wrapperdata; + std::string key; + public: + inline datafilestringdata(datafile&dat,std::string key) + :data(dat),key(key){}; + std::string operator[](int index){return data.get().GetProperty(key).GetString(index);}; + }; + class datafileintdata + { + std::reference_wrapperdata; + std::string key; + public: + inline datafileintdata(datafile&dat,std::string key) + :data(dat),key(key){}; + int operator[](int index){ + return data.get().GetProperty(key).GetInt(index); + }; + }; + class datafilefloatdata + { + std::reference_wrapperdata; + std::string key; + public: + inline datafilefloatdata(datafile&dat,std::string key) + :data(dat),key(key){}; + float operator[](int index){return data.get().GetProperty(key).GetReal(index);}; + }; + class datafiledoubledata + { + std::reference_wrapperdata; + std::string key; + public: + inline datafiledoubledata(datafile&dat,std::string key) + :data(dat),key(key){}; + double operator[](int index){return data.get().GetProperty(key).GetReal(index);}; + }; } \ No newline at end of file