From 7731832751ab9f3c6ddeb66f186d3d7fa1934a6d Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sat, 27 Apr 2024 13:11:40 +0200 Subject: Adding upstream version 2.4.57+dfsg. Signed-off-by: Daniel Baumann --- contrib/ldapc++/src/LdifReader.h | 57 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 contrib/ldapc++/src/LdifReader.h (limited to 'contrib/ldapc++/src/LdifReader.h') diff --git a/contrib/ldapc++/src/LdifReader.h b/contrib/ldapc++/src/LdifReader.h new file mode 100644 index 0000000..b77fd34 --- /dev/null +++ b/contrib/ldapc++/src/LdifReader.h @@ -0,0 +1,57 @@ +// $OpenLDAP$ +/* + * Copyright 2008-2021 The OpenLDAP Foundation, All Rights Reserved. + * COPYING RESTRICTIONS APPLY, see COPYRIGHT file + */ + +#ifndef LDIF_READER_H +#define LDIF_READER_H + +#include +#include +#include + +typedef std::list< std::pair > LdifRecord; +class LdifReader +{ + public: + LdifReader( std::istream &input ); + + inline bool isEntryRecords() const + { + return !m_ldifTypeRequest; + } + + inline bool isChangeRecords() const + { + return m_ldifTypeRequest; + } + + inline int getVersion() const + { + return m_version; + } + + LDAPEntry getEntryRecord(); + int readNextRecord( bool first=false ); + //LDAPRequest getChangeRecord(); + + private: + int getLdifLine(std::string &line); + + void splitLine(const std::string& line, + std::string &type, + std::string &value ) const; + + std::string readIncludeLine( const std::string &line) const; + + std::istream &m_ldifstream; + LdifRecord m_currentRecord; + int m_version; + int m_curRecType; + int m_lineNumber; + bool m_ldifTypeRequest; + bool m_currentIsFirst; +}; + +#endif /* LDIF_READER_H */ -- cgit v1.2.3