params_t ReadParams(const ::std::string& path, char delimiter = ',') { params_t params; IFile* fp = detail::IFileSystem::New(); if( fp != NULL ) { if( fp->Open(path.c_str(), IFile::OpenRead) ) { const ::std::string dataset = fp->ReadAll(); ::std::string::size_type prev = 0; ::std::string::size_type pos = 0; while( pos = dataset.find(delimiter, prev), pos != ::std::string::npos ) { const ::std::string data = dataset.substr(prev, pos - prev); AppendParams(params, data); ++pos; prev = pos; } AppendParams(params, dataset.substr(prev)); } else { fprintf(stderr, "Unable to open file \"%s\".\n", path.c_str()); fflush(stderr); } detail::IFileSystem::Free(fp); } IUTEST_CHECK_(!params.empty()); return params; }
void PixelBuffer::LoadPng(IFile &source, PixelBuffer &textureData) { auto fileContent = source.ReadAll(); get_raw_image_data_from_png(std::get<0>(fileContent).get(), std::get<1>(fileContent), textureData); }