X-Git-Url: https://git.ladys.computer/CGirls/blobdiff_plain/f6f2fd79a596ecedaadd8b605b7de9d8c662151c..f5006884a1f4f37bc3c27ab1f3b882d2b36cd052:/request.h diff --git a/request.h b/request.h index 2ab70e0..e1606dc 100644 --- a/request.h +++ b/request.h @@ -4,37 +4,56 @@ #ifndef CGIRLS_REQUEST_H #define CGIRLS_REQUEST_H -enum cgirls_mediatype : unsigned char { - // Unspecified media type - cgirls_mediatype_any = 0x00, - // Text media types - cgirls_mediatype_txt = 0x10, - cgirls_mediatype_htm = 0x11, - // X·M·L media types - cgirls_mediatype_xml = 0x20, - cgirls_mediatype_rdf = 0x21, +/* +The following constant expressions provide recognized media type +extensions. +*/ +constexpr char* cgirls_mtype_any = nullptr; +constexpr char cgirls_mtype_txt[] = ".txt"; +constexpr char cgirls_mtype_htm[] = ".htm"; +constexpr char cgirls_mtype_xml[] = ".xml"; +constexpr char cgirls_mtype_rdf[] = ".rdf"; +typedef char const* cgirls_mtype; +constexpr size_t cgirls_n·mtypes = 4; +static cgirls_mtype const cgirls_mtypes[cgirls_n·mtypes] = { + cgirls_mtype_txt, + cgirls_mtype_htm, + cgirls_mtype_xml, + cgirls_mtype_rdf, }; -typedef enum cgirls_mediatype cgirls_mediatype; -enum cgirls_vb : unsigned char { - // Actions in general - cgirls_vb_index = 0x00, - // Actions on projects - cgirls_vb_branches = 0x10, - cgirls_vb_tags = 0x11, - // Actions on single objects - cgirls_vb_show = 0x20, - cgirls_vb_raw = 0x21, - cgirls_vb_blame = 0x22, - // Actions on ranges of objects - cgirls_vb_log = 0x30, - cgirls_vb_shortlog = 0x31, - cgirls_vb_atom = 0x32, - cgirls_vb_patch = 0x33, - // Unknown verb - cgirls_vb_unknown = 0xFF, +/* +The following constant expressions provide recognized action verbs. +*/ +// Actions in general: +constexpr char cgirls_vb_index[] = "index"; +constexpr char cgirls_vb_unknown[] = "unknown"; +// Actions on projects: +// constexpr char cgirls_vb_branches[] = "branches"; +// constexpr char cgirls_vb_tags[] = "tags"; +// Actions on single objects: +constexpr char cgirls_vb_show[] = "show"; +// constexpr char cgirls_vb_raw[] = "raw"; +// constexpr char cgirls_vb_blame[] = "blame"; +// Actions on ranges of commits: +// constexpr char cgirls_vb_diff[] = "diff"; +// Actions on lists of commits: +// constexpr char cgirls_vb_log[] = "log"; +// constexpr char cgirls_vb_shortlog[] = "shortlog"; +// constexpr char cgirls_vb_atom[] = "atom"; +// constexpr char cgirls_vb_patch[] = "patch"; +typedef char const* cgirls_vb; +constexpr size_t cgirls_n·vbs = 3; +static cgirls_vb const cgirls_vbs[cgirls_n·vbs] = { + cgirls_vb_index, + cgirls_vb_unknown, + cgirls_vb_show, +}; +constexpr size_t cgirls_n·parsable·vbs = 2; +static cgirls_vb const cgirls_parsable·vbs[cgirls_n·parsable·vbs] = { + cgirls_vb_index, + cgirls_vb_show, }; -typedef enum cgirls_vb cgirls_vb; typedef struct cgirls_req_status cgirls_req_status; struct cgirls_req_status { @@ -45,7 +64,7 @@ struct cgirls_req_status { typedef struct cgirls_req cgirls_req; struct cgirls_req { cgirls_vb cgirls_action; - cgirls_mediatype cgirls_type; + cgirls_mtype cgirls_type; char* cgirls_project; char* cgirls_id; char** cgirls_subpath;