X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2FcreaDevManagerLib%2FCDMUtilities.cpp;h=d67ec36f54feb879c81fdbbda2040ee7caaebc98;hb=38fb78e3930c8ba01021536630624e4b0b03dd87;hp=77f5f52cb7b199ec3efb419551f6b7cea640b80a;hpb=9877d27eb9a1339d97bc8e13ec5f1f75a5dc9e3f;p=crea.git diff --git a/lib/creaDevManagerLib/CDMUtilities.cpp b/lib/creaDevManagerLib/CDMUtilities.cpp index 77f5f52..d67ec36 100644 --- a/lib/creaDevManagerLib/CDMUtilities.cpp +++ b/lib/creaDevManagerLib/CDMUtilities.cpp @@ -356,6 +356,23 @@ namespace CDMUtilities return res; } + std::string readFile(const std::string& file_path) + { + std::string res; + std::ifstream file(file_path.c_str()); + if (file.is_open()) + { + char ch = file.get(); + while (!file.eof()) + { + res.push_back(ch); + ch = file.get(); + } + file.close(); + } + return res; + } + CMLFile readCMLFile(const std::string& file_path) { CMLFile res; @@ -506,4 +523,14 @@ namespace CDMUtilities return false; } + void + normalizeStr(std::string& st) + { + while(st.size() && isspace(st[0])) + st.erase(0,1); + while(st.size() && isspace(st[st.size()-1])) + st.erase(st.size()-1,1); + return; + } + }