Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00039
00040 #ifndef __SPHINXAPIQUERY_H__
00041 #define __SPHINXAPIQUERY_H__
00042
00043 #include <string>
00044 #include <stdint.h>
00045
00046
00047 namespace Sphinx
00048 {
00049
00050
00051 class Client_t;
00052
00053 struct Query_t
00054 {
00055 unsigned char *data;
00056 unsigned int dataEndPtr;
00057 unsigned int dataStartPtr;
00058 unsigned int dataSize;
00059 bool error;
00060 bool convertEndian;
00061
00062 Query_t(unsigned int size=1024);
00063 ~Query_t();
00064
00065 Query_t &operator << (unsigned short);
00066 Query_t &operator << (uint32_t);
00067 Query_t &operator << (uint64_t);
00068 Query_t &operator << (float);
00069 Query_t &operator << (const std::string &);
00070 Query_t &operator << (const Query_t &);
00071
00072 Query_t &operator >> (uint32_t &);
00073 Query_t &operator >> (uint64_t &);
00074 Query_t &operator >> (float &);
00075 Query_t &operator >> (unsigned short &);
00076 Query_t &operator >> (std::string &);
00077
00078 Query_t &operator = (const Query_t &);
00079 Query_t(const Query_t &source);
00080
00081 bool operator ! () const { return error; }
00082
00083 void doubleSizeBuffer();
00084 void clear();
00085 unsigned int getLength() const { return dataEndPtr-dataStartPtr; }
00086
00095 int readOnReadable(int socket_d, int &bytesToRead, const std::string &stage);
00096
00105 int writeOnWritable(int socket_d, unsigned int &bytesSent, const std::string &stage);
00106
00107 };
00108
00109 }
00110
00111 #endif
00112