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


C++ CItemData::GetEntryType方法代码示例

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


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

示例1: GetEntryImage

int CCWTreeCtrl::GetEntryImage(const CItemData &ci) const
{
  int entrytype = ci.GetEntryType();
  if (entrytype == CItemData::ET_ALIAS) {
    return ALIAS;
  }
  if (entrytype == CItemData::ET_SHORTCUT) {
    return SHORTCUT;
  }

  int nImage;
  switch (entrytype) {
    case CItemData::ET_NORMAL:
      nImage = NORMAL;
      break;
    case CItemData::ET_ALIASBASE:
      nImage = ALIASBASE;
      break;
    case CItemData::ET_SHORTCUTBASE:
      nImage = SHORTCUTBASE;
      break;
    default:
      nImage = NORMAL;
  }

  time_t tttXTime;
  ci.GetXTime(tttXTime);
  if (tttXTime > time_t(0) && tttXTime <= time_t(3650)) {
    time_t tttCPMTime;
    ci.GetPMTime(tttCPMTime);
    if ((long)tttCPMTime == 0L)
      ci.GetCTime(tttCPMTime);
    tttXTime = (time_t)((long)tttCPMTime + (long)tttXTime * 86400);
  }

  if (tttXTime != 0) {
    time_t now, warnexptime((time_t)0);
    time(&now);
    if (PWSprefs::GetInstance()->GetPref(PWSprefs::PreExpiryWarn)) {
      int idays = PWSprefs::GetInstance()->GetPref(PWSprefs::PreExpiryWarnDays);
      struct tm st;
      errno_t err;
      err = localtime_s(&st, &now);  // secure version
      ASSERT(err == 0);
      st.tm_mday += idays;
      warnexptime = mktime(&st);

      if (warnexptime == (time_t)-1)
        warnexptime = (time_t)0;
    }
    if (tttXTime <= now) {
      nImage += 2;  // Expired
    } else if (tttXTime < warnexptime) {
      nImage += 1;  // Warn nearly expired
    }
  }
  return nImage;
}
开发者ID:ByteRisc,项目名称:pwsafe,代码行数:58,代码来源:CWTreeCtrl.cpp

示例2: SetItemImage

void PWSTreeCtrl::SetItemImage(const wxTreeItemId &node,
                               const CItemData &item)
{
  // XXX TBD: modify to display warning and expired states
  int i = NORMAL_II;
  switch (item.GetEntryType()) {
  case CItemData::ET_NORMAL:       i = NORMAL_II;   break;
  case CItemData::ET_ALIASBASE:    i = ABASE_II;    break;
  case CItemData::ET_ALIAS:        i = ALIAS_II;    break;
  case CItemData::ET_SHORTCUTBASE: i = SBASE_II;    break;
  case CItemData::ET_SHORTCUT:     i = SHORTCUT_II; break;
  case CItemData::ET_INVALID:      ASSERT(0); break;
  default: ASSERT(0);
  }
  wxTreeCtrl::SetItemImage(node, i);
}
开发者ID:NonPlayerCharactor,项目名称:PasswordSafeFork,代码行数:16,代码来源:PWStree.cpp

示例3: CPWDialog

// CExpPWListDlg dialog
CExpPWListDlg::CExpPWListDlg(CWnd* pParent,
                             ExpiredList &expPWList,
                             const CString& a_filespec)
  : CPWDialog(CExpPWListDlg::IDD, pParent), m_expPWList(expPWList)
{
  m_message = a_filespec; // Path Ellipsis=true, no length woes
  m_iSortedColumn = 4;
  m_bSortAscending = FALSE;
  m_idays = PWSprefs::GetInstance()->GetPref(PWSprefs::PreExpiryWarnDays);

  // Get all entries using core vector
  for (size_t i = 0; i < m_expPWList.size(); i++) {
    st_ExpLocalListEntry elle;
 
    // Find entry
    ItemListIter iter = GetMainDlg()->Find(m_expPWList[i].uuid);
    ASSERT(iter != GetMainDlg()->End());
    CItemData *pci = &iter->second;
    ASSERT(pci != NULL);
    
    // Get group/title/user values
    elle.sx_group = pci->GetGroup();
    elle.sx_title = pci->GetTitle();
    elle.sx_user  = pci->GetUser();
    if (pci->IsProtected())
      elle.sx_title += L" #";

    // Get XTime and string versions
    elle.expirytttXTime = m_expPWList[i].expirytttXTime;
    elle.sx_expirylocdate = PWSUtil::ConvertToDateTimeString(elle.expirytttXTime, PWSUtil::TMC_LOCALE);
    
    // Get entrytype (used for selecting image)
    elle.et = pci->GetEntryType();
    
    elle.uuid = m_expPWList[i].uuid;
    
    // Save in local vector
    m_vExpLocalListEntries.push_back(elle);
  }
}
开发者ID:wcremeika,项目名称:thesis,代码行数:41,代码来源:ExpPWListDlg.cpp

示例4: Synchronize

void PWScore::Synchronize(PWScore *pothercore,
                          const CItemData::FieldBits &bsFields, const bool &subgroup_bset,
                          const stringT &subgroup_name,
                          const int &subgroup_object, const int &subgroup_function,
                          int &numUpdated, CReport *pRpt, bool *pbCancel)
{
  /*
  Purpose:
    Synchronize entries from otherCore to m_core

  Algorithm:
    Foreach entry in otherCore
      Find in m_core
        if find a match
          update requested fields
  */

  std::vector<StringX> vs_updated;
  numUpdated = 0;

  MultiCommands *pmulticmds = MultiCommands::Create(this);
  Command *pcmd1 = UpdateGUICommand::Create(this, UpdateGUICommand::WN_UNDO,
                                            UpdateGUICommand::GUI_UNDO_MERGESYNC);
  pmulticmds->Add(pcmd1);

  // Make sure we don't add it multiple times
  std::map<StringX, StringX> mapRenamedPolicies;
  std::vector<StringX> vs_PoliciesAdded;
  const StringX sxSync_DateTime = PWSUtil::GetTimeStamp(true).c_str();

  ItemListConstIter otherPos;
  for (otherPos = pothercore->GetEntryIter();
       otherPos != pothercore->GetEntryEndIter();
       otherPos++) {
    // See if user has cancelled
    if (pbCancel != NULL && *pbCancel) {
      delete pmulticmds;
      return;
    }

    CItemData otherItem = pothercore->GetEntry(otherPos);
    CItemData::EntryType et = otherItem.GetEntryType();

    // Do not process Aliases and Shortcuts
    if (et == CItemData::ET_ALIAS || et == CItemData::ET_SHORTCUT)
      continue;

    if (subgroup_bset &&
        !otherItem.Matches(subgroup_name, subgroup_object, subgroup_function))
      continue;

    const StringX sx_otherGroup = otherItem.GetGroup();
    const StringX sx_otherTitle = otherItem.GetTitle();
    const StringX sx_otherUser = otherItem.GetUser();

    StringX sx_mergedentry;
    Format(sx_mergedentry, GROUPTITLEUSERINCHEVRONS,
                sx_otherGroup.c_str(), sx_otherTitle.c_str(), sx_otherUser.c_str());

    ItemListConstIter foundPos = Find(sx_otherGroup, sx_otherTitle, sx_otherUser);

    if (foundPos != GetEntryEndIter()) {
      // found a match
      CItemData curItem = GetEntry(foundPos);

      // Don't update if entry is protected
      if (curItem.IsProtected())
        continue;

      CItemData updItem(curItem);
      updItem.SetDisplayInfo(NULL);

      if (curItem.GetUUID() != otherItem.GetUUID()) {
        pws_os::Trace(_T("Synchronize: Mis-match UUIDs for [%ls:%ls:%ls]\n"),
             sx_otherGroup.c_str(), sx_otherTitle.c_str(), sx_otherUser.c_str());
      }

      bool bUpdated(false);
      // Do not try and change GROUPTITLE = 0x00 (use GROUP & TITLE separately) or UUID = 0x01
      for (size_t i = 2; i < bsFields.size(); i++) {
        if (bsFields.test(i)) {
          StringX sxValue = otherItem.GetFieldValue(static_cast<CItemData::FieldType>(i));

          // Special processing for password policies (default & named)
          if (static_cast<CItemData::FieldType>(i) == CItemData::POLICYNAME) {
            Command *pPolicyCmd = ProcessPolicyName(pothercore, updItem,
                                   mapRenamedPolicies, vs_PoliciesAdded,
                                   sxValue, bUpdated,
                                   sxSync_DateTime, IDSC_SYNCPOLICY);
            if (pPolicyCmd != NULL)
              pmulticmds->Add(pPolicyCmd);
          } else {
            if (sxValue != updItem.GetFieldValue(static_cast<CItemData::FieldType>(i))) {
              bUpdated = true;
              updItem.SetFieldValue(static_cast<CItemData::FieldType>(i), sxValue);
            }
          }
        }
      }

//.........这里部分代码省略.........
开发者ID:NonPlayerCharactor,项目名称:PasswordSafeFork,代码行数:101,代码来源:CoreOtherDB.cpp

示例5: Merge

stringT PWScore::Merge(PWScore *pothercore,
                       const bool &subgroup_bset,
                       const stringT &subgroup_name,
                       const int &subgroup_object, const int &subgroup_function,
                       CReport *pRpt, bool *pbCancel)
{
  std::vector<StringX> vs_added;
  std::vector<StringX> vs_AliasesAdded;
  std::vector<StringX> vs_ShortcutsAdded;
  std::vector<StringX> vs_PoliciesAdded;
  std::map<StringX, StringX> mapRenamedPolicies;

  const StringX sxMerge_DateTime = PWSUtil::GetTimeStamp(true).c_str();

  stringT str_timestring;  // To append to title if already in current database
  str_timestring = sxMerge_DateTime.c_str();
  Remove(str_timestring, _T('/'));
  Remove(str_timestring, _T(':'));

  /*
    Purpose:
      Merge entries from otherCore to m_core

    Algorithm:
      Foreach entry in otherCore
        Find in m_core based on group/title/username
          if match found {
            if all other fields match {
              no merge
            } else {
              add to m_core with new title suffixed with -merged-YYYYMMDD-HHMMSS
            }
          } else {
            add to m_core directly
          }
   */

  int numAdded = 0;
  int numConflicts = 0;
  int numAliasesAdded = 0;
  int numShortcutsAdded = 0;
  uuid_array_t base_uuid, new_base_uuid;
  bool bTitleRenamed(false);
  StringX sx_merged;
  LoadAString(sx_merged, IDSC_MERGED);

  MultiCommands *pmulticmds = MultiCommands::Create(this);
  Command *pcmd1 = UpdateGUICommand::Create(this, UpdateGUICommand::WN_UNDO,
                                            UpdateGUICommand::GUI_UNDO_MERGESYNC);
  pmulticmds->Add(pcmd1);

  ItemListConstIter otherPos;
  for (otherPos = pothercore->GetEntryIter();
       otherPos != pothercore->GetEntryEndIter();
       otherPos++) {
    // See if user has cancelled
    if (pbCancel != NULL && *pbCancel) {
      delete pmulticmds;
      return _T("");
    }

    CItemData otherItem = pothercore->GetEntry(otherPos);
    CItemData::EntryType et = otherItem.GetEntryType();

    // Need to check that entry keyboard shortcut not already in use!
    int32 iKBShortcut;
    otherItem.GetKBShortcut(iKBShortcut);
    CUUID kbshortcut_uuid = GetKBShortcut(iKBShortcut);
    bool bKBShortcutInUse = (iKBShortcut != 0&& kbshortcut_uuid != CUUID::NullUUID());

    // Handle Aliases and Shortcuts when processing their base entries
    if (otherItem.IsDependent())
      continue;

    if (subgroup_bset &&
        !otherItem.Matches(subgroup_name, subgroup_object, subgroup_function))
      continue;

    const StringX sx_otherGroup = otherItem.GetGroup();
    const StringX sx_otherTitle = otherItem.GetTitle();
    const StringX sx_otherUser = otherItem.GetUser();

    StringX sxMergedEntry;
    Format(sxMergedEntry, GROUPTITLEUSERINCHEVRONS,
                sx_otherGroup.c_str(), sx_otherTitle.c_str(), sx_otherUser.c_str());

    ItemListConstIter foundPos = Find(sx_otherGroup, sx_otherTitle, sx_otherUser);

    otherItem.GetUUID(base_uuid);
    memcpy(new_base_uuid, base_uuid, sizeof(new_base_uuid));
    bTitleRenamed = false;

    if (foundPos != GetEntryEndIter()) {
      // Found a match, see if other fields also match
      CItemData curItem = GetEntry(foundPos);

      // Can't merge into a protected entry.  If we were going to - add instead
      unsigned char ucprotected;
      curItem.GetProtected(ucprotected);

//.........这里部分代码省略.........
开发者ID:NonPlayerCharactor,项目名称:PasswordSafeFork,代码行数:101,代码来源:CoreOtherDB.cpp

示例6: CompareEntries

bool CCompareResultsDlg::CompareEntries(st_CompareData *pst_data)
{
  CItemData::FieldBits bsConflicts;
  
  bsConflicts.reset();

  ItemListIter iter;
  iter = m_pcore0->Find(pst_data->uuid0);
  CItemData currentItem = iter->second;
  iter = m_pcore1->Find(pst_data->uuid1);
  CItemData compItem = iter->second;
  
  StringX sxCurrentPassword, sxComparisonPassword;

  if (currentItem.GetEntryType() == CItemData::ET_ALIAS ||
      currentItem.GetEntryType() == CItemData::ET_SHORTCUT) {
     CItemData *pci_base = m_pcore0->GetBaseEntry(&currentItem);
     sxCurrentPassword == pci_base->GetPassword();
  } else
    sxCurrentPassword == currentItem.GetPassword();

  if (compItem.GetEntryType() == CItemData::ET_ALIAS ||
      compItem.GetEntryType() == CItemData::ET_SHORTCUT) {
    CItemData *pci_base = m_pcore1->GetBaseEntry(&compItem);
    sxComparisonPassword == pci_base->GetPassword();
  } else
    sxComparisonPassword == compItem.GetPassword();

  if (m_bsFields.test(CItemData::PASSWORD) &&
      sxCurrentPassword != sxComparisonPassword)
    bsConflicts.flip(CItemData::PASSWORD);

  if (m_bsFields.test(CItemData::NOTES) &&
      FieldsNotEqual(currentItem.GetNotes(), compItem.GetNotes(), m_bTreatWhiteSpaceasEmpty))
    bsConflicts.flip(CItemData::NOTES);
  if (m_bsFields.test(CItemData::CTIME) &&
      currentItem.GetCTime() != compItem.GetCTime())
    bsConflicts.flip(CItemData::CTIME);
  if (m_bsFields.test(CItemData::PMTIME) &&
      currentItem.GetPMTime() != compItem.GetPMTime())
    bsConflicts.flip(CItemData::PMTIME);
  if (m_bsFields.test(CItemData::ATIME) &&
      currentItem.GetATime() != compItem.GetATime())
    bsConflicts.flip(CItemData::ATIME);
  if (m_bsFields.test(CItemData::XTIME) &&
      currentItem.GetXTime() != compItem.GetXTime())
    bsConflicts.flip(CItemData::XTIME);
  if (m_bsFields.test(CItemData::RMTIME) &&
      currentItem.GetRMTime() != compItem.GetRMTime())
    bsConflicts.flip(CItemData::RMTIME);
  if (m_bsFields.test(CItemData::XTIME_INT)) {
    int current_xint, comp_xint;
    currentItem.GetXTimeInt(current_xint);
    compItem.GetXTimeInt(comp_xint);
    if (current_xint != comp_xint)
      bsConflicts.flip(CItemData::XTIME_INT);
    }
  if (m_bsFields.test(CItemData::URL) &&
      FieldsNotEqual(currentItem.GetURL(), compItem.GetURL(),
                     m_bTreatWhiteSpaceasEmpty))
    bsConflicts.flip(CItemData::URL);
  if (m_bsFields.test(CItemData::AUTOTYPE) &&
      FieldsNotEqual(currentItem.GetAutoType(), compItem.GetAutoType(),
                     m_bTreatWhiteSpaceasEmpty))
    bsConflicts.flip(CItemData::AUTOTYPE);
  if (m_bsFields.test(CItemData::PWHIST) &&
    currentItem.GetPWHistory() != compItem.GetPWHistory())
    bsConflicts.flip(CItemData::PWHIST);
  if (m_bsFields.test(CItemData::POLICY) &&
      currentItem.GetPWPolicy() != compItem.GetPWPolicy())
    bsConflicts.flip(CItemData::POLICY);
  if (m_bsFields.test(CItemData::POLICYNAME) &&
      currentItem.GetPolicyName() != compItem.GetPolicyName())
    bsConflicts.flip(CItemData::POLICYNAME);
  if (m_bsFields.test(CItemData::RUNCMD) &&
      currentItem.GetRunCommand() != compItem.GetRunCommand())
    bsConflicts.flip(CItemData::RUNCMD);
  if (m_bsFields.test(CItemData::DCA) &&
      currentItem.GetDCA() != compItem.GetDCA())
    bsConflicts.flip(CItemData::DCA);
  if (m_bsFields.test(CItemData::SHIFTDCA) &&
      currentItem.GetShiftDCA() != compItem.GetShiftDCA())
    bsConflicts.flip(CItemData::SHIFTDCA);
  if (m_bsFields.test(CItemData::EMAIL) &&
      currentItem.GetEmail() != compItem.GetEmail())
    bsConflicts.flip(CItemData::EMAIL);
  if (m_bsFields.test(CItemData::PROTECTED) &&
      currentItem.GetProtected() != compItem.GetProtected())
    bsConflicts.flip(CItemData::PROTECTED);
  if (m_bsFields.test(CItemData::SYMBOLS) &&
      currentItem.GetSymbols() != compItem.GetSymbols())
    bsConflicts.flip(CItemData::SYMBOLS);
  if (m_bsFields.test(CItemData::KBSHORTCUT) &&
      currentItem.GetKBShortcut() != compItem.GetKBShortcut())
    bsConflicts.flip(CItemData::KBSHORTCUT);

  return bsConflicts.none();
}
开发者ID:NonPlayerCharactor,项目名称:PasswordSafeFork,代码行数:98,代码来源:CompareResultsDlg.cpp

示例7: PassesFiltering

bool PWSFilterManager::PassesFiltering(const CItemData &ci, const PWScore &core)
{
  bool thistest_rc;
  bool bValue(false);
  bool bFilterForStatus(false), bFilterForType(false);
  const CItemData *pci;

  if (!m_currentfilter.IsActive())
    return true;

  const CItemData::EntryType entrytype = ci.GetEntryType();

  for (auto groups_iter = m_vMflgroups.begin();
       groups_iter != m_vMflgroups.end(); groups_iter++) {
    const vfiltergroup &group = *groups_iter;

    int tests(0);
    bool thisgroup_rc = false;
    for (auto iter = group.begin();
         iter != group.end(); iter++) {
      const int &num = *iter;
      if (num == -1) // Padding to ensure group size is correct for FT_PWHIST & FT_POLICY
        continue;

      const st_FilterRow &st_fldata = m_currentfilter.vMfldata.at(num);
      thistest_rc = false;

      PWSMatch::MatchType mt(PWSMatch::MT_INVALID);
      const FieldType ft = m_currentfilter.vMfldata[num].ftype;
      const int ifunction = (int)st_fldata.rule;

      switch (ft) {
        case FT_GROUPTITLE:
        case FT_GROUP:
        case FT_TITLE:
        case FT_USER:
        case FT_NOTES:
        case FT_URL:
        case FT_AUTOTYPE:
        case FT_RUNCMD:
        case FT_EMAIL:
        case FT_SYMBOLS:
        case FT_POLICYNAME:
          mt = PWSMatch::MT_STRING;
          break;
        case FT_PASSWORD:
          mt = PWSMatch::MT_PASSWORD;
          break;
        case FT_DCA:
          mt = PWSMatch::MT_DCA;
          break;
        case FT_SHIFTDCA:
          mt = PWSMatch::MT_SHIFTDCA;
          break;
        case FT_CTIME:
        case FT_PMTIME:
        case FT_ATIME:
        case FT_XTIME:
        case FT_RMTIME:
          mt = PWSMatch::MT_DATE;
          break;
        case FT_PWHIST:
          mt = PWSMatch::MT_PWHIST;
          break;
        case FT_POLICY:
          mt = PWSMatch::MT_POLICY;
          break;
        case FT_XTIME_INT:
          mt = PWSMatch::MT_INTEGER;
          break;
        case FT_KBSHORTCUT:
          bValue = !ci.GetKBShortcut().empty();
          mt = PWSMatch::MT_BOOL;
          break;
        case FT_UNKNOWNFIELDS:
          bValue = ci.NumberUnknownFields() > 0;
          mt = PWSMatch::MT_BOOL;
          break;
        case FT_PROTECTED:
          bValue = ci.IsProtected();
          mt = PWSMatch::MT_BOOL;
          break;
        case FT_PASSWORDLEN:
          mt = PWSMatch::MT_INTEGER;
          break;
        case FT_ENTRYTYPE:
          mt = PWSMatch::MT_ENTRYTYPE;
          break;
        case FT_ENTRYSTATUS:
          mt = PWSMatch::MT_ENTRYSTATUS;
          break;
        case FT_ENTRYSIZE:
          mt = PWSMatch::MT_ENTRYSIZE;
          break;
        case FT_ATTACHMENT:
          mt = PWSMatch::MT_ATTACHMENT;
          break;
        default:
          ASSERT(0);
      }
//.........这里部分代码省略.........
开发者ID:pwsafe,项目名称:pwsafe,代码行数:101,代码来源:PWSFilters.cpp


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