2 #ifndef _GLIBMM_SARRAY_H
3 #define _GLIBMM_SARRAY_H
5 /* $Id: sarray.h 2 2003-01-07 16:59:16Z murrayc $ */
9 * Copyright (C) 2002 The gtkmm Development Team
11 * This library is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU Library General Public
13 * License as published by the Free Software Foundation; either
14 * version 2 of the License, or (at your option) any later version.
16 * This library is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 * Library General Public License for more details.
21 * You should have received a copy of the GNU Library General Public
22 * License along with this library; if not, write to the Free
23 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
27 #include <glibmm/arrayhandle.h>
28 #include <glibmm/ustring.h>
30 namespace Glib { typedef Glib::ArrayHandle<Glib::ustring> SArray; }
38 inline void cpp_type_to_c_type(const ustring& cpp_value, type_constpch& ref_c_value)
40 ref_c_value = cpp_value.c_str();
44 inline void cpp_type_to_c_type(const std::string& cpp_value, type_constpch& ref_c_value)
46 ref_c_value = cpp_value.c_str();
49 typedef Array<Glib::ustring, const char*> SArray;
52 class SArray: public Array<nstring, const char*>
55 typedef const char* T_c;
56 typedef Array<nstring, const char*> type_base;
58 SArray(const SArray& src);
60 // copy other containers
61 template <typename T_container>
62 SArray(const T_container& t)
64 owned_ = Array_Helpers::Traits<T_container, pointer>::get_owned();
65 size_ = Array_Helpers::Traits<T_container, pointer>::get_size(t);
66 pData_ = Array_Helpers::Traits<T_container, pointer>::get_data(t);
69 SArray(const T_c* pValues, size_type size);
72 template <typename Iterator>
73 SArray(Iterator b, Iterator e);
75 operator std::vector<nstring>() const;
76 operator std::vector<ustring>() const;
77 operator std::vector<std::string>() const;
79 operator std::deque<nstring>() const;
80 operator std::deque<ustring>() const;
81 operator std::deque<std::string>() const;
83 operator std::list<nstring>() const;
84 operator std::list<ustring>() const;
85 operator std::list<std::string>() const;
89 //template <typename T_container>
90 //SArray::SArray(const T_container& t)
96 template <typename Iterator>
97 SArray::SArray(Iterator b, Iterator e)
107 #endif // _GLIBMM_SARRAY_H