コード例 #1
0
ファイル: Web_Crawler.cpp プロジェクト: esohns/ATCD
int
Web_Crawler::run (void)
{
  // Make the appropriate <URL_Visitor>.
  Auto_Destroyer<URL_Visitor> visitor (this->url_visitor_factory_->make_visitor ());

  if (*visitor == 0)
    ACE_ERROR_RETURN ((LM_ERROR,
                       "%p\n",
                       "make_visitor"),
                      -1);

  // Make the appropriate <Command_Processor>.
  Auto_Destroyer<Command_Processor> cp (this->url_visitor_factory_->make_command_processor ());

  if (*cp == 0)
    ACE_ERROR_RETURN ((LM_ERROR,
                       "%p\n",
                       "make_command_processor"),
                      -1);

  // Set the <Command_Processor> in the <Options> to make it visible.
  OPTIONS::instance ()->command_processor (*cp);

  // Set the <URL_Visitor> in the <Options> to make it visible.
  OPTIONS::instance ()->visitor (*visitor);

  // @@ You fill in here...
  ACE_URL_Addr *url_addr;
  ACE_NEW_RETURN (url_addr,
                  ACE_URL_Addr (OPTIONS::instance()->hostname (),
                                OPTIONS::instance()->path_name (),
                                OPTIONS::instance()->port_no ()), //KIRTHIKA
                  0);
  Auto_Destroyer<ACE_URL_Addr> url_addr_ptr (url_addr);

  HTTP_URL *http_url;
  ACE_NEW_RETURN (http_url,
                  HTTP_URL (**url_addr_ptr),
                  0);

  Auto_Destroyer<HTTP_URL> http_url_ptr (http_url);

  URL_Command *url_command;
  ACE_NEW_RETURN (url_command,
                  URL_Command (*http_url_ptr),
                  0);
  // Auto_Destroyer<URL_Command> url_command_ptr (url_command);

  if (cp->insert (url_command) != 0)
    ACE_ERROR_RETURN ((LM_ERROR,
                       "%p\n", "insert"),
                      -1);

 if (cp->execute () != 0)
   ACE_ERROR_RETURN ((LM_ERROR,
                       "%p\n", "execute"),
                      -1);
  return 0;
}
コード例 #2
0
ファイル: BX_User.cpp プロジェクト: RomanKoshelev/school
/*______________________________________________________________________________
[]                                                                            []
[]                                                                            []
[]` BX_User_PutData                                                           []               
[]                                                                            []
[]____________________________________________________________________________[]
*/
BX_RESULT
BX_User_PutData(BX_User_Args& arg)
{
	if (!OC_Exist(OBJ_CLASS_ID_User, arg.objID))
		return BXE_User_PutData_InvalidUserID;
	
	OC_User		oc_user;

	oc_user.Open(arg.objID);

	if ((arg.Password != string(oc_user.m_Password)) && (!CheckAdminPassword(arg.Password)))
		return BXE_User_AccessDenied;

// Тут можно также организовать проверку полей arg.* на валидность...

//	if (arg.Password == arg.PasswordConfirm) ПАРОЛЬ МЕНЯТЬ НЕЛЬЗЯ!
//		oc_user.m_Password	= arg.Password;

//----------------------------------------------------------------------------[] 
// Копирование полей:

// FullName	
	oc_user.m_FullName		= arg.FullName;

// Region
	VALIDATE_ID_ARRAY	(OBJ_CLASS_ID_Concept,		arg.Concept);
	_IDsToBits_Set( arg.Concept, oc_user.m_ba_Concept);
	ExpandConcept(arg.Concept);
	_IDsToBits_Set( arg.Concept, oc_user.m_eba_Concept);

// InterfaceLanguage
	if (OC_Exist(OBJ_CLASS_ID_Language, arg.InterfaceLanguage))
		oc_user.m_InterfaceLanguage = arg.InterfaceLanguage;

// InterfaceType
	oc_user.m_InterfaceType = arg.InterfaceType;

// Email
	if (Email_IsValid(arg.Email)) {
		oc_user.m_Email		= arg.Email;
	}
// Phone
	oc_user.m_Phone			= arg.Phone;

// Fax
	oc_user.m_Fax				= arg.Fax;

// Address
	oc_user.m_Address			= arg.Address;

// URL
	HTTP_URL(arg.URL).URL(arg.URL);
	oc_user.m_URL				= arg.URL;

// Comment
	oc_user.m_Comment			= arg.Comment;

// TimeZoneOffset
	if (labs(arg.TZOffset) <= SECS_IN_DAY/2) {
		oc_user.m_TZOffset	= arg.TZOffset;
	}
// NotifyFreq
	oc_user.m_NotifyFreq		= arg.NotifyFreq;

// NotifyHTML
	oc_user.m_NotifyHTML		= arg.NotifyHTML;

// NotifyDepth
	oc_user.m_NotifyDepth	= arg.NotifyDepth;

//- - - - - - - - - - - - - - - - - - - - - - - - - -[]` 

// Установим признак изменения объекта:	
	oc_user.m_ObjectState	= OBJ_STATE_CHANGED;

	return BX_OK;
}