Skip to content
Snippets Groups Projects
Select Git revision
  • 5969a7c537ee01e634c1823355edbb0a9db36575
  • master default protected
  • fullUD
  • movementInAction
4 results

File.hpp

Blame
  • File.hpp 784 B
    #ifndef FILE__H
    #define FILE__H
    
    #include <cstdio>
    #include <stack>
    #include <string>
    #include <functional>
    
    class File
    {
    	public : 
    	
    	static File stdOut;
    
    	private :
    
    	File(FILE * file);
    
    	private :
    
    	FILE * file;
    	std::stack<char> buffer;
    	bool endHasBeenReached;
    	std::string filename;
    
    	public :
    
    	File(const std::string & filename, const std::string & mode);
    	File(File && model) = delete;
    	File & operator=(const File & model) = delete;
    	~File();
    
    	char peek();
    	bool isFinished();
    	char getChar();
    	void ungetChar(char c);
    	FILE * getDescriptor();
    	const std::string & getName();
    	char readUntil(char c);
    	char readUntil(const std::function<bool(char)> & condition);
    	char readUntil(std::string & dest, const std::function<bool(char)> & condition);
    	void rewind();
    };
    
    #endif