STRINGLIST
Classes
Files
- stringlist.h
- stringlist.cpp
This class is for storing more std::string's in better way than in std::vector.
Interface
-
stringlist
Just constructor, nothing to worry about, it's called automatically.
-
~stringlist
Destructor, again, nothing to worry about.
-
operator=
Assignment handling function, another automatically called stuff.
-
size
This one returns count of strings inside.
-
operator[]
This one is called automatically when you write something like stringlist[some_index].
-
add
Adds new string into list.
-
join
Takes another stringlist as a argument and adds into itself all its strings. (Bud does not change that one)
-
operator+=
Acts like add or join, depending on the type of argument. It also returns itself to allow things like: stringlist += second_one += first_one. It will add both ones into it, first and then the second. (See c operator priorities if you don't know why)
-
operator+
It is very similar to the operator+=, but it does not change the stringlist, instead of that returns a new one, containing that all.
-
insert
Similar to add, but you can put that string anywhere inside. stringlist.insert(index, string)
-
find & operator%
Returns index of first string that was given as an argument. If there is no such one, returns -1.
-
count
Exactly the same as size.
-
remove
Removes item, returning weather it was there or not. As a argument, provide eather index of the string, or the string itself. If you provide string and is it there more times, it removes only the first.
-
remove_last
Removes last item, can be used for string stack. If it was empty before, returns false, otherwise it returns true.
-
operator-=
Acts like remove, just it returns itself, so you can use it in multiple removes, like list -= one_item -= another_item...
-
operator-
Returns new stringlist with the given item removed.
-
clear
Removes all items inside.
Please note, that this class does not do any range check, it's up to you to ask only for items that are in range 0..size() - 1.