当前位置: 首页>>代码示例>>C++>>正文


C++ SystemList类代码示例

本文整理汇总了C++中SystemList的典型用法代码示例。如果您正苦于以下问题:C++ SystemList类的具体用法?C++ SystemList怎么用?C++ SystemList使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了SystemList类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: SystemName

int GeUser::modify_user(char* system, char* user, char* password,
    unsigned int priv, char* fullname, char* description, char* email,
    char* phone, char* sms)
{
  int sts;
  UserList* ul;

  SystemName* sn = new SystemName(system);
  sts = sn->parse();
  if (EVEN(sts)) {
    delete sn;
    return sts;
  }

  SystemList* sl = find_system(sn);
  delete sn;
  if (!sl)
    return USER__NOSUCHSYSTEM;

  ul = (UserList*)sl->find_user(user);
  if (!ul)
    return USER__NOSUCHUSER;
  ul->modify(password, priv, fullname, description, email, phone, sms);

  return USER__SUCCESS;
}
开发者ID:siamect,项目名称:proview,代码行数:26,代码来源:co_user.cpp

示例2: add_user

int GeUser::add_user(char* system, char* user, char* password, pwr_tMask priv,
    char* fullname, char* description, char* email, char* phone, char* sms,
    pwr_tOix id)
{
  SystemList* sl;
  int sts;

  // Find system
  SystemName* sn = new SystemName(system);
  sts = sn->parse();
  if (EVEN(sts)) {
    delete sn;
    return sts;
  }
  sl = find_system(sn);
  if (!sl)
    return USER__NOSUCHSYSTEM;

  if (id == user_cNId)
    id = get_next_id();
  else if (id >= next_id)
    next_id = id + 1;

  sl->add_user(
      id, user, password, priv, fullname, description, email, phone, sms);
  return USER__SUCCESS;
}
开发者ID:siamect,项目名称:proview,代码行数:27,代码来源:co_user.cpp

示例3: print_all

void GeUser::print_all(int brief)
{
  SystemList* sl;

  std::cout << '\n' << "Proview user database " << user_cVersion << "\n\n";
  for (sl = root; sl != NULL; sl = sl->next)
    sl->print_all(brief);
  std::cout << '\n';
}
开发者ID:siamect,项目名称:proview,代码行数:9,代码来源:co_user.cpp

示例4: print_all

void GeUser::print_all( int brief)
{
  SystemList *sl;

  cout << endl << "Proview user database " << user_cVersion << endl << endl;
  for ( sl = root; sl != NULL; sl = sl->next)
    sl->print_all( brief);
  cout << endl;
}
开发者ID:jordibrus,项目名称:proview,代码行数:9,代码来源:co_user.cpp

示例5: find_system

SystemList* SystemList::find_system(SystemName* name)
{
  SystemList* sl;

  for (sl = childlist; sl; sl = sl->next) {
    if (str_NoCaseStrcmp(sl->name, name->segment(sl->level)) == 0) {
      if (name->segments == sl->level + 1)
        return sl;
      return sl->find_system(name);
    }
  }
  return NULL;
}
开发者ID:siamect,项目名称:proview,代码行数:13,代码来源:co_user.cpp

示例6: calloc

void rt_pvd_udb::load_systemgroup( SystemList *systemgroup)
{
  procom_obj item;
  pwr_sClass_SystemGroupReg *body;
  char sname[120];
  char *s;

  body = (pwr_sClass_SystemGroupReg *) calloc( 1, sizeof(pwr_sClass_SystemGroupReg));
  item.body = body;
  gu->get_system_name( systemgroup, sname);
  if (( s = strrchr( sname, '.')))
    strcpy( item.name, s+1);
  else
    strcpy( item.name, sname);

  gu->get_system_data( sname, &body->Attributes, &item.oix, body->Description);
  item.oix++;

  if ( next_oix <= item.oix)
    next_oix = item.oix + 1;
  item.cid = pwr_cClass_SystemGroupReg;
  item.fthoix = menu_stack[menu_cnt - 1];
  item.bwsoix = m_list[item.fthoix].lchoix;
  if ( item.bwsoix)
    m_list[item.bwsoix].fwsoix = item.oix;
  if ( m_list[item.fthoix].fchoix == 0)
    m_list[item.fthoix].fchoix = item.oix;
  m_list[item.fthoix].lchoix = item.oix;

  item.body_size = sizeof(pwr_sClass_SystemGroupReg);

  menu_stack[menu_cnt] = item.oix;
  menu_cnt++;
  if ( m_list.size() <= item.oix + 1)
    m_list.resize( item.oix + 1);
  m_list[item.oix] = item;

  UserList *user = systemgroup->first_user();
  while ( user) {
    load_user( user, systemgroup);

    user = user->next_user();
  }
  SystemList *sg = systemgroup->first_system();
  while ( sg) {
    load_systemgroup( sg);

    sg = sg->next_system();
  }
  menu_cnt--;
}
开发者ID:Strongc,项目名称:proview,代码行数:51,代码来源:rt_pvd_udb.cpp

示例7: get_user

int GeUser::get_user( const char *gu_system, const char *gu_user, const char *gu_password, 
		      unsigned int *priv)
{
  UserList *ul;
  SystemList *sl;
  SystemName *sn, *parent;
  int sts;
  char system[80];
  char password[80];
  char user[80];

  cdh_ToLower( system, gu_system);
  cdh_ToLower( user, gu_user);
  strcpy( password, gu_password);

  // Find system
  sn = new SystemName( system);
  sts = sn->parse();
  if ( EVEN(sts))
  {
    delete sn;
    return USER__NOSUCHSYSTEM;
  }

  while( sn)
  {
    sl = find_system( sn);
    if ( sl)
    {
      ul = (UserList *) sl->find_user( user);
      if ( ul)
      {
        sts = ul->check_password( password);
        if ( EVEN(sts))
          return sts;
        *priv = ul->priv;
        return USER__SUCCESS;
      }
      if ( !(sl->attributes & user_mSystemAttr_UserInherit))
        break;
    }
    parent = sn->parent();
    if ( parent)
      parent->parse();
    delete sn;
    sn = parent;
  }
  return USER__NOSUCHUSER;
}
开发者ID:jordibrus,项目名称:proview,代码行数:49,代码来源:co_user.cpp

示例8: GeUser

void rt_pvd_udb::load( pwr_tStatus *rsts)
{
  char		filename[256];
  int		sts;

  if ( gu)
    gu->clear();
  else
    gu = new GeUser();
  sts = dcli_get_defaultfilename( user_cFilename, filename, "");
  gu->load( filename);
 
  // Create Root object

  procom_obj rootitem;
  if ( m_env == pvd_eEnv_Wb) {
    strcpy( rootitem.name, "UserDatabase");
    rootitem.cid = pwr_eClass_PlantHier;
    rootitem.oix = 0; 
  }
  else {
    strcpy( rootitem.name, "VolUserDatabase");
    rootitem.cid = pwr_eClass_ExternVolume;
    rootitem.oix = 0; 
    rootitem.body_size = sizeof(pwr_sExternVolume);
    rootitem.body = calloc( 1, rootitem.body_size);
  }
  m_list.push_back(rootitem);
  menu_stack[menu_cnt] = rootitem.oix;
  menu_cnt++;

  SystemList *systemgroup = gu->root_system();
  while ( systemgroup) {
    load_systemgroup( systemgroup);

    systemgroup = systemgroup->next_system();
  }

  if ( m_env == pvd_eEnv_Rt) {
    // Convert to Rt style
    for ( int i = 1; i < (int)m_list.size(); i++) {
      if ( m_list[i].bwsoix == 0)
	m_list[i].bwsoix = m_list[m_list[i].fthoix].lchoix;
      if ( m_list[i].fwsoix == 0)
	m_list[i].fwsoix = m_list[m_list[i].fthoix].fchoix;
    }  
  }
  
}
开发者ID:Strongc,项目名称:proview,代码行数:49,代码来源:rt_pvd_udb.cpp

示例9:

SystemList *GeUser::find_system( SystemName *name)
{
  SystemList *sl;

  for ( sl = root; sl; sl = sl->next)
  {
    if ( cdh_NoCaseStrcmp( sl->name, name->segment(0)) == 0)
    {
      if ( name->segments == sl->level + 1)
        return sl;
      return sl->find_system( name);
    }
  }
  return NULL;
}
开发者ID:jordibrus,项目名称:proview,代码行数:15,代码来源:co_user.cpp

示例10: save

void SystemList::save(std::ofstream& fp)
{
  UserList* ul;
  SystemList* sl;

  fp << int(user_eData_System) << '\n';
  fp << int(user_eData_SystemName) << FSPACE << name << '\n';
  fp << int(user_eData_SystemLevel) << FSPACE << level << '\n';
  fp << int(user_eData_SystemAttributes) << FSPACE << attributes << '\n';
  fp << int(user_eData_SystemId) << FSPACE << id << '\n';
  fp << int(user_eData_SystemDescription) << FSPACE << description << '\n';
  for (ul = (UserList*)userlist; ul != NULL; ul = ul->next)
    ul->save(fp);
  for (sl = childlist; sl; sl = sl->next)
    sl->save(fp);
  fp << int(user_eData_End) << '\n';
}
开发者ID:siamect,项目名称:proview,代码行数:17,代码来源:co_user.cpp

示例11: net_NetTimeToTime

pwr_tStatus rt_post::mh_alarm_bc( mh_sMessage *MsgP)
{
  ala_uEvent 	*event = (ala_uEvent *) MsgP;
  int sts;
  char str[256];
  char user[80];
  char group[80];
  char *s;
  pwr_tTime etime, current;
  pwr_tDeltaTime diff;
  int rcvnum;
  char rcv_array[10][80];
  char text[400];

  if ( !post || post->conf->Disable)
    return 1;

  if ( !event->Info.EventFlags & pwr_mEventFlagsMask_Email ||
       !event->Info.EventFlags & pwr_mEventFlagsMask_SMS)
    return 1;

  // Skip events older than 10 minutes
  etime = net_NetTimeToTime( &event->Info.EventTime);
  time_GetTime( &current);
  time_Adiff( &diff, &current, &etime);

  if ( time_DToFloat( 0, &diff) > 600)
    return 1;

  // Check if already handled
  if ( event->Info.EventFlags & pwr_mEventFlagsMask_Email) {
    if ( post->email_check( &event->Info.Id))
      return 1;
    else
      post->email_register( &event->Info.Id);
  }
  

  if ( event->Info.EventFlags & pwr_mEventFlagsMask_SMS) {
    if ( post->sms_check( &event->Info.Id))
      return 1;
    else
      post->sms_register( &event->Info.Id);
  }

  post->replace_symbol( str, event->Msg.Receiver);

  rcvnum = dcli_parse( str, ",", "",
		     (char *) rcv_array, sizeof( rcv_array)/sizeof( rcv_array[0]),
		     sizeof( rcv_array[0]), 0);
  
  for ( int i = 0; i < rcvnum; i++) {

    dcli_trim( str, rcv_array[i]);

    s = strrchr( str, '.');
    if ( s) {
      *s = 0;
      strncpy( group, post->systemgroup, sizeof(group));
      strncat( group, ".", sizeof(group));
      strncat( group, str, sizeof(group));
      strncpy( user, s+1, sizeof(user));
    }
    else {
      strncpy( group, post->systemgroup, sizeof(group));
      strncpy( user, str, sizeof(user));
    }
  
    SystemName *sn = new SystemName( group);
    sts = sn->parse();
    if ( EVEN(sts)) {
      delete sn;
      errh_Error( "Post systemgroup parse error, %m", sts);
      continue;
    }

    SystemList *sl = post->udb->find_system( sn);
    delete sn;
    if ( !sl) {
      errh_Error( "No such system group, %s", group);
      continue;
    }

    UserList *ul = (UserList *) sl->find_user( user);
    if ( !ul) {
      errh_Error( "No such user, %s", user);
      continue;
    }
  
    if ( event->Info.EventFlags & pwr_mEventFlagsMask_Email &&
	 strcmp( post->conf->EmailCmd, "") != 0) {
      char address[40];
      pwr_tCmd cmd;
      
      ul->get_email( address, sizeof(address));
      
      post->format_email_text( MsgP, text, sizeof(text));
      post->format_cmd( cmd,  post->conf->EmailCmd, address, text);

      if ( post->conf->Options & pwr_mPostOptionsMask_Log)
//.........这里部分代码省略.........
开发者ID:ManfredHerrmann,项目名称:proview,代码行数:101,代码来源:rt_post.cpp


注:本文中的SystemList类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。