GenApi  3.5.1
GCStringVector.h
Go to the documentation of this file.
1 //-----------------------------------------------------------------------------
2 // (c) 2005 by STEMMER IMAGING
3 //
4 // License: This file is published under the license of the EMVA GenICam Standard Group.
5 // A text file describing the legal terms is included in your installation as 'GenICam_license.pdf'.
6 // If for some reason you are missing this file please contact the EMVA or visit the website
7 // (http://www.genicam.org) for a full copy.
8 //
9 // THIS SOFTWARE IS PROVIDED BY THE EMVA GENICAM STANDARD GROUP "AS IS"
10 // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
11 // THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
12 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE EMVA GENICAM STANDARD GROUP
13 // OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
14 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
15 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
16 // OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
17 // WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
18 // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
19 // POSSIBILITY OF SUCH DAMAGE.
20 //
21 //
22 // Contributors:
23 //
24 // Bugfixes
25 // Copyright(C) 2025: Basler (Hartmut Nebelung)
26 //
27 //-----------------------------------------------------------------------------
31 
32 
33 
34 #ifndef GENICAM_GCSTRINGLIST_H
35 #define GENICAM_GCSTRINGLIST_H
36 
37 #include <Base/GCTypes.h>
38 #include <Base/GCString.h>
39 
40 #pragma pack(push, 8)
41 
42 
43 #if defined (_WIN32) || (defined (__GNUC__) && (defined (__linux__) || defined(__APPLE__) || defined(VXWORKS)))
44 
45 
46 namespace GENICAM_NAMESPACE
47 {
48 
53  class GCBASE_API gcstring_vector
54  {
55  // Nested types
56  // ---------------------------------------------------------------------------
57  public:
58  class GCBASE_API const_iterator
59  {
60  // Ctor / Dtor
61  // -------------------------------------------------------------------------
62  public:
63  const_iterator(gcstring *pStr = 0);
64 
65  // Operators
66  // -------------------------------------------------------------------------
67  public:
68  const gcstring & operator * (void) const;
69  const gcstring * operator -> (void) const;
70  const_iterator & operator ++ (void);
71  const_iterator operator ++ (int);
72  const_iterator & operator -- (void);
73  const_iterator operator -- (int);
74  const_iterator & operator += (intptr_t iInc);
75  const_iterator operator + (intptr_t iInc) const;
76  const_iterator & operator -= (intptr_t iDec);
77  intptr_t operator - (const const_iterator &iter) const;
78  const_iterator operator - (intptr_t iDec) const;
79  const gcstring & operator [] (intptr_t iIndex) const;
80  bool operator == (const const_iterator &iter) const;
81  bool operator != (const const_iterator &iter) const;
82  bool operator < (const const_iterator &iter) const;
83  bool operator > (const const_iterator &iter) const;
84  bool operator <= (const const_iterator &iter) const;
85  bool operator >= (const const_iterator &iter) const;
86  GCBASE_API
87  friend const_iterator operator + (intptr_t iInc, const const_iterator &iter);
88 
89  // Member
90  // -------------------------------------------------------------------------
91  protected:
92  gcstring * _ps;
93  };
94 
95  class GCBASE_API iterator :
96  public const_iterator
97  {
98  // Ctor / Dtor
99  // -------------------------------------------------------------------------
100  public:
101  iterator(gcstring *pStr = 0);
102 
103  // Operators
104  // -------------------------------------------------------------------------
105  public:
106  gcstring & operator * (void) const;
107  gcstring * operator -> (void) const;
108  iterator & operator ++ (void);
109  iterator operator ++ (int);
110  iterator & operator -- (void);
111  iterator operator -- (int);
112  iterator & operator += (intptr_t iInc);
113  iterator operator + (intptr_t iInc) const;
114  iterator & operator -= (intptr_t iDec);
115  intptr_t operator - (const iterator &iter) const;
116  iterator operator - (intptr_t iDec) const;
117  gcstring & operator [] (intptr_t iIndex) const;
118  GCBASE_API
119  friend iterator operator + (intptr_t iInc, const iterator &iter);
120  };
121 
122  // Ctor / Dtor
123  // ---------------------------------------------------------------------------
124  public:
125  gcstring_vector(void);
126  explicit gcstring_vector(size_t uiSize, const gcstring &str = gcstring());
127  gcstring_vector(const gcstring_vector &obj);
128  virtual ~gcstring_vector(void);
129 
130  // Element access
131  // ---------------------------------------------------------------------------
132  public:
133  virtual void assign(size_t n, const gcstring &val);
134  virtual void clear(void);
135  virtual iterator erase(iterator pos);
136  virtual gcstring & at(size_t uiIndex);
137  virtual const gcstring & at(size_t uiIndex) const;
138  virtual gcstring & back(void);
139  virtual const gcstring & back(void) const;
140  virtual iterator begin(void);
141  virtual const_iterator begin(void) const;
142  virtual size_t capacity(void) const;
143  virtual iterator end(void);
144  virtual const_iterator end(void) const;
145  virtual gcstring & front(void);
146  virtual const gcstring & front(void) const;
147  virtual size_t max_size(void) const;
148  virtual size_t size(void) const;
149  virtual iterator insert(iterator pos, const gcstring &str);
150  virtual bool empty(void) const;
151  virtual void pop_back(void);
152  virtual void push_back(const gcstring &str);
153  virtual void resize(size_t uiSize, const gcstring &str = gcstring());
154  virtual void reserve(size_t uiSize);
155  virtual bool contains(const gcstring &str) const;
156 
157  // Do not use the methods below - they only exist for
158  // backwards compatibility
159  virtual gcstring_vector & assign(const gcstring_vector &obj);
160  virtual void erase(size_t uiIndex);
161  virtual void insert(size_t uiIndex, const gcstring &str);
162 
163 
164  // Operators
165  // ---------------------------------------------------------------------------
166  public:
167  gcstring_vector & operator = (const gcstring_vector &obj);
168  gcstring & operator [] (size_t uiIndex);
169  const gcstring & operator [] (size_t uiIndex) const;
170  void operator delete (void *pWhere);
171  void * operator new (size_t uiSize);
172 
173  // Member
174  // ---------------------------------------------------------------------------
175  private:
176  void * _pv;
177  };
178 
179 }
180 
181 
182 
183 #else
184 # error No known support for shared libraries
185 #endif
186 
187 #pragma pack(pop)
188 
189 #endif // GENICAM_GCSTRINGLIST_H
Definition: GCArray.h:33
Portable string implementation.
Platform-dependent type definitions.