|
Aegis
4.25.D505
|
00001 // 00002 // aegis - project change supervisor 00003 // Copyright (C) 2004-2008, 2010-2012 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 (at 00008 // 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 GNU 00013 // 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 <http://www.gnu.org/licenses/>. 00017 // 00018 00019 #ifndef COMMON_NSTRING_LIST_H 00020 #define COMMON_NSTRING_LIST_H 00021 00022 #include <common/nstring.h> 00023 #include <common/str_list.h> 00024 00029 class nstring_list 00030 { 00031 public: 00038 ~nstring_list() 00039 { 00040 } 00041 00045 nstring_list() 00046 { 00047 } 00048 00052 nstring_list(const nstring_list &arg) : 00053 content(arg.content) 00054 { 00055 } 00056 00060 nstring_list(const string_list_ty &arg) : 00061 content(arg) 00062 { 00063 } 00064 00068 nstring_list &operator=(const nstring_list &); 00069 00077 void 00078 push_front(const nstring &arg) 00079 { 00080 content.push_front(arg.get_ref()); 00081 } 00082 00090 void 00091 push_front(const nstring_list &arg) 00092 { 00093 content.push_front(arg.content); 00094 } 00095 00100 void 00101 push_back(const nstring &arg) 00102 { 00103 content.push_back(arg.get_ref()); 00104 } 00105 00113 void push_back(const nstring_list &arg); 00114 00119 void 00120 push_back_unique(const nstring &arg) 00121 { 00122 content.push_back_unique(arg.get_ref()); 00123 } 00124 00130 void push_back_unique(const nstring_list &arg); 00131 00136 void 00137 pop_back(void) 00138 { 00139 content.pop_back(); 00140 } 00141 00146 const nstring 00147 back(void) 00148 const 00149 { 00150 if (!content.nstrings) 00151 return nstring(); 00152 return nstring(content.string[content.nstrings - 1]); 00153 } 00154 00159 void pop_front(void); 00160 00165 nstring 00166 front(void) 00167 const 00168 { 00169 if (!content.nstrings) 00170 return nstring(); 00171 return nstring(content.string[0]); 00172 } 00173 00178 size_t 00179 size(void) 00180 const 00181 { 00182 return content.nstrings; 00183 } 00184 00189 bool 00190 empty(void) 00191 const 00192 { 00193 return !content.nstrings; 00194 } 00195 00199 void clear(void); 00200 00205 nstring get(int n) const; 00206 00211 nstring 00212 operator[](int n) 00213 const 00214 { 00215 return get(n); 00216 } 00217 00231 void split(const nstring &str, const char *sep = 0, bool ewhite = false); 00232 00240 nstring unsplit(const char *separator = 0) const; 00241 00253 nstring unsplit(size_t begin, size_t length, const char *separator = 0) 00254 const; 00255 00265 bool member(const nstring &arg) const; 00266 00272 void sort(void); 00273 00279 void sort_version(void); 00280 00286 void sort_nocase(void); 00287 00300 int gmatch_pattern(const nstring &pattern) const; 00301 00313 int gmatch_candidate(const nstring &candidate) const; 00314 00322 void remove(const nstring &arg); 00323 00331 void operator+=(const nstring_list &rhs); 00332 00342 nstring_list operator+(const nstring_list &rhs) const; 00343 00351 void operator-=(const nstring_list &rhs); 00352 00362 nstring_list operator-(const nstring_list &rhs) const; 00363 00371 void operator*=(const nstring_list &rhs); 00372 00382 nstring_list operator*(const nstring_list &rhs) const; 00383 00394 bool operator!=(const nstring_list &rhs) const; 00395 00406 bool operator==(const nstring_list &rhs) const; 00407 00408 private: 00413 string_list_ty content; 00414 }; 00415 00416 #endif // COMMON_NSTRING_LIST_H 00417 // vim: set ts=8 sw=4 et :
1.7.6.1