Skip to content
Snippets Groups Projects
Select Git revision
  • b364dd1d4cd06bfd79b5049bd4c36b972e63404f
  • master default protected
  • 6.x protected
  • pardiso
  • mkl-pardiso
  • madysson
  • 5.x protected
  • asm
  • time-varying-information-set
  • 4.6 protected
  • dynare_minreal
  • dragonfly
  • various_fixes
  • 4.5 protected
  • clang+openmp
  • exo_steady_state
  • declare_vars_in_model_block
  • julia
  • error_msg_undeclared_model_vars
  • static_aux_vars
  • slice
  • 6.4 protected
  • 6.3 protected
  • 6.2 protected
  • 6.1 protected
  • 6.0 protected
  • 6-beta2 protected
  • 6-beta1 protected
  • 5.5 protected
  • 5.4 protected
  • 5.3 protected
  • 5.2 protected
  • 5.1 protected
  • 5.0 protected
  • 5.0-rc1 protected
  • 4.7-beta3 protected
  • 4.7-beta2 protected
  • 4.7-beta1 protected
  • 4.6.4 protected
  • 4.6.3 protected
  • 4.6.2 protected
41 results

csv_parser.h

Blame
  • csv_parser.h 892 B
    // Copyright (C) 2007, Ondra Kamenik
    
    // $Id$
    
    #ifndef OGP_CSV_PARSER
    #define OGP_CSV_PARSER
    
    namespace ogp {
    
    	class CSVParserPeer {
    	public:
    		virtual ~CSVParserPeer() {}
    		virtual void item(int irow, int icol, const char* str, int length) = 0;
    	};
    
    	class CSVParser {
    	private:
    		CSVParserPeer& peer;
    		int row;
    		int col;
    		const char* parsed_string;
    	public:
    		CSVParser(CSVParserPeer& p)
    			: peer(p), row(0), col(0), parsed_string(0) {}
    		CSVParser(const CSVParser& csvp)
    			: peer(csvp.peer), row(csvp.row),
    			  col(csvp.col), parsed_string(csvp.parsed_string) {}
    		virtual ~CSVParser() {}
    
    		void csv_error(const char* mes);
    		void csv_parse(int length, const char* str);
    
    		void nextrow()
    			{row++; col = 0;}
    		void nextcol()
    			{col++;}
    		void item(int off, int length)
    			{peer.item(row, col, parsed_string+off, length);}
    	};
    };
    
    #endif
    
    // Local Variables:
    // mode:C++
    // End: