aqbanking  5.7.8
stringlist.hpp
Go to the documentation of this file.
1 /***************************************************************************
2  $RCSfile$
3  -------------------
4  begin : Mon March 2 2011
5  copyright : (C) 2011 by Christian Stimming
6  email : christian@cstimming.de
7 
8  ***************************************************************************
9  * This file is part of the project "AqBanking". *
10  * Please see toplevel file COPYING of that project for license details. *
11  ***************************************************************************/
12 
13 
14 #ifndef AB_STRINGLIST_HPP
15 #define AB_STRINGLIST_HPP
16 
17 #include <gwenhywfar/stringlist.h>
18 
19 #include <aqbankingpp/cxxwrap.hpp>
21 #include <string>
22 #include <vector>
23 
24 namespace AB
25 {
26 
29 {
30 public:
31  typedef GWEN_STRINGLIST wrapped_type;
32  typedef std::size_t size_type;
33  typedef std::string value_type;
34 
35 private:
36  wrapped_type* m_ptr;
37 public:
38 
39  AB_CXXWRAP_CONSTRUCTOR0(StringList, GWEN_StringList);
40  AB_CXXWRAP_CONSTRUCTORS(StringList, GWEN_StringList);
41  StringList(const std::vector<std::string>& other);
42 
43  AB_CXXWRAP_SET0(clear, GWEN_StringList_Clear);
44  size_type AB_CXXWRAP_GET0_CONST(size, GWEN_StringList_Count);
45  bool empty() const { return size() == 0; }
46  std::string AB_CXXWRAP_GET0_CONST(front, GWEN_StringList_FirstString);
47  std::string AB_CXXWRAP_GET1_CONST(at, size_type, GWEN_StringList_StringAt);
48  std::string operator[](size_type i) const { return at(i); }
49  void push_back(const std::string& s)
50  {
51  GWEN_StringList_AppendString(m_ptr, s.c_str(), false, false);
52  }
53  void push_front(const std::string& s)
54  {
55  GWEN_StringList_InsertString(m_ptr, s.c_str(), false, false);
56  }
57  std::vector<std::string> toVector() const;
58 
59 };
60 
61 } // END namespace AB
62 
63 #endif // AB_STRINGLIST_HPP
#define AQBANKINGPP_DECL
bool empty() const
Definition: stringlist.hpp:45
#define AB_CXXWRAP_GET1_CONST(cxxname, type1, cname)
Definition: cxxwrap.hpp:42
void push_back(const std::string &s)
Definition: stringlist.hpp:49
#define AB_CXXWRAP_SET0(cxxname, cname)
Definition: cxxwrap.hpp:52
GWEN_STRINGLIST wrapped_type
Definition: stringlist.hpp:31
std::string operator[](size_type i) const
Definition: stringlist.hpp:48
#define AB_CXXWRAP_CONSTRUCTORS(cxxname, cprefix)
Definition: cxxwrap.hpp:75
std::string value_type
Definition: stringlist.hpp:33
#define AB_CXXWRAP_CONSTRUCTOR0(cxxname, cprefix)
Definition: cxxwrap.hpp:65
void push_front(const std::string &s)
Definition: stringlist.hpp:53
#define AB_CXXWRAP_GET0_CONST(cxxname, cname)
Definition: cxxwrap.hpp:32
std::size_t size_type
Definition: stringlist.hpp:32