Subversion Repositories spk

Rev

Rev 165 | Rev 179 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

#pragma once

#include "String.h"
#include "../lists.h"
#include "List.h"

namespace Utils {

        typedef struct {
                String str;
                String data;
        } SStringList;

        typedef CListNode<SStringList> CStringListNode;
        typedef CList<SStringList>::iterator CStringListIterator;

        class SPKEXPORT CStringList
        {
        private:
                CList<SStringList> *_lList;

        public:
                CStringList();
                ~CStringList();

                void pushBack(const String &str, const String &data);
                void pushBack(const String &str);
                void pushFront(const String &str, const String &data);
                void pushFront(const String &str);
                void popBack();

                void insertAt(int at, const String& str, const String& data);
                void insertAt(int at, const String& str);

                void clear();
                void tokenise(const String &str, const String &token);

                Utils::String firstString();
                Utils::String nextString();
                Utils::SStringList *first();
                Utils::SStringList *next();
                CStringListIterator begin() const;
                CStringListIterator end() const;

                Utils::String front() const;
                Utils::String back() const;

                Utils::SStringList *get(int i) const;

                bool changeData(const Utils::String &str, const Utils::String &data, bool bIgnoreCase = false);
                bool contains(const Utils::String &data, bool bIgnoreCase = false) const;
                bool containsData(const Utils::String& str, bool bIgnoreCase = false) const;
                bool containsStringAndData(const Utils::String& str, const Utils::String &data, bool bIgnoreCase = false) const;
                Utils::String findData(const Utils::String &data, bool bIgnoreCase = false) const;
                Utils::String findString(const Utils::String &str, bool bIgnoreCase = false) const;
                int findStringAndData(const Utils::String& str, const Utils::String& data, bool bIgnoreCase = false) const;
                int findPos(const Utils::String& str, bool bIgnoreCase = false) const;

                CStringListIterator remove(CStringListIterator itr);
                bool remove(const Utils::String &str, bool single = true);
                void removeAt(int at);

                size_t size() const;
                bool empty() const;

                const Utils::SStringList* operator[](int num) const;
        };
} //NAMESPACE