// overloads, specializations & instantiations for pEp-sepcific data types. #ifndef PEP_TYPES_HH #define PEP_TYPES_HH #include "function_map.hh" #include #include // just a tag type: struct Language{}; template<> struct In { typedef const char* c_type; // the according type in C function parameter enum { is_output = false, need_input = true }; ~In() = default; In(const In& other) = delete; In(In&& victim) = delete; void operator=(const In&) = delete; // default implementation: In(const js::Value& v, Context*, unsigned) { const std::string vs = v.get_str(); if(vs.size() != 2) { throw std::runtime_error("Language must be a string of length 2, but I got \"" + vs + "\"."); } array_value[0]=vs[0]; array_value[1]=vs[1]; array_value[2]='\0'; } js::Value to_json() const { return js::Value( std::string(get_value(), get_value()+2) ); } c_type get_value() const { return array_value; } char array_value[3]; }; struct In_Pep_Session : public InBase { typedef InBase Base; // fetch PEP_SESSION from Context, instead of returning default value (which would be: nullptr) In_Pep_Session(const js::Value&, Context*, unsigned); }; #endif // PEP_TYPES_HH