aqbanking
5.0.24.0-git
|
00001 /*************************************************************************** 00002 $RCSfile$ 00003 ------------------- 00004 begin : Mon March 2 2011 00005 copyright : (C) 2011 by Christian Stimming 00006 email : christian@cstimming.de 00007 00008 *************************************************************************** 00009 * This file is part of the project "AqBanking". * 00010 * Please see toplevel file COPYING of that project for license details. * 00011 ***************************************************************************/ 00012 00013 00014 #ifndef AB_STRINGLIST_HPP 00015 #define AB_STRINGLIST_HPP 00016 00017 #include <gwenhywfar/stringlist.h> 00018 00019 #include <aqbankingpp/cxxwrap.hpp> 00020 #include <aqbankingpp/aqbankingppdecl.hpp> 00021 #include <string> 00022 #include <vector> 00023 00024 namespace AB 00025 { 00026 00028 class AQBANKINGPP_DECL StringList 00029 { 00030 public: 00031 typedef GWEN_STRINGLIST wrapped_type; 00032 typedef std::size_t size_type; 00033 typedef std::string value_type; 00034 00035 private: 00036 wrapped_type* m_ptr; 00037 public: 00038 00039 AB_CXXWRAP_CONSTRUCTOR0(StringList, GWEN_StringList); 00040 AB_CXXWRAP_CONSTRUCTORS(StringList, GWEN_StringList); 00041 StringList(const std::vector<std::string>& other); 00042 00043 AB_CXXWRAP_SET0(clear, GWEN_StringList_Clear); 00044 size_type AB_CXXWRAP_GET0_CONST(size, GWEN_StringList_Count); 00045 bool empty() const { return size() == 0; } 00046 std::string AB_CXXWRAP_GET0_CONST(front, GWEN_StringList_FirstString); 00047 std::string AB_CXXWRAP_GET1_CONST(at, size_type, GWEN_StringList_StringAt); 00048 std::string operator[](size_type i) const { return at(i); } 00049 void push_back(const std::string& s) 00050 { 00051 GWEN_StringList_AppendString(m_ptr, s.c_str(), false, false); 00052 } 00053 void push_front(const std::string& s) 00054 { 00055 GWEN_StringList_InsertString(m_ptr, s.c_str(), false, false); 00056 } 00057 std::vector<std::string> toVector() const; 00058 00059 }; 00060 00061 } // END namespace AB 00062 00063 #endif // AB_STRINGLIST_HPP