openldap/contrib/ldapc++/src/LdifReader.h

56 lines
1.2 KiB
C
Raw Normal View History

2008-03-17 12:08:51 -04:00
/*
* Copyright 2008, OpenLDAP Foundation, All Rights Reserved.
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
*/
#ifndef LDIF_READER_H
#define LDIF_READER_H
#include <LDAPEntry.h>
#include <iosfwd>
#include <list>
typedef std::list< std::pair<std::string, std::string> > LdifRecord;
class LdifReader
{
public:
LdifReader( std::istream &input );
2008-03-20 09:24:49 -04:00
inline bool isEntryRecords() const
{
return !m_ldifTypeRequest;
}
inline bool isChangeRecords() const
{
return m_ldifTypeRequest;
}
inline int getVersion() const
{
return m_version;
}
2008-03-17 12:08:51 -04:00
LDAPEntry getEntryRecord();
2008-03-20 09:24:49 -04:00
int readNextRecord( bool first=false );
//LDAPRequest getChangeRecord();
2008-03-17 12:08:51 -04:00
private:
int getLdifLine(std::string &line);
int splitLine(const std::string& line,
std::string &type,
std::string &value );
std::string readIncludeLine( const std::string &line) const;
std::istream &m_ldifstream;
LdifRecord m_currentRecord;
2008-03-20 09:24:49 -04:00
int m_version;
2008-03-17 12:08:51 -04:00
int m_curRecType;
2008-03-20 09:24:49 -04:00
bool m_ldifTypeRequest;
bool m_currentIsFirst;
2008-03-17 12:08:51 -04:00
};
#endif /* LDIF_READER_H */