FastUIDraw
string_array.hpp
Go to the documentation of this file.
1 /*!
2  * \file string_array.hpp
3  * \brief file string_array.hpp
4  *
5  * Copyright 2018 by Intel.
6  *
7  * Contact: kevin.rogovin@gmail.com
8  *
9  * This Source Code Form is subject to the
10  * terms of the Mozilla Public License, v. 2.0.
11  * If a copy of the MPL was not distributed with
12  * this file, You can obtain one at
13  * http://mozilla.org/MPL/2.0/.
14  *
15  * \author Kevin Rogovin <kevin.rogovin@gmail.com>
16  *
17  */
18 
19 
20 #ifndef FASTUIDRAW_STRING_ARRAY_HPP
21 #define FASTUIDRAW_STRING_ARRAY_HPP
22 
24 #include <fastuidraw/util/util.hpp>
25 
26 /*!\addtogroup Utility
27  * @{
28  */
29 namespace fastuidraw
30 {
31  /*!
32  * Simple class to hold an array of strings; string values
33  * are copied into the string_array.
34  */
36  {
37  public:
38  /*!
39  * Ctor.
40  */
41  string_array(void);
42 
43  /*!
44  * Copy ctor.
45  * \param obj value from which to copy
46  */
47  string_array(const string_array &obj);
48 
49  ~string_array();
50 
51  /*!
52  * Assignment operator
53  * \param rhs value from which to copy
54  */
56  operator=(const string_array &rhs);
57 
58  /*!
59  * Swap operator.
60  */
61  void
62  swap(string_array &obj);
63 
64  /*!
65  * Return the size() of the string_array.
66  */
67  unsigned int
68  size(void) const;
69 
70  /*!
71  * Resize of the string_array.
72  * \param size new size of the array
73  * \param value value with which to set all new elements
74  */
75  void
76  resize(unsigned int size, c_string value = "");
77 
78  /*!
79  * Clears the string_array.
80  */
81  void
82  clear(void);
83 
84  /*!
85  * Get all elements of the string_array, pointer
86  * and pointer contents are valid until the string_array
87  * is modified.
88  */
90  get(void) const;
91 
92  /*!
93  * Return an element of the array, pointer is
94  * valid until the string_array is modified.
95  * \param I element to get
96  */
97  c_string
98  get(unsigned int I) const;
99 
100  /*!
101  * Set an element of the array
102  * \param I element to set
103  * \param value string from which to copy to the element
104  */
105  string_array&
106  set(unsigned int I, c_string value);
107 
108  /*!
109  * Add an element
110  * \param value string from which to copy to the element
111  */
112  string_array&
113  push_back(c_string value);
114 
115  /*!
116  * Reduce the size by one.
117  */
118  string_array&
119  pop_back(void);
120 
121  private:
122  void *m_d;
123  };
124 }
125 /*! @} */
126 
127 #endif
void swap(string_array &obj)
all classes and functions of FastUIDraw are in the namespace fastuidraw.
Definition: colorstop.hpp:28
string_array & pop_back(void)
file c_array.hpp
file util.hpp
void resize(unsigned int size, c_string value="")
A c_array is a wrapper over a C pointer with a size parameter to facilitate bounds checking and provi...
Definition: c_array.hpp:43
string_array & push_back(c_string value)
const char * c_string
Conveniant typedef for C-style strings.
Definition: util.hpp:135
string_array & operator=(const string_array &rhs)
unsigned int size(void) const