22 #include "pqxx/compiler-public.hxx"
23 #include "pqxx/compiler-internal-pre.hxx"
25 #include "pqxx/strconv"
76 bool operator==(
const field &)
const;
81 bool operator!=(
const field &rhs)
const
82 {
return !operator==(rhs);}
90 const char *name()
const;
114 const char *c_str()
const;
117 template<
typename T>
bool to(T &Obj)
const
119 const char *
const bytes = c_str();
120 if (!bytes[0] && is_null())
return false;
126 template<
typename T>
bool operator>>(T &Obj)
const
129 #ifdef PQXX_NO_PARTIAL_CLASS_TEMPLATE_SPECIALISATION
131 template<>
bool to<PGSTD::string>(PGSTD::string &Obj)
const;
137 template<>
bool to<const char *>(
const char *&Obj)
const;
141 template<
typename T>
bool to(T &Obj,
const T &Default)
const
143 const bool NotNull = to(Obj);
144 if (!NotNull) Obj = Default;
152 template<
typename T> T as(
const T &Default)
const
160 template<
typename T> T as() const
163 const bool NotNull = to(Obj);
168 bool is_null()
const throw ();
169 size_type size() const throw ();
174 const
result *home() const throw () {
return m_home; }
175 size_t idx()
const throw () {
return m_row; }
188 inline bool field::to<PGSTD::string>(PGSTD::string &Obj)
const
190 const char *
const bytes = c_str();
191 if (!bytes[0] && is_null())
return false;
192 Obj = PGSTD::string(bytes, size());
203 inline bool field::to<const char *>(
const char *&Obj)
const
205 if (is_null())
return false;
211 template<
typename CHAR=
char,
typename TRAITS=PGSTD::
char_traits<CHAR> >
213 #ifdef PQXX_HAVE_STREAMBUF
214 public PGSTD::basic_streambuf<CHAR, TRAITS>
216 public PGSTD::streambuf
223 #ifdef PQXX_HAVE_STREAMBUF
224 typedef typename traits_type::pos_type
pos_type;
225 typedef typename traits_type::off_type
off_type;
239 #ifdef PQXX_HAVE_STREAMBUF
242 virtual int sync() {
return traits_type::eof(); }
246 {
return traits_type::eof(); }
252 const field &m_Field;
257 reinterpret_cast<char_type *
>(
const_cast<char *
>(m_Field.
c_str()));
258 this->setg(G, G, G + m_Field.
size());
273 template<
typename CHAR=
char,
typename TRAITS=PGSTD::
char_traits<CHAR> >
275 #ifdef PQXX_HAVE_STREAMBUF
276 public PGSTD::basic_istream<CHAR, TRAITS>
278 public PGSTD::istream
281 #ifdef PQXX_HAVE_STREAMBUF
282 typedef PGSTD::basic_istream<CHAR, TRAITS> super;
284 typedef PGSTD::istream super;
295 { super::init(&m_Buf); }
306 #include "pqxx/compiler-internal-post.hxx"