1/*	$NetBSD$	*/
2
3// OpenLDAP: pkg/ldap/contrib/ldapc++/src/StringList.h,v 1.7.6.1 2008/04/14 23:09:26 quanah Exp
4/*
5 * Copyright 2000, OpenLDAP Foundation, All Rights Reserved.
6 * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
7 */
8
9#ifndef STRING_LIST_H
10#define STRING_LIST_H
11
12#include <string>
13#include <list>
14/**
15 * Container class to store multiple string-objects
16 */
17class StringList{
18    typedef std::list<std::string> ListType;
19
20    private:
21        ListType m_data;
22
23    public:
24	typedef ListType::const_iterator const_iterator;
25
26        /**
27         * Constructs an empty list.
28         */
29        StringList();
30
31        /**
32         * Copy-constructor
33         */
34        StringList(const StringList& sl);
35
36        /**
37         * For internal use only
38         *
39         * This constructor is used by the library internally to create a
40         * list of string from a array for c-Strings (char*)thar was
41         * returned by the C-API
42         */
43        StringList(char** values);
44
45        /**
46         * Destructor
47         */
48        ~StringList();
49
50        /**
51         * The methods converts the list to a 0-terminated array of
52         * c-Strings.
53         */
54        char** toCharArray() const;
55
56        /**
57         * Adds one element to the end of the list.
58         * @param attr The attribute to add to the list.
59         */
60        void add(const std::string& value);
61
62        /**
63         * @return The number of strings that are currently
64         * stored in this list.
65         */
66        size_t size() const;
67
68        /**
69         * @return true if there are zero strings currently
70         * stored in this list.
71         */
72        bool empty() const;
73
74        /**
75         * @return A iterator that points to the first element of the list.
76         */
77        const_iterator begin() const;
78
79        /**
80         * @return A iterator that points to the element after the last
81         * element of the list.
82         */
83        const_iterator end() const;
84
85        /**
86         * removes all elements from the list
87         */
88        void clear();
89};
90#endif //STRING_LIST_H
91