LdifReader.h revision 1.1
1/* 2 * Copyright 2008, OpenLDAP Foundation, All Rights Reserved. 3 * COPYING RESTRICTIONS APPLY, see COPYRIGHT file 4 */ 5 6#ifndef LDIF_READER_H 7#define LDIF_READER_H 8 9#include <LDAPEntry.h> 10#include <iosfwd> 11#include <list> 12 13typedef std::list< std::pair<std::string, std::string> > LdifRecord; 14class LdifReader 15{ 16 public: 17 LdifReader( std::istream &input ); 18 19 inline bool isEntryRecords() const 20 { 21 return !m_ldifTypeRequest; 22 } 23 24 inline bool isChangeRecords() const 25 { 26 return m_ldifTypeRequest; 27 } 28 29 inline int getVersion() const 30 { 31 return m_version; 32 } 33 34 LDAPEntry getEntryRecord(); 35 int readNextRecord( bool first=false ); 36 //LDAPRequest getChangeRecord(); 37 38 private: 39 int getLdifLine(std::string &line); 40 41 void splitLine(const std::string& line, 42 std::string &type, 43 std::string &value ) const; 44 45 std::string readIncludeLine( const std::string &line) const; 46 47 std::istream &m_ldifstream; 48 LdifRecord m_currentRecord; 49 int m_version; 50 int m_curRecType; 51 int m_lineNumber; 52 bool m_ldifTypeRequest; 53 bool m_currentIsFirst; 54}; 55 56#endif /* LDIF_READER_H */ 57