lemon/lemon_reader.h
changeset 1869 52f5a7f9fb48
parent 1845 f8bbfed86036
child 1875 98698b69a902
equal deleted inserted replaced
9:a3b5f521c9f6 10:7d8663f03e3d
   423     };
   423     };
   424 
   424 
   425     class ValueReaderBase {
   425     class ValueReaderBase {
   426     public:
   426     public:
   427       virtual void read(std::istream&) {};
   427       virtual void read(std::istream&) {};
       
   428       ValueReaderBase() { _touched = false; }
       
   429 
       
   430       void touch() { _touched = true; }
       
   431       bool touched() const { return _touched; }
       
   432 
   428       virtual ~ValueReaderBase() {}
   433       virtual ~ValueReaderBase() {}
       
   434     private:
       
   435       bool _touched;
   429     };
   436     };
   430 
   437 
   431     template <typename _Value, typename _Reader>
   438     template <typename _Value, typename _Reader>
   432     class ValueReader : public ValueReaderBase {
   439     class ValueReader : public ValueReaderBase {
   433     public:
   440     public:
  1924 	std::string id;
  1931 	std::string id;
  1925 	ls >> id;
  1932 	ls >> id;
  1926 	typename Readers::iterator it = readers.find(id);
  1933 	typename Readers::iterator it = readers.find(id);
  1927 	if (it != readers.end()) {
  1934 	if (it != readers.end()) {
  1928 	  it->second->read(ls);
  1935 	  it->second->read(ls);
  1929 	}
  1936 	  it->second->touch();
       
  1937 	}
       
  1938       }
       
  1939       for (typename Readers::iterator it = readers.begin();
       
  1940 	   it != readers.end(); ++it) {
       
  1941 	if (!it->second->touched()) {
       
  1942 	  ErrorMessage msg;
       
  1943 	  msg << "Attribute not found in file: " << it->first;
       
  1944 	  throw IOParameterError(msg.message());
       
  1945 	}	
  1930       }
  1946       }
  1931     }    
  1947     }    
  1932 
  1948 
  1933   private:
  1949   private:
  1934     std::string id;
  1950     std::string id;