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);
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));
100 std::string
str()
const {
return *
this; }
105 template <
class Container>
106 inline std::ostream& operator <<(std::ostream& s,
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) {
A special std::set derivative for holding MySQL data sets.
Definition: myset.h:72
Set(const std::string &str)
Create object from a comma-separated list of values.
Definition: myset.h:84
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 char *str)
Create object from a comma-separated list of values.
Definition: myset.h:78
std::string str() const
Return our value in std::string form.
Definition: myset.h:100
A std::string work-alike that can convert itself from SQL text data formats to C++ data types.
Definition: mystring.h:140
const char * c_str() const
Return a const pointer to the string data.
Definition: mystring.h:288
This file includes top-level definitions for use both internal to the library, and outside it....
Declares String class, MySQL++'s generic std::string-like class, used for holding data received from ...
Declares an adapter that converts something that can be inserted into a C++ stream into a std::string...
std::string stream2string(const T &object)
Converts anything you can insert into a C++ stream to a std::string via std::ostringstream.
Definition: stream2string.h:41