本文整理汇总了C++中Stream::Delete方法的典型用法代码示例。如果您正苦于以下问题:C++ Stream::Delete方法的具体用法?C++ Stream::Delete怎么用?C++ Stream::Delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Stream
的用法示例。
在下文中一共展示了Stream::Delete方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CompressModHdr
////////////////////////////////////////////////////////////////
//
// CompressModHdr()
//
// compressing module header array (m_rgModHdr) and do
// a consistency check.
// If the header has a 0 reference, it will remove the stream
// NOTE:
// It is STRONGLY recommended to do a CompressTarget (for
// all targets) before calling this function, since
// it can substantially speed up the function
/////////////////////////////////////////////////////////////////
BOOL Ncb::CompressModHdr(PDB * pdb)
{
BOOL * rgModRef;
USHORT * rgMap;
unsigned i,j;
unsigned cModHdr = m_rgModHdr.size();
unsigned cNewModHdr;
unsigned cTarget;
unsigned cMod;
Stream * pstmMod;
rgModRef = new BOOL [cModHdr];
rgMap = new USHORT [cModHdr];
if (!rgModRef)
return FALSE;
if (!rgMap)
return FALSE;
for (i = 0; i < cModHdr; i++)
rgModRef[i] = FALSE; // initialize values to FALSE
// iterate every target array to count the
// total number of reference of each module
cTarget = m_rgTargetInfo.size();
for (i = 0; i < cTarget; i++)
{
cMod = m_rgTargetInfo[i].m_rgModInfo.size();
// check every module in a target
for (j = 0; j < cMod; j++)
rgModRef[m_rgTargetInfo[i].m_rgModInfo[j].m_iModHdr] = TRUE;
}
// now build the map from old index to new index
cNewModHdr = 0;
for (i = 0; i < cModHdr; i++)
{
if (rgModRef[i] == FALSE)
{
// remove the info from the stream
char buf[512];
SZ szMod = szFrNi (m_rgModHdr[i].m_ni);
strcpy (buf, SZ_NCB_MODULE_PREFIX);
strcat (buf, szMod);
// REVIEW: is this how to delete a stream??
if (pdb->OpenStream (buf, &pstmMod))
{
pstmMod->Delete();
pstmMod->Release();
pstmMod = NULL;
}
// mark the map as invalid
rgMap[i] = (USHORT)-1;
}
else // ref. count is greater than 0
{
// set a new map to use
rgMap[i] = cNewModHdr;
// copy the information to the new position
if (i != cNewModHdr)
m_rgModHdr[cNewModHdr] = m_rgModHdr[i];
// increment the counter
cNewModHdr++;
}
}
// set the new size for module header:
m_rgModHdr.setSize (cNewModHdr+1);
// now fix up the module list for each target
for (i = 0; i < cTarget; i++)
{
cMod = m_rgTargetInfo[i].m_rgModInfo.size();
// check every module in a target
for (j = 0; j < cMod; j++)
{
_ASSERT (rgMap[m_rgTargetInfo[i].m_rgModInfo[j].m_iModHdr] != (USHORT)-1);
m_rgTargetInfo[i].m_rgModInfo[j].m_iModHdr =
rgMap[m_rgTargetInfo[i].m_rgModInfo[j].m_iModHdr];
}
}
return TRUE;
};
示例2: BuildId
BOOL
MRE::FCloseCompiland ( PMREFile pmrefile, BOOL fCommit ) {
assert ( m_pmrefRoot );
assert ( pmrefile == m_pmrefRoot );
_TCHAR szStreamName[ ctchMrePathMax ];
Stream * pstream;
BOOL fRet = fFalse;
if ( m_mrelog.FLogging() ) {
m_mrelog.LogNote (
"Note: '%s' deps will %sbe committed.\n",
SzFromNi ( m_pmrefRoot->Ni() ),
fCommit ? "" : "not "
);
m_mrelog.LogSep();
}
if ( fCommit ) {
_sntprintf (
szStreamName,
countof(szStreamName),
c_szMreFileFmt,
m_pmrefRoot->Ni()
);
// if we haven't hit all the classes that were noted as mr detectable,
// we need to rude out those classes.
Array<NI> & rgni = m_pmrefRoot->RgNiClassesChanged();
unsigned iniMax = rgni.size();
for ( unsigned ini = 0; ini < iniMax; ini++ ) {
if ( rgni[ ini ] != niNil ) {
// a class we didn't see a different type id for...
PCI pci;
if ( FClassInfoFromNi ( rgni[ ini ], &pci ) ) {
// we have to promote all nested types to rude.
NoteRudeNestedClasses ( pci->Ti() );
}
}
}
if ( m_ppdb->OpenStream ( szStreamName, &pstream ) ) {
// if we need to merge the class dependency data, we need
// to read in the old stream first...
if ( !m_pmrefRoot->FAllCodeCompiled() ) {
MRFIBuf mrfibufT;
mrfibufT.SetPmre ( this );
if ( mrfibufT.FInitFromStream ( pstream ) ) {
assert ( mrfibufT.Pmrfi()->niFile == m_pmrefRoot->Ni() );
m_mrfibufRoot.FmergeClassDeps ( mrfibufT );
}
}
if ( m_mrfibufRoot.FReplaceStream ( pstream ) ) {
fRet = fTrue;
}
else {
pstream->Delete();
}
pstream->Release();
}
if ( fRet ) {
// if everything is ok for the gen'ed dependencies, we
// need to update the build # in the file info stream
PFI pfi = NULL;
verify ( m_mpnifi.map ( m_pmrefRoot->Ni(), &pfi ) );
if ( pfi ) {
pfi->SetBuildId ( BuildId() );
verify ( m_mpnifi.map ( pfi->NiRelated(), &pfi ) );
if ( pfi ) {
pfi->SetBuildId ( BuildId() );
}
}
}
}
else {
fRet = fTrue;
}
delete m_pmrefRoot;
m_pmrefRoot = NULL;
return fRet;
}