Aegis  4.25.D505
common/wstring/list.h
Go to the documentation of this file.
00001 //
00002 //      aegis - project change supervisor
00003 //      Copyright (C) 2004-2008 Peter Miller
00004 //
00005 //      This program is free software; you can redistribute it and/or modify
00006 //      it under the terms of the GNU General Public License as published by
00007 //      the Free Software Foundation; either version 3 of the License, or
00008 //      (at your option) any later version.
00009 //
00010 //      This program is distributed in the hope that it will be useful,
00011 //      but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 //      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013 //      GNU General Public License for more details.
00014 //
00015 //      You should have received a copy of the GNU General Public License
00016 //      along with this program. If not, see
00017 //      <http://www.gnu.org/licenses/>.
00018 //
00019 
00020 #ifndef COMMON_WSTRING_LIST_H
00021 #define COMMON_WSTRING_LIST_H
00022 
00023 #include <common/wstring.h>
00024 #include <common/wstr/list.h>
00025 
00030 class wstring_list
00031 {
00032 public:
00039     ~wstring_list() {}
00040 
00044     wstring_list() {}
00045 
00049     wstring_list(const wstring_list &arg) :
00050         content(arg.content)
00051     {
00052     }
00053 
00057     wstring_list &operator=(const wstring_list &);
00058 
00063     void
00064     push_back(const wstring &arg)
00065     {
00066         content.push_back(arg.get_ref());
00067     }
00068 
00073     void
00074     push_back(const wstring_list &arg);
00075 
00080     const wstring
00081     back()
00082         const
00083     {
00084         if (content.empty())
00085             return wstring();
00086         return wstring(content[content.size() - 1]);
00087     }
00088 
00093     size_t
00094     size()
00095         const
00096     {
00097         return content.size();
00098     }
00099 
00104     bool
00105     empty()
00106         const
00107     {
00108         return content.empty();
00109     }
00110 
00114     void clear();
00115 
00120     wstring get(int n) const;
00121 
00126     wstring operator[](int n) const { return get(n); }
00127 
00135     wstring unsplit(const char *separator = 0) const;
00136 
00148     wstring unsplit(size_t first, size_t last, const char *separator = 0) const;
00149 
00150 private:
00155     wstring_list_ty content;
00156 };
00157 
00158 #endif // COMMON_WSTRING_LIST_H