diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/BString.h | 5 | ||||
-rw-r--r-- | include/ConfigFile.h | 27 | ||||
-rw-r--r-- | include/Makefile.am | 2 | ||||
-rw-r--r-- | include/SQL.h | 17 |
4 files changed, 46 insertions, 5 deletions
diff --git a/include/BString.h b/include/BString.h index b5a273f..4540e70 100644 --- a/include/BString.h +++ b/include/BString.h @@ -47,6 +47,9 @@ class String : public Base { ssize_t strrchr(char) const; ssize_t strstr(const String &) const; int strchrcnt(char) const; + String ltrim() const; + String rtrim() const; + String trim() const; String & operator=(const String &); String operator+(const String &) const; String & operator+=(const String &); @@ -73,6 +76,4 @@ std::istream & operator>>(std::istream &, String &); String operator+(const char *, const String &); -bool compare(String, String); - #endif diff --git a/include/ConfigFile.h b/include/ConfigFile.h new file mode 100644 index 0000000..8a7c34d --- /dev/null +++ b/include/ConfigFile.h @@ -0,0 +1,27 @@ +#ifndef __CONFIGFILE_H__ +#define __CONFIGFILE_H__ + +#include <Exceptions.h> +#include <Handle.h> +#include <map> + +namespace BConfigFile { + struct ltstr { + bool operator()(String s1, String s2) const { + return s1 < s2; + } + }; +}; + +typedef std::map<String, String, BConfigFile::ltstr> ConfigSectionContents; +typedef std::map<String, ConfigSectionContents, BConfigFile::ltstr> ConfigSection; + +class ConfigFile : public Base { + public: + ConfigFile(Handle *) throw (GeneralException); + ConfigSectionContents & operator[](String); + private: + ConfigSection c; +}; + +#endif diff --git a/include/Makefile.am b/include/Makefile.am index a84dd81..3fc5f29 100644 --- a/include/Makefile.am +++ b/include/Makefile.am @@ -2,6 +2,6 @@ pkginclude_HEADERS = \ Exceptions.h Handle.h BString.h Output.h Socket.h HttpServ.h Variables.h Menu.h \ Action.h Message.h Form.h Confirm.h Table.h IRC.h Task.h Buffer.h generic.h \ CopyJob.h ReadJob.h Regex.h TaskMan.h InPipe.h OutPipe.h Input.h Image.h \ -Main.h Color.h GMPString.h SQL.h +Main.h Color.h GMPString.h SQL.h ConfigFile.h noinst_HEADERS = gettext.h diff --git a/include/SQL.h b/include/SQL.h index ee28eb0..846afe2 100644 --- a/include/SQL.h +++ b/include/SQL.h @@ -1,20 +1,33 @@ #ifndef __SQL_H__ #define __SQL_H__ -#include <set> +#include <map> #include <mysql.h> #include <Exceptions.h> -//typedef AssocArray std::set<String, compare>; +namespace BMySQL { + struct ltstr { + bool operator()(String s1, String s2) const { + return s1 < s2; + } + }; +}; + +typedef std::map<String, String, BMySQL::ltstr> AssocArray; class SQLConnection : public Base { public: SQLConnection(String host, String user, String passwd, String db, int port = 3306, String socket = "", unsigned long clags = 0) throw (GeneralException); ~SQLConnection(); void query(String) throw (GeneralException); + int numrows(); + int numfields(); + AssocArray fetchrow(); private: MYSQL con; MYSQL_RES * res; + int nr, nf; + MYSQL_FIELD * fields; }; #endif |