コード例 #1
0
ファイル: local_actor.hpp プロジェクト: Fresh1/libcppa
inline message_id local_actor::get_response_id() {
    auto id = m_current_node->mid;
    return (id.is_request()) ? id.response_id() : message_id();
}
コード例 #2
0
 // returns 0 if last_dequeued() is an asynchronous or sync request message,
 // a response id generated from the request id otherwise
 inline message_id get_response_id() const {
   auto mid = current_element_->mid;
   return (mid.is_request()) ? mid.response_id() : message_id();
 }
コード例 #3
0
ファイル: message_id.hpp プロジェクト: Jenuce/actor-framework
 inline message_id response_id() const {
   return message_id{is_request() ? value_ | response_flag_mask : 0};
 }
コード例 #4
0
ファイル: AbstractMessage.cpp プロジェクト: kaimast/libweb
void AbstractMessage::parse_cookie(const std::string &cookiestr)
{
    //Cookies are parsed differently on server and clientside
    if(is_request())
    {
        std::string first, second;
        bool isFirst = true;

        for(auto it = cookiestr.begin(); it != cookiestr.end(); ++it)
        {
            if(isFirst)
            {
                if((*it) == '=')
                    isFirst = false;
                else
                    first += (*it);
            }
            else
            {
                if((*it) == ';')
                {
                    Cookie cookie;
                    cookie.Name = first;
                    cookie.Value = second;

                    m_cookies.push_back(cookie);
                    first = "";
                    second = "";
                    isFirst = true;

                    // iterate over the space after the semicolon
                    ++it;
                }
                else
                    second += (*it);
            }
        }

        if(!isFirst)
        {
            Cookie cookie;
            cookie.Name = first;
            cookie.Value = second;

            m_cookies.push_back(cookie);
        }
    }
    else
    {
        std::string first, second;
        bool isFirst = true;
        Cookie cookie;

        for (uint32_t u = 0; u < cookiestr.length(); ++u)
        {
            if (cookiestr[u] == '=')
            {
                isFirst = false;
            }
            else if (cookiestr[u]== ';' || (u+1) == cookiestr.length())
            {
                // Sometimes there is a semicolon missing at the end
                if(cookie.Name == "")
                {
                    cookie.Name = first;
                    cookie.Value = second;
                }
                else if(first == "Max-age")
                {
                    std::stringstream sstr;
                    sstr << second;
                    sstr >> cookie.MaxAge;
                }

                first = "";
                second = "";
                isFirst = true;
            }
            // Cut off the uneeded signs
            else if(cookiestr[u] != '"' && cookiestr[u] != ' ')
            {
                if(isFirst)
                    first += cookiestr[u];
                else
                    second += cookiestr[u];
            }
        }