/* * This file is automaticaly generated, Please dont edit this file! */ #include text * cache_getFile( cache * this, char * filePath ) { struct file * currentFile = cache_getCachedFileByPath( this, filePath ); if( currentFile == NULL ) { struct text * content = fileSystem_readFile( filesystem, filePath, "binary" ); cache_addFile( this, filePath, content ); return content; } else { return currentFile->content; } } void cache_addFile( cache * this, char * filePath, struct text * content ) { struct file * newFile = file_newPointer(); newFile->filePath = filePath; newFile->content = content; array_add( this->files, newFile ); } struct file * cache_getCachedFileByPath( cache * this, char * filePath ) { struct array * files = this->files; int count = array_length( files ); for (int i = 0; i < count; ++i) { file * currentFile = array_get( files, i ); if( char_operator_compare( currentFile->filePath , filePath) ) { return currentFile; } } return NULL; } cache cache_new() { cache instance; instance.files = array_newPointer(); return instance; } cache * cache_newPointer() { struct cache * pointer = malloc( sizeof ( struct cache ) ); pointer->files = array_newPointer(); return pointer; }