PStringList.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2015-2018 Digital Barriers plc. All rights reserved.
3  * Contact: http://www.digitalbarriers.com/
4  *
5  * This file is part of the Papillon SDK.
6  *
7  * You can't use, modify or distribute any part of this file without
8  * the explicit written agreements of Digital Barriers.
9  */
10 
15 #pragma once
16 #include <PObject.h>
17 #include <PString.h>
18 
19 PAPILLON_BEGIN_NAMESPACE
20 
26 class PAPILLON_API_CORE PStringList : public PObject
27 {
28 public:
32  PStringList();
33 
37  PStringList(const PString& s0,
38  const PString& s1 = PString::Empty(),
39  const PString& s2 = PString::Empty(),
40  const PString& s3 = PString::Empty(),
41  const PString& s4 = PString::Empty(),
42  const PString& s5 = PString::Empty(),
43  const PString& s6 = PString::Empty(),
44  const PString& s7 = PString::Empty(),
45  const PString& s8 = PString::Empty(),
46  const PString& s9 = PString::Empty()
47  );
48 
52  PStringList(const PStringList& other);
53 
57  ~PStringList();
58 
62  PStringList& operator=(const PStringList& other);
63 
67  PStringList Clone() const;
68 
74  bool operator!=(const PStringList& other) const;
75 
81  bool operator==(const PStringList& other) const;
82 
88  void Clear();
89 
95  bool IsEmpty() const;
96 
102  papillon::int32 Size() const;
103 
109  const PString& Get(const papillon::int32 index) const;
110 
115  PResult Set(const int32 index, const PString& s);
116 
121  PStringList& Add(const PString& s);
122 
126  PStringList& AddAll(const PStringList& l);
127 
133  PStringList& RemoveFirst();
134 
140  PStringList& RemoveLast();
141 
146  PStringList& RemoveOne(const PString& s);
147 
152  PStringList& RemoveAll(const PString& s);
153 
159  PStringList& RemoveDuplicates();
160 
164  bool Contains(const PString& s) const;
165 
170  PString Join(const PString& separator) const;
171 
175  PStringList Filter(const PString& regexp) const;
176 
180  PStringList ToUpper() const;
181 
186  PStringList Sorted() const;
187 
191  PStringList Shuffled() const;
192 
199  static PResult FromTextFile(const PString& textFilename, PStringList& l);
200 };
201 
202 PAPILLON_END_NAMESPACE
The PString class provides an Unicode character strings.
Definition: PString.h:38
The PResult class represents the result returned by most of Papillon functions; this class is used to...
Definition: PResult.h:159
The PObject class is the root class of all Papillon classes; all PObject behaves like shared referenc...
Definition: PObject.h:27
Class PString: an unicode character strings (use copy-on-write idiom).
The PStringList class represents a list of PString; NOT thread-safe.
Definition: PStringList.h:26
static const PString & Empty()
Returns the constant holding the empty string "".
Definition: PString.h:59
Class PObject: the root class of all Papillon classes.
PObject & operator=(const PObject &obj)
Performs a shared copy of other to this object.
Definition: PObject.h:45