Beispiel #1
0
// combine all URI fields in a single string, applying funcDecode to each
// component which it may make sense to decode (i.e. "unescape")
wxString wxURI::DoBuildURI(wxString (*funcDecode)(const wxString&)) const
{
    wxString ret;

    if (HasScheme())
        ret += m_scheme + ":";

    if (HasServer())
    {
        ret += "//";

        if (HasUserInfo())
            ret += funcDecode(m_userinfo) + "@";

        if (m_hostType == wxURI_REGNAME)
            ret += funcDecode(m_server);
        else
            ret += m_server;

        if (HasPort())
            ret += ":" + m_port;
    }

    ret += funcDecode(m_path);

    if (HasQuery())
        ret += "?" + funcDecode(m_query);

    if (HasFragment())
        ret += "#" + funcDecode(m_fragment);

    return ret;
}
Beispiel #2
0
Interface& Ports::operator[](std::string pName) {
	if (HasPort(pName)) {
		return mPorts[pName];
	}
	Interface If;
	return If;
}
Beispiel #3
0
wxString wxURI::BuildUnescapedURI() const
{
    wxString ret;

    if (HasScheme())
        ret = ret + m_scheme + wxT(":");

    if (HasServer())
    {
        ret += wxT("//");

        if (HasUserInfo())
            ret = ret + wxURI::Unescape(m_userinfo) + wxT("@");

        if (m_hostType == wxURI_REGNAME)
            ret += wxURI::Unescape(m_server);
        else
            ret += m_server;

        if (HasPort())
            ret = ret + wxT(":") + m_port;
    }

    ret += wxURI::Unescape(m_path);

    if (HasQuery())
        ret = ret + wxT("?") + wxURI::Unescape(m_query);

    if (HasFragment())
        ret = ret + wxT("#") + wxURI::Unescape(m_fragment);

    return ret;
}
Beispiel #4
0
wxString wxURI::BuildURI() const
{
    wxString ret;

    if (HasScheme())
        ret = ret + m_scheme + wxT(":");

    if (HasServer())
    {
        ret += wxT("//");

        if (HasUserInfo())
            ret = ret + m_userinfo + wxT("@");

        ret += m_server;

        if (HasPort())
            ret = ret + wxT(":") + m_port;
    }

    ret += m_path;

    if (HasQuery())
        ret = ret + wxT("?") + m_query;

    if (HasFragment())
        ret = ret + wxT("#") + m_fragment;

    return ret;
}
Beispiel #5
0
Ports Ports::operator+( Ports pP) {
	//take union of ports
	//conditions: ports with the same name must have the same interface
	//a port can be bound to one edge only.
	Ports RetVal;

	//Get the set of ports of the right hand side
	std::map<std::string,Interface> P = GetValue();
	std::map<std::string,Interface>::iterator It;
	for(It = P.begin(); It != P.end();It++) {
		//If the right hand side also has the same port width the same interface
		if ( pP.HasPort(It->first) && It->second == pP[It->first]) {
			//add the interface to the set of ports to return
			RetVal.AddPort(It->first,It->second);
			//Bound the port to the edge (notice that if the two ports
			//are bound to two different edges, the user is notified but the
			//port will be bounded to the edge of the right hand side
			if ( this->IsBound(It->first)) {
				RetVal.BoundTo(It->first,BoundTo(It->first));
			}
			if ( pP.IsBound(It->first)) {
				RetVal.BoundTo(It->first,pP.BoundTo(It->first));
			}
		}
		//if the interafaces are different then return the empty set of ports
		//this should be fixed by returning the empty interface instead
		else if ( pP.HasPort(It->first) && It->second != pP[It->first] ) {
			return Ports();
		}
		//if the right hand side does not have this port
		//add the port to the return value directly
		else if ( ! pP.HasPort(It->first) ) {
			RetVal.AddPort(It->first,It->second);
			if ( this->IsBound(It->first)) {
				RetVal.BoundTo(It->first,BoundTo(It->first));
			}
		}
	}

	//add all the ports in the right hand side that are not
	//in the left hand side
	P = pP.GetValue();
	for(It = P.begin(); It != P.end();It++) {
		if ( ! HasPort(It->first) ) {
			RetVal.AddPort(It->first,It->second);
			if ( pP.IsBound(It->first)) {
				RetVal.BoundTo(It->first,pP.BoundTo(It->first));
			}
		}
	}
	return RetVal;
}
Beispiel #6
0
const BString&
BUrl::Authority() const
{
	if (!fAuthorityValid) {
		fAuthority.Truncate(0);

		if (HasUserInfo())
			fAuthority << UserInfo() << '@';
		fAuthority << Host();

		if (HasPort())
			fAuthority << ':' << fPort;

		fAuthorityValid = true;
	}
	return fAuthority;
}
Beispiel #7
0
bool wxURI::operator==(const wxURI& uri) const
{
    if (HasScheme())
    {
        if(m_scheme != uri.m_scheme)
            return false;
    }
    else if (uri.HasScheme())
        return false;


    if (HasServer())
    {
        if (HasUserInfo())
        {
            if (m_userinfo != uri.m_userinfo)
                return false;
        }
        else if (uri.HasUserInfo())
            return false;

        if (m_server != uri.m_server ||
            m_hostType != uri.m_hostType)
            return false;

        if (HasPort())
        {
            if(m_port != uri.m_port)
                return false;
        }
        else if (uri.HasPort())
            return false;
    }
    else if (uri.HasServer())
        return false;


    if (HasPath())
    {
        if(m_path != uri.m_path)
            return false;
    }
    else if (uri.HasPath())
        return false;

    if (HasQuery())
    {
        if (m_query != uri.m_query)
            return false;
    }
    else if (uri.HasQuery())
        return false;

    if (HasFragment())
    {
        if (m_fragment != uri.m_fragment)
            return false;
    }
    else if (uri.HasFragment())
        return false;

    return true;
}