# Reference

### Header <zeep/config.hpp>

Generic configuration file, contains defines and (probably obsolete) stuff for msvc

    HTTP_SERVER_HAS_PREFORK
    WEBAPP_USES_RESOURCES
    LIBZEEP_VERSION
    LIBZEEP_VERSION_MAJOR
    LIBZEEP_VERSION_MINOR
    LIBZEEP_VERSION_PATCH

### Header <zeep/crypto.hpp>

This file contains an interface to the crypto related routines used throughout libzeep.

    namespace zeep {
      class invalid_base64;
      class invalid_base32;
      class invalid_hex;
      std::string encode_base64(std::string_view, size_t = 0);
      std::string decode_base64(std::string_view);
      std::string encode_base64url(std::string_view);
      std::string decode_base64url(std::string);
      std::string encode_base32(std::string_view, size_t = 0);
      std::string decode_base32(std::string_view);
      std::string encode_hex(std::string_view);
      std::string decode_hex(std::string_view);

      // return a string containing some random bytes
      std::string random_hash();

      // return the MD5 hash of data
      std::string md5(std::string_view data);

      // return the SHA1 hash of data
      std::string sha1(std::string_view data);

      // return the SHA1 hash of data
      std::string sha1(std::streambuf & data);

      // return the SHA256 hash of data
      std::string sha256(std::string_view data);

      // return the HMAC using an MD5 hash of message signed with key
      std::string hmac_md5(std::string_view message, std::string_view key);

      // return the HMAC using an SHA1 hash of message signed with key
      std::string hmac_sha1(std::string_view message, std::string_view key);

      // return the HMAC using an SHA256 hash of message signed with key
      std::string hmac_sha256(std::string_view message, std::string_view key);
      std::string pbkdf2_hmac_sha1(std::string_view, std::string_view, unsigned,
                                   unsigned);
      std::string pbkdf2_hmac_sha256(std::string_view, std::string_view, unsigned,
                                     unsigned);
    }

### Header <zeep/exception.hpp>

definition of zeep::exception, base class for exceptions thrown by libzeep

    namespace zeep {
      class exception;
    }

### Header <zeep/http/connection.hpp>

definition of the zeep::http::connection class, that handles HTTP connections

    namespace zeep {
      namespace http {
        class connection;
      }
    }

### Header <zeep/http/controller.hpp>

definition of the base class zeep::http::controller, used by e.g. rest_controller and soap_controller

    namespace zeep {
      namespace http {
        class controller;
      }
    }

### Header <zeep/http/daemon.hpp>

Source code specifically for Unix/Linux. Utility routines to build daemon processes

    namespace zeep {
      namespace http {
        class daemon;
      }
    }

### Header <zeep/http/el-processing.hpp>

definition of the routines that can parse and interpret el (expression language) code in a web application context

    namespace zeep {
      namespace http {
        class expression_utility_object_base;
        template<typename OBJ> class expression_utility_object;
        class scope;

        typedef ::zeep::json::element object;
        bool process_el(const scope &, std::string &);
        std::string process_el_2(const scope &, const std::string &);
        object evaluate_el(const scope &, const std::string &);
        std::vector< std::pair< std::string, std::string > >
        evaluate_el_attr(const scope &, const std::string &);
        bool evaluate_el_assert(const scope &, const std::string &);
        void evaluate_el_with(scope &, const std::string &);
        object evaluate_el_link(const scope &, const std::string &);
      }
    }

### Header <zeep/http/error-handler.hpp>

definition of the base class zeep::error_handler, the default creates very simple HTTP replies. Override to do something more fancy.

    namespace zeep {
      namespace http {
        class error_handler;
      }
    }

### Header <zeep/http/header.hpp>

definition of the zeep::http::header class

    namespace zeep {
      namespace http {
        struct header;
      }
    }

### Header <zeep/http/html-controller.hpp>

definition of the zeep::controller class. This class takes care of handling requests that are mapped to call back functions and provides code to return XHTML formatted replies.

    namespace zeep {
      namespace http {
        class html_controller;
      }
    }

### Header <zeep/http/login-controller.hpp>

definition of the zeep::login_controller class. This class inherits from html::controller and provides a default for /login and /logout handling.

    namespace zeep {
      namespace http {
        class login_controller;
      }
    }

### Header <zeep/http/message-parser.hpp>

definition of the zeep::http::{request,reply}_parser classes that parse HTTP input/output

    namespace zeep {
      namespace http {
        class parser;
        class request_parser;
        class reply_parser;
      }
    }

### Header <zeep/http/preforked-server.hpp>

Code for a preforked http server implementation

    namespace zeep {
      namespace http {
        class preforked_server;
      }
    }

### Header <zeep/http/reply.hpp>

definition of the zeep::http::reply class encapsulating a valid HTTP reply

    namespace zeep {
      namespace http {
        class reply;

        // Various predefined HTTP status codes.
        enum status_type { cont = =                  100,
                           ok = =                    200,
                           created = =               201,
                           accepted = =              202,
                           no_content = =            204,
                           multiple_choices = =      300,
                           moved_permanently = =     301,
                           moved_temporarily = =     302,
                           see_other = =             303,
                           not_modified = =          304,
                           bad_request = =           400,
                           unauthorized = =          401,
                           forbidden = =             403,
                           not_found = =             404,
                           method_not_allowed = =	405,
                           proxy_authentication_required = =	407,
                           internal_server_error = = 500,
                           not_implemented = =       501,
                           bad_gateway = =           502,
                           service_unavailable = =   503 };

        // Return the error string for the status_type.
        std::string get_status_text(status_type status);

        // Return the string describing the status_type in more detail.
        std::string get_status_description(status_type status);
      }
    }

### Header <zeep/http/request.hpp>

definition of the zeep::http::request class encapsulating a valid HTTP request

    namespace zeep {
      namespace http {
        struct file_param;
        template<typename T, typename  = void> struct is_file_param_array_type;

        template<typename T>
          struct is_file_param_array_type<T, std::enable_if_t< std::experimental::is_detected_v< value_type_t, T > and std::experimental::is_detected_v< iterator_t, T > and not std::experimental::is_detected_v< std_string_npos_t, T > >>;

        class request;

        constexpr bool is_file_param_array_type_v;
      }
    }

### Header <zeep/http/rest-controller.hpp>

definition of the zeep::rest_controller class. Instances of this class take care of mapping member functions to REST calls automatically converting in- and output data

    namespace zeep {
      namespace http {
        class rest_controller;
      }
    }

### Header <zeep/http/security.hpp>

definition of various classes that help in handling HTTP authentication.

    namespace zeep {
      namespace http {
        struct unauthorized_exception;

        class password_encoder;
        class pbkdf2_sha256_password_encoder;

        struct user_details;

        class user_unknown_exception;
        class invalid_password_exception;
        class user_service;
        class simple_user_service;
        class security_context;
      }
    }

### Header <zeep/http/server.hpp>

definition of the zeep::http::server class

    namespace zeep {
      namespace http {
        class basic_server;
        class server;
      }
    }

### Header <zeep/http/soap-controller.hpp>

definition of the zeep::soap_controller class. Instances of this class take care of mapping member functions to SOAP calls automatically converting in- and output data

    namespace zeep {
      namespace http {
        class soap_envelope;
        class soap_controller;
        xml::element make_envelope(xml::element &&);
        xml::element make_fault(const std::string &);
        xml::element make_fault(const std::exception &);
      }
    }

### Header <zeep/http/tag-processor.hpp>

definition of the zeep::http::tag_processor classes. These classes take care of processing HTML templates

    namespace zeep {
      namespace http {
        class tag_processor;
        class tag_processor_v1;
        class tag_processor_v2;
      }
    }

### Header <zeep/http/template-processor.hpp>

definition of the zeep::template_processor class. This class handles the loading and processing of XHTML files.

    namespace zeep {
      namespace http {
        class resource_loader;
        class file_loader;
        class rsrc_loader;
        class basic_template_processor;
        template<typename Loader> class html_template_processor;

        typedef html_template_processor< file_loader > file_based_html_template_processor;
        typedef html_template_processor< rsrc_loader > rsrc_based_html_template_processor;
        typedef file_based_html_template_processor template_processor;  // the actual definition of zeep::template_processor
      }
    }

### Header <zeep/http/uri.hpp>

A simple uri class. Uses a parser based on simple regular expressions

    namespace zeep {
      namespace http {
        class uri_parse_error;
        class uri;
        bool is_valid_uri(const std::string &);
        std::string decode_url(std::string_view);
        std::string encode_url(std::string_view);
      }
    }

### Header <zeep/json/element.hpp>

Code for zeep::json::element, the JSON object in libzeep

    namespace zeep {
      namespace json {
        class element;
        template<> std::string element::as<std::string >();
      }
    }

### Header <zeep/json/element_fwd.hpp>

forward declarations required for zeep::json::element, the JSON object in libzeep

### Header <zeep/json/factory.hpp>

factory classes for constructing zeep::json::element objects

### Header <zeep/json/from_element.hpp>

various implementations of the from_element function that return the data contained in a zeep::json::element (JSON) object

### Header <zeep/json/iterator.hpp>

generic iterator classes used by zeep::json::element

    namespace zeep {
      namespace json {
      }
    }namespace std {
      template<typename IteratorType>
        struct tuple_size<::zeep::json::detail::iteration_proxy_value< IteratorType >>;
      template<typename IteratorType>
        struct tuple_element<0, ::zeep::json::detail::iteration_proxy_value< IteratorType >>;
      template<typename IteratorType>
        struct tuple_element<1, ::zeep::json::detail::iteration_proxy_value< IteratorType >>;
    }

### Header <zeep/json/serializer.hpp>

definition of the serializer classes that help serialize data into and out of zeep::json::element (JSON) objects

    namespace zeep {
      namespace json {
        template<typename E> struct serializer;
        template<typename E> struct deserializer;
        template<typename , typename  = void> struct element_serializer;
        template<typename J, typename T> void to_element(J & e, T & v);
        template<typename J, typename T> void from_element(const J & e, T & v);
      }
    }

### Header <zeep/json/to_element.hpp>

various implementations of the to_element function that intializes a zeep::json::element object with some value

### Header <zeep/json/type_traits.hpp>

various templated classes that help selecting the right conversion routines when (de-)serializing zeep::json::element (JSON) objects

### Header <zeep/nvp.hpp>

File containing the name_value_pair class.

    ZEEP_SERIALIZATION_NVP(name)

    namespace zeep {
      template<typename T> class name_value_pair;
      template<typename T> name_value_pair< T > make_nvp(const char * name, T & v);
    }

### Header <zeep/streambuf.hpp>

A simple std::streambuf implementation that wraps around const char* data.

    namespace zeep {
      class char_streambuf;
    }

### Header <zeep/type-traits.hpp>

definition of various classes that help classify data used to select the correct conversion routines

    namespace zeep {
      template<typename T, typename  = void> struct is_complete_type;

      template<typename T> struct is_complete_type<T, decltype(void(sizeof(T)))>;

      template<typename T, typename Archive, typename  = void>
        struct has_serialize;

      template<typename T, typename Archive>
        struct has_serialize<T, Archive, typename std::enable_if_t< std::is_class_v< T > >>;

      template<typename T, typename S> struct is_serializable_type;
      template<typename T, typename S, typename  = void>
        struct is_serializable_array_type;

      template<typename T, typename S>
        struct is_serializable_array_type<T, S, std::enable_if_t< std::experimental::is_detected_v< value_type_t, T > and std::experimental::is_detected_v< iterator_t, T > and not std::experimental::is_detected_v< std_string_npos_t, T > >>;

      typedef typename T::value_type value_type_t;
      typedef typename T::key_type key_type_t;
      typedef typename T::mapped_type mapped_type_t;
      typedef typename T::iterator iterator_t;
      typedef typename T::iterator_category iterator_category_t;
      typedef typename T::difference_type difference_type_t;
      typedef typename T::reference reference_t;
      typedef typename T::pointer pointer_t;
      typedef decltype(T::npos) std_string_npos_t;
      typedef decltype(std::declval< value_serializer< T > & >().from_string(std::declval< const std::string & >())) serialize_value_t;
      typedef decltype(std::declval< T & >().serialize(std::declval< Archive & >(), std::declval< unsigned long >())) serialize_function;

      constexpr bool is_complete_type_v;
      constexpr bool has_serialize_v;
      constexpr bool is_serializable_type_v;
      constexpr bool is_type_with_value_serializer_v;
      constexpr bool is_serializable_array_type_v;
    }

### Header <zeep/unicode-support.hpp>

various definitions of data types and routines used to work with Unicode encoded text

    namespace zeep {
      enum encoding_type;
      typedef char32_t unicode;

      // utf-8 is not single byte e.g.
      constexpr bool is_single_byte_encoding(encoding_type enc);

      // Convert a string from UCS4 to UTF-8.
      std::string wstring_to_string(const std::wstring & s);
      void append(std::string &, unicode);

      // remove the last unicode character from an utf-8 string
      unicode pop_last_char(std::string & s);

      // return the first unicode and the advanced pointer from a string
      template<typename Iter>
        std::tuple< unicode, Iter > get_first_char(Iter ptr, Iter end);
      bool iequals(const std::string &, const std::string &);
      std::string to_hex(uint32_t i);

      // A simple implementation of trim, removing white space from start and end of s.
      void trim(std::string & s);

      // Simplistic implementation of starts_with.
      bool starts_with(std::string_view s, std::string_view p);

      // Simplistic implementation of ends_with.
      bool ends_with(std::string_view s, std::string_view p);

      // Simplistic implementation of contains.
      bool contains(std::string_view s, std::string_view p);

      // Simplistic implementation of split, with std:string in the vector.
      void split(std::vector< std::string > & v, std::string_view s,
                 std::string_view p, bool compress = false);

      // Simplistic to_lower function, works for one byte charsets only...
      void to_lower(std::string & s, const std::locale & loc = std::locale());

      // Simplistic join function.
      template<typename Container = std::vector<std::string> >
        std::string join(const Container & v, std::string_view d);

      // Simplistic replace_all.
      void replace_all(std::string & s, std::string_view p, std::string_view r);
    }

### Header <zeep/value-serializer.hpp>

File containing the common serialization code in libzeep.

Serialization in libzeep is used by both the XML and the JSON sub libraries. Code that is common is found here.

    namespace zeep {
      template<typename T, typename  = void> struct value_serializer;

      template<> struct value_serializer<bool>;
      template<> struct value_serializer<std::string>;
      template<> struct value_serializer<int8_t>;
      template<> struct value_serializer<uint8_t>;
      template<> struct value_serializer<int16_t>;
      template<> struct value_serializer<uint16_t>;
      template<> struct value_serializer<int32_t>;
      template<> struct value_serializer<uint32_t>;
      template<> struct value_serializer<int64_t>;
      template<> struct value_serializer<uint64_t>;
      template<> struct value_serializer<float>;
      template<> struct value_serializer<double>;
      template<typename T>
        struct value_serializer<T, std::enable_if_t< std::is_enum_v< T > >>;
      template<> struct value_serializer<boost::posix_time::ptime>;
      template<> struct value_serializer<boost::gregorian::date>;
      template<> struct value_serializer<boost::posix_time::time_duration>;
    }

### Header <zeep/xml/character-classification.hpp>

routines for classifying characters in an XML context

    namespace zeep {
      namespace xml {

        // some character classification routines
        bool is_name_start_char(unicode uc);
        bool is_name_char(unicode uc);
        bool is_valid_xml_1_0_char(unicode uc);
        bool is_valid_xml_1_1_char(unicode uc);
        bool is_valid_system_literal_char(unicode uc);
        bool is_valid_system_literal(const std::string & s);
        bool is_valid_public_id_char(unicode uc);
        bool is_valid_public_id(const std::string & s);
      }
    }

### Header <zeep/xml/doctype.hpp>

various classes and definitions for handling and using XML DOCTYPE definitions

    namespace zeep {
      namespace xml {
        namespace doctype {
          class validator;

          struct content_spec_base;
          struct content_spec_any;
          struct content_spec_empty;
          struct content_spec_element;
          struct content_spec_repeated;
          struct content_spec_seq;
          struct content_spec_choice;

          class attribute_;
          class element_;
          class entity;
          class general_entity;
          class parameter_entity;

          enum ContentSpecType { Empty, Any, Mixed, Children };

          enum AttributeType { CDATA, ID, IDREF, IDREFS, ENTITY, ENTITIES,
                               NMTOKEN, NMTOKENS, Notation, Enumerated };

          enum AttributeDefault { None, Required, Implied, Fixed, Default };

          typedef std::vector< entity * > entity_list;
          typedef std::vector< element_ * > element_list;
          typedef std::vector< attribute_ * > attribute_list;
          typedef content_spec_base * content_spec_ptr;
          typedef std::list< content_spec_ptr > content_spec_list;
          typedef state_base * state_ptr;
        }
      }
    }

### Header <zeep/xml/document.hpp>

definition of the zeep::xml::document class

    namespace zeep {
      namespace xml {
        struct doc_type;

        class document;
        namespace literals {
          document operator""_xml(const char * text, size_t length);
        }
      }
    }

### Header <zeep/xml/node.hpp>

the core of the libzeep XML library defining the main classes in the DOM API

    namespace zeep {
      namespace xml {
        template<typename NodeType> class basic_node_list;

        struct format_info;

        class node;
        class node_with_text;
        class comment;
        class processing_instruction;
        class text;
        class cdata;
        class attribute;
        template<typename NodeType,
                 typename ContainerNodeType = std::remove_const_t<NodeType> >
          class iterator_impl;
        class node_list;
        class attribute_set;
        class element;

        typedef std::list< node * > node_set;
        typedef std::list< element * > element_set;
        void fix_namespaces(element &, element &, element &);
      }
    }namespace std {
      template<> struct tuple_size<::zeep::xml::attribute>;
      template<> struct tuple_element<0, ::zeep::xml::attribute>;
      template<> struct tuple_element<1, ::zeep::xml::attribute>;
    }

### Header <zeep/xml/parser.hpp>

definition of the libzeep XML parser, a recursive descent parser

    namespace zeep {
      namespace xml {
        class invalid_exception;
        class not_wf_exception;
        class parser;
      }
    }

### Header <zeep/json/parser.hpp>

The definition of the JSON parser in libzeep

    namespace zeep {
      namespace json {
        void parse_json(const std::string & json, json::element & object);
        void parse_json(std::istream & is, json::element & object);
        namespace literals {
          zeep::json::element operator""_json(const char * s, size_t len);
        }
      }
    }

### Header <zeep/xml/serialize.hpp>

definition of the serializer classes used to (de-)serialize XML data.

    ZEEP_ELEMENT_NAME_VALUE(name)
    ZEEP_ATTRIBUTE_NAME_VALUE(name)

    namespace zeep {
      namespace xml {
        template<typename T> struct element_nvp;
        template<typename T> struct attribute_nvp;
        struct serializer;
        struct deserializer;
        struct schema_creator;
        template<typename T, typename  = void> struct type_serializer;

        template<typename T, size_t N> struct type_serializer<T[N]>;
        template<typename T>
          struct type_serializer<T, std::enable_if_t< std::is_enum_v< T > >>;
        template<typename T>
          struct type_serializer<T, std::enable_if_t< has_serialize_v< T, serializer > >>;
        template<typename T> struct type_serializer<std::optional< T >>;

        template<unsigned N> struct priority_tag;

        template<> struct priority_tag<0>;
        template<typename T>
          struct type_serializer<T, std::enable_if_t< is_serializable_array_type_v< T, serializer > >>;

        typedef std::map< std::string, element > type_map;
        template<typename T>
          element_nvp< T > make_element_nvp(const char * name, T & v);
        template<typename T>
          attribute_nvp< T > make_attribute_nvp(const char * name, T & v);
      }
    }

### Header <zeep/xml/xpath.hpp>

definition of the zeep::xml::xpath class, implementing a XPath 1.0 compatible search facility

    namespace zeep {
      namespace xml {
        class context;
        class xpath;
      }
    }

Last revised: 2022-02-03 07:27:42 |