ldapsdk  0.0.1
LdifReader.h
Go to the documentation of this file.
1 // $OpenLDAP$
2 /*
3  * Copyright 2008-2013 The OpenLDAP Foundation, All Rights Reserved.
4  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
5  */
6 
7 #ifndef LDIF_READER_H
8 #define LDIF_READER_H
9 
10 #include <LDAPEntry.h>
11 #include <iosfwd>
12 #include <list>
13 
14 typedef std::list< std::pair<std::string, std::string> > LdifRecord;
16 {
17  public:
18  LdifReader( std::istream &input );
19 
20  inline bool isEntryRecords() const
21  {
22  return !m_ldifTypeRequest;
23  }
24 
25  inline bool isChangeRecords() const
26  {
27  return m_ldifTypeRequest;
28  }
29 
30  inline int getVersion() const
31  {
32  return m_version;
33  }
34 
36  int readNextRecord( bool first=false );
37  //LDAPRequest getChangeRecord();
38 
39  private:
40  int getLdifLine(std::string &line);
41 
42  void splitLine(const std::string& line,
43  std::string &type,
44  std::string &value ) const;
45 
46  std::string readIncludeLine( const std::string &line) const;
47 
48  std::istream &m_ldifstream;
49  LdifRecord m_currentRecord;
50  int m_version;
51  int m_curRecType;
52  int m_lineNumber;
53  bool m_ldifTypeRequest;
54  bool m_currentIsFirst;
55 };
56 
57 #endif /* LDIF_READER_H */
LDAP_DEBUG_ANY
#define LDAP_DEBUG_ANY
Definition: debug.h:16
LdifReader::readNextRecord
int readNextRecord(bool first=false)
Definition: LdifReader.cpp:33
LdifRecord
std::list< std::pair< std::string, std::string > > LdifRecord
Definition: LdifReader.h:14
LDAP_DEBUG_TRACE
#define LDAP_DEBUG_TRACE
Definition: debug.h:12
LDAPMsg::DELETE_REQUEST
static const int DELETE_REQUEST
Definition: LDAPMessage.h:42
LDAPAttributeList::addAttribute
void addAttribute(const LDAPAttribute &attr)
Adds one element to the end of the list.
Definition: LDAPAttributeList.cpp:110
LDAPMsg::SEARCH_ENTRY
static const int SEARCH_ENTRY
Definition: LDAPMessage.h:27
LdifReader
Definition: LdifReader.h:15
LDAPAttributeList::delAttribute
void delAttribute(const std::string &type)
Deletes all values of an Attribute for the list.
Definition: LDAPAttributeList.cpp:143
LDAPUrl.h
DEBUG
#define DEBUG(level, arg)
Definition: debug.h:30
LdifReader.h
LDAPMessage.h
LDAPAttributeList
This container class is used to store multiple LDAPAttribute-objects.
Definition: LDAPAttributeList.h:22
LDAPAttribute::getName
const std::string & getName() const
Definition: LDAPAttribute.cpp:151
LDAPAttribute::addValue
void addValue(const std::string &value)
Add a single string value(bin/char) to the Attribute.
LDAPEntry.h
LDAPEntry
This class is used to store every kind of LDAP Entry.
Definition: LDAPEntry.h:19
LDAPMsg::MODRDN_REQUEST
static const int MODRDN_REQUEST
Definition: LDAPMessage.h:43
LDAPAttributeList::getAttributeByName
const LDAPAttribute * getAttributeByName(const std::string &name) const
Get an Attribute by its AttributeType.
Definition: LDAPAttributeList.cpp:91
LdifReader::getVersion
int getVersion() const
Definition: LdifReader.h:30
LDAPMsg::ADD_REQUEST
static const int ADD_REQUEST
Definition: LDAPMessage.h:41
LdifReader::isChangeRecords
bool isChangeRecords() const
Definition: LdifReader.h:25
LdifReader::getEntryRecord
LDAPEntry getEntryRecord()
Definition: LdifReader.cpp:180
LDAPEntry::setAttributes
void setAttributes(LDAPAttributeList *attrs)
Sets the attributes of the entry.
Definition: LDAPEntry.cpp:61
LDAPAttribute.h
LDAPAttribute
Represents the name an value(s) of an Attribute.
Definition: LDAPAttribute.h:21
LdifReader::LdifReader
LdifReader(std::istream &input)
Definition: LdifReader.cpp:23
LDAPAttributeList.h
LdifReader::isEntryRecords
bool isEntryRecords() const
Definition: LdifReader.h:20
LDAPMsg::MODIFY_REQUEST
static const int MODIFY_REQUEST
Definition: LDAPMessage.h:40
stringpair
std::pair< std::string, std::string > stringpair
Definition: LdifReader.cpp:21
debug.h