Ejemplo n.º 1
0
/*********************************************************************************
bool CSSOBuilder::Build()
Author:		Martin Robb
Created:	
Returns:	false in case of an error
Purpose:	Examines parameters, builds xml
*********************************************************************************/
bool CSSOBuilder::Build(CWholePage* pPage)
{
	m_pPage = pPage;
	if (!InitPage(m_pPage, "NEWREGISTER",true))
	{
		return false;
	}

	if (m_InputContext.ParamExists("ssoc"))
	{
		CTDVString sSsoAction;
		m_InputContext.GetParamString("ssoc",sSsoAction,0);

		if (sSsoAction.CompareText("register"))
		{
			return GetPostcodeFromUser();
		}
		else if (sSsoAction.CompareText("postcode"))
		{
			return VerifyPostcode();
		}
		else if (sSsoAction.CompareText("signout"))
		{
			return UserSignedOut();
		}
		else if (sSsoAction.CompareText("notme"))
		{
			return UserSaidNotMe();
		}
		else if(sSsoAction.CompareText("addservice"))
		{
			return true;
		}
		else
		{
			return UnknownAction();
		}
	}
	else
	{
		return ErrorMessage("BADPARAM","The url you called was has invalid parameters");
	}
	

	return false;
}
Ejemplo n.º 2
0
void Search::readStrGraph(Patterns &patterns,StrGraph &desc) {
    clear();
    map<StrGraph::Node*,Node*> recollect;
    for(StrGraph::node_iter ni = desc.nodes().begin(); ni!=desc.nodes().end(); ++ni) {
        Node *n = create_node(gd<Name>(*ni));
        recollect[*ni] = n;
        SearchStage &stage = gd<SearchStage>(n);
        DString limit = gd<StrAttrs>(*ni).look("limit","50");
        stage.limit = atoi(limit.c_str());
        DString action = gd<StrAttrs>(*ni).look("action","union");
        if(action=="union")
            stage.type = UnionInquiry;
        else if(action=="intersection")
            stage.type = IntersectionInquiry;
        else if(action=="pattern") {
            stage.type = PatternInquiry;
            DString pattern = gd<StrAttrs>(*ni).look("pattern","");
            Patterns::iterator pi = patterns.find(pattern);
            if(pi==patterns.end())
                throw UndefinedPattern(pattern);
            stage.pattern = &pi->second;
        }
        else if(action=="path") {
            stage.type = PathInquiry;
            DString ways = gd<StrAttrs>(*ni)["ways"];
            if(ways=="in")
                stage.goIn = true, stage.goOut = false;
            else if(ways=="both")
                stage.goIn = stage.goOut = true;
            else  // ways=="out" default
                stage.goIn = false, stage.goOut = true;
            stage.firstOnly = gd<StrAttrs>(*ni)["firstonly"]=="true";
            stage.shortest = gd<StrAttrs>(*ni)["shortest"]=="true";
            stage.weightattr = gd<StrAttrs>(*ni).look("weightattr","weight");
        }
        else
            throw UnknownAction(action);
    }
    for(StrGraph::graphedge_iter ei = desc.edges().begin(); ei!=desc.edges().end(); ++ei) {
        Edge *e = create_edge(recollect[(*ei)->tail],recollect[(*ei)->head]).first;
        DString input = gd<StrAttrs>(*ei).look("input","");
        gd<Name>(e) = input;
    }
}