本文整理汇总了C++中CItemData::SetName方法的典型用法代码示例。如果您正苦于以下问题:C++ CItemData::SetName方法的具体用法?C++ CItemData::SetName怎么用?C++ CItemData::SetName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CItemData
的用法示例。
在下文中一共展示了CItemData::SetName方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: rname
int PWSfileV1V2::WriteV2Header()
{
CItemData header;
// Fill out with V2-specific info
// To make a dictionary attack a little harder, we make the length
// of the first record (Name) variable, by appending variable length randomness
// to the fixed string
// OOPS - can't do this yet, since previous versions (pre-2.14) read the name
// (in ReadV2Header)
// and compare it directly to VersionString to check version - a small
// mistake that would cause a pre-2.14 executable to barf reading a database
// written by 2.14 and later.
// #idef-ing this out, while correcting the code
// in ReadV2Header. Perhaps this can be fixed a year from now?
#ifdef BREAK_PRE_2_14_COMPATIBILITY
unsigned int rlen = RangeRand(62) + 2; // 64 is a trade-off...
char *rbuf = new char[rlen];
PWSrand::GetInstance()->GetRandomData(rbuf, rlen-1);
rbuf[rlen-1] = TCHAR('\0'); // although zero may be there before - who cares?
stringT rname(V2ItemName);
rname += rbuf;
delete[] rbuf;
header.SetName(rname, _T(""));
#else
header.SetName(V2ItemName, _T(""));
#endif /* BREAK_PRE_2_14_COMPATIBILITY */
header.SetPassword(VersionString);
header.SetNotes(m_hdr.m_prefString);
// need to fallback to V17, since the record
// won't be readable otherwise!
VERSION sv = m_curversion;
m_curversion = V17;
int status = WriteRecord(header);
// restore after writing V17-format header
m_curversion = sv;
m_hdr.m_nCurrentMajorVersion = 2;
m_hdr.m_nCurrentMinorVersion = 0;
return status;
}
示例2: LoadStringItem
void CWorld::LoadStringItem()
{
StringLoader* pLoader = StringLoader::getSingleton();
CUIManager* pUIManager = CUIManager::getSingleton();
if (pLoader == NULL)
return;
pLoader->LoadString(eSTRING_ITEM, g_iCountry);
int nIdx;
const char* strtmp = NULL;
CItemData::_map::iterator iter = CItemData::_mapdata.begin();
CItemData::_map::iterator eiter = CItemData::_mapdata.end();
for (;iter != eiter; ++iter)
{
CItemData* pItem = (*iter).second;
if (pItem == NULL)
continue;
nIdx = pItem->getindex();
if (nIdx >= 0)
{
strtmp = pLoader->getData(eSTRING_ITEM, nIdx, 0);
if (strtmp != NULL)
pItem->SetName( strtmp );
else
pUIManager->SetNoTranslateFlag( TRANS_NAME, &pItem->GetTransFlag() );
strtmp = pLoader->getData(eSTRING_ITEM, nIdx, 1);
if (strtmp != NULL)
pItem->SetDesc( strtmp );
else
pUIManager->SetNoTranslateFlag( TRANS_DESC, &pItem->GetTransFlag() );
if( pItem->GetTransFlag() > 0 ) //[sora] 미번역 스트링 index 표시
pUIManager->SetNoTranslationString( ITEM_STRING, pItem->GetItemIndex() );
}
}
pLoader->release(eSTRING_ITEM);
}
示例3: ASSERT
int PWSfileV1V2::ReadRecord(CItemData &item)
{
ASSERT(m_fd != NULL);
ASSERT(m_curversion != UNKNOWN_VERSION);
StringX tempdata;
signed long numread = 0;
unsigned char type;
switch (m_curversion) {
case V17:
{
// type is meaningless, but why write two versions of ReadCBC?
numread += static_cast<signed long>(ReadCBC(type, tempdata));
item.SetName(tempdata, m_defusername);
numread += static_cast<signed long>(ReadCBC(type, tempdata));
item.SetPassword(tempdata);
numread += static_cast<signed long>(ReadCBC(type, tempdata));
item.SetNotes(tempdata);
// No UUID, so we create one here
item.CreateUUID();
// No Group - currently leave empty
return (numread > 0) ? SUCCESS : END_OF_FILE;
}
case V20:
{
int emergencyExit = 255; // to avoid endless loop.
signed long fieldLen; // zero means end of file reached
bool endFound = false; // set to true when record end detected - happy end
do {
fieldLen = static_cast<signed long>(ReadCBC(type, tempdata));
if (signed(fieldLen) > 0) {
numread += fieldLen;
switch (type) {
case CItemData::TITLE:
item.SetTitle(tempdata); break;
case CItemData::USER:
item.SetUser(tempdata); break;
case CItemData::PASSWORD:
item.SetPassword(tempdata); break;
case CItemData::NOTES:
{
StringX autotypeStr, URLStr;
ExtractAutoTypeCmd(tempdata, autotypeStr);
ExtractURL(tempdata, URLStr);
item.SetNotes(tempdata);
if (!autotypeStr.empty())
item.SetAutoType(autotypeStr);
if (!URLStr.empty())
item.SetURL(URLStr);
break;
}
case CItemData::END:
endFound = true; break;
case CItemData::UUID:
{
LPCTSTR ptr = tempdata.c_str();
uuid_array_t uuid_array;
for (size_t i = 0; i < sizeof(uuid_array_t); i++)
uuid_array[i] = static_cast<unsigned char>(ptr[i]);
item.SetUUID(uuid_array);
break;
}
case CItemData::GROUP:
item.SetGroup(tempdata); break;
// just silently ignore fields we don't support.
// this is forward compatability...
case CItemData::CTIME:
case CItemData::PMTIME:
case CItemData::ATIME:
case CItemData::XTIME:
case CItemData::RMTIME:
case CItemData::POLICY:
case CItemData::XTIME_INT:
default:
break;
} // switch
} // if (fieldLen > 0)
} while (!endFound && fieldLen > 0 && --emergencyExit > 0);
return (numread > 0 && endFound) ? SUCCESS : END_OF_FILE;
}
default:
ASSERT(0);
return UNSUPPORTED_VERSION;
}
}