コード例 #1
0
ファイル: rdispatcher.c プロジェクト: jixc2008/rhodes
static int 
_parse_route(RouteRef route) {
	char *actionorid,*next;
  char* url = route->_url;

  if (url[0]=='/') url++;
	
	route->_application = url;	
	if ((route->_model = _tok(url)) == NULL)
		return 0;
	
	if ((actionorid = _tok(route->_model)) == NULL)
		return 1;
	
	next = _tok(actionorid);
	
	if (_isid(actionorid)) {
		route->_id = actionorid;
		route->_action = next;
	} else {
		route->_id = next;
		route->_action = actionorid;
	}
	_tok(next);
	
	return 1;
}
コード例 #2
0
ファイル: Dispatcher.c プロジェクト: ZhangHanDong/rhodes
static bool 
_GetRoute(char* url, RouteRef route) {
	char *actionorid,*next;
	
	memset(route, 0, sizeof(route[0]));
	if (url[0]=='/') url++;	
	
	route->_application = url;	
	if ((route->_model = _tok(url)) == NULL)
		return false;
	
	if ((actionorid = _tok(route->_model)) == NULL)
		return true;
	
	next = _tok(actionorid);
	
	if (_isid(actionorid)) {
		route->_id = actionorid;
		route->_action = next;
	} else {
		route->_id = next;
		route->_action = actionorid;
	}
	_tok(next);
	
	return true;
}