29 #ifndef MYSQLPP_MYSET_H
30 #define MYSQLPP_MYSET_H
42 #if !defined(DOXYGEN_IGNORE)
45 template <
class T,
class key_type =
typename T::key_type>
46 class MYSQLPP_EXPORT SetInsert
49 SetInsert(T* o) : object_(o) { }
50 void operator ()(
const key_type& data) { object_->insert(data); }
57 inline SetInsert< std::set<T> > set_insert(std::set<T>* o)
59 return SetInsert< std::set<T> >(o);
62 template <
class Insert>
63 void set2container(
const char* str, Insert insert);
65 #endif // !defined(DOXYGEN_IGNORE)
70 template <
class Container = std::set<std::
string> >
71 class MYSQLPP_EXPORT
Set :
public Container
80 set2container(str, set_insert(
this));
84 Set(
const std::string& str)
86 set2container(str.c_str(), set_insert(
this));
92 set2container(str.
c_str(), set_insert(
this));
97 operator std::string()
const {
return stream2string(*
this); }
100 std::string
str()
const {
return *
this; }
105 template <
class Container>
106 inline std::ostream& operator <<(std::ostream& s,
107 const Set<Container>& d)
109 typename Container::const_iterator i = d.begin();
110 typename Container::const_iterator e = d.end();
126 #if !defined(DOXYGEN_IGNORE)
129 template <
class Insert>
130 void set2container(
const char* str, Insert insert)
135 while (str && *str) {
156 #endif // !defined(DOXYGEN_IGNORE)
A special std::set derivative for holding MySQL data sets.
Definition: myset.h:71
std::string str() const
Return our value in std::string form.
Definition: myset.h:100
const char * c_str() const
Return a const pointer to the string data.
Definition: mystring.h:288
Set(const char *str)
Create object from a comma-separated list of values.
Definition: myset.h:78
Set()
Default constructor.
Definition: myset.h:75
Set(const String &str)
Create object from a comma-separated list of values.
Definition: myset.h:90
Set(const std::string &str)
Create object from a comma-separated list of values.
Definition: myset.h:84
Declares an adapter that converts something that can be inserted into a C++ stream into a std::string...
This file includes top-level definitions for use both internal to the library, and outside it...
A std::string work-alike that can convert itself from SQL text data formats to C++ data types...
Definition: mystring.h:139
Declares String class, MySQL++'s generic std::string-like class, used for holding data received from ...