X-Git-Url: https://git.sesse.net/?p=cubemap;a=blobdiff_plain;f=parse.h;h=6912dd9a5c314ca41494aed2a6be41ba5094ab44;hp=5d56bd14d38b33575a1d3f32f0751bd4cb1a6248;hb=3fdf2e48bca3edcb0de00e0dbd0d0aae81ba9aa9;hpb=c2c9f6441f9ae8091a39aea0340417d5915e1ac9 diff --git a/parse.h b/parse.h index 5d56bd1..6912dd9 100644 --- a/parse.h +++ b/parse.h @@ -1,30 +1,17 @@ #ifndef _PARSE_H #define _PARSE_H -// Various routines that deal with parsing; both configuration files and HTTP requests. +// Various routines that deal with parsing; both HTTP requests and more generic text. -#include #include #include -struct ConfigLine { - std::string keyword; - std::vector arguments; - std::map parameters; -}; - // Split a line on whitespace, e.g. "foo bar baz" -> {"foo", "bar", "baz"}. std::vector split_tokens(const std::string &line); // Split a string on \n or \r\n, e.g. "foo\nbar\r\n\nbaz\r\n\r\n" -> {"foo", "bar", "baz"}. std::vector split_lines(const std::string &str); -// Parse the configuration file. -std::vector parse_config(const std::string &filename); - -// Note: Limits are inclusive. -int fetch_config_int(const std::vector &config, const std::string &keyword, int min_limit, int max_limit); - // Add the new data to an existing string, looking for \r\n\r\n // (typical of HTTP requests and/or responses). Will return one // of the given statuses.