本文整理汇总了C++中CString::IsBlank方法的典型用法代码示例。如果您正苦于以下问题:C++ CString::IsBlank方法的具体用法?C++ CString::IsBlank怎么用?C++ CString::IsBlank使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CString
的用法示例。
在下文中一共展示了CString::IsBlank方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: WriteModuleImages
ALERROR WriteModuleImages (CXMLElement *pModule, const CString &sFolder, CSymbolTable &Resources, CDataFile &Out)
{
ALERROR error;
int i;
for (i = 0; i < pModule->GetContentElementCount(); i++)
{
CXMLElement *pItem = pModule->GetContentElement(i);
if (strEquals(pItem->GetTag(), TAG_IMAGES))
{
CString sSubFolder = pathAddComponent(sFolder, pItem->GetAttribute(ATTRIB_FOLDER));
if (error = WriteModuleImages(pItem, sSubFolder, Resources, Out))
return error;
}
else if (strEquals(pItem->GetTag(), TAG_IMAGE))
{
CString sFilename = pItem->GetAttribute(ATTRIB_BITMAP);
if (!sFilename.IsBlank())
{
if (error = WriteResource(sFilename, sFolder, Resources, Out))
continue;
}
sFilename = pItem->GetAttribute(ATTRIB_BITMASK);
if (!sFilename.IsBlank())
{
if (error = WriteResource(sFilename, sFolder, Resources, Out))
continue;
}
}
}
return NOERROR;
}
示例2: LoadFromXML
ALERROR CRandomItems::LoadFromXML (SDesignLoadCtx &Ctx, CXMLElement *pDesc)
// LoadFromXML
//
// Load from XML
{
ALERROR error;
CString sCriteria = pDesc->GetAttribute(CRITERIA_ATTRIB);
if (sCriteria.IsBlank())
{
CString sAttributes = pDesc->GetAttribute(ATTRIBUTES_ATTRIB);
if (sAttributes.IsBlank())
sAttributes = pDesc->GetAttribute(MODIFIERS_ATTRIB);
sCriteria = strPatternSubst(CONSTLIT("%s %s"), pDesc->GetAttribute(CATEGORIES_ATTRIB), sAttributes);
}
CItem::ParseCriteria(sCriteria, &m_Criteria);
m_sLevelFrequency = pDesc->GetAttribute(LEVEL_FREQUENCY_ATTRIB);
m_iLevel = pDesc->GetAttributeInteger(LEVEL_ATTRIB);
m_iLevelCurve = pDesc->GetAttributeInteger(LEVEL_CURVE_ATTRIB);
m_iDamaged = pDesc->GetAttributeInteger(DAMAGED_ATTRIB);
if (error = m_Enhanced.InitFromXML(Ctx, pDesc))
return error;
m_Table = NULL;
m_iCount = 0;
return NOERROR;
}
示例3: WriteModuleImages
ALERROR WriteModuleImages (CTDBCompiler &Ctx, CXMLElement *pModule, const CString &sFolder, CDataFile &Out)
{
ALERROR error;
int i;
for (i = 0; i < pModule->GetContentElementCount(); i++)
{
CXMLElement *pItem = pModule->GetContentElement(i);
if (strEquals(pItem->GetTag(), TAG_IMAGES))
{
CString sSubFolder = pathAddComponent(sFolder, pItem->GetAttribute(ATTRIB_FOLDER));
if (error = WriteModuleImages(Ctx, pItem, sSubFolder, Out))
return error;
}
else if (strEquals(pItem->GetTag(), TAG_IMAGE))
{
CString sFilename = pItem->GetAttribute(ATTRIB_BITMAP);
if (!sFilename.IsBlank())
{
bool bCompress = strEquals(strToLower(pathGetExtension(sFilename)), CONSTLIT("bmp"));
if (error = WriteResource(Ctx, sFilename, sFolder, bCompress, Out))
continue;
}
sFilename = pItem->GetAttribute(ATTRIB_BITMASK);
if (!sFilename.IsBlank())
{
bool bCompress = strEquals(strToLower(pathGetExtension(sFilename)), CONSTLIT("bmp"));
if (error = WriteResource(Ctx, sFilename, sFolder, bCompress, Out))
continue;
}
sFilename = pItem->GetAttribute(ATTRIB_SHADOW_MASK);
if (!sFilename.IsBlank())
{
bool bCompress = strEquals(strToLower(pathGetExtension(sFilename)), CONSTLIT("bmp"));
if (error = WriteResource(Ctx, sFilename, sFolder, bCompress, Out))
continue;
}
sFilename = pItem->GetAttribute(ATTRIB_HIT_MASK);
if (!sFilename.IsBlank())
{
bool bCompress = strEquals(strToLower(pathGetExtension(sFilename)), CONSTLIT("bmp"));
if (error = WriteResource(Ctx, sFilename, sFolder, bCompress, Out))
continue;
}
}
}
return NOERROR;
}
示例4: OnEffectCreateFromXML
ALERROR CFlareEffectCreator::OnEffectCreateFromXML (SDesignLoadCtx &Ctx, CXMLElement *pDesc, const CString &sUNID)
// OnEffectCreateFromXML
//
// Initializes from XML
{
CString sStyle = pDesc->GetAttribute(STYLE_ATTRIB);
if (strEquals(sStyle, STYLE_FADING_BLAST))
m_iStyle = styleFadingBlast;
else if (strEquals(sStyle, STYLE_FLICKER))
m_iStyle = styleFlicker;
else if (sStyle.IsBlank() || strEquals(sStyle, STYLE_PLAIN))
m_iStyle = stylePlain;
else
{
Ctx.sError = strPatternSubst(CONSTLIT("Invalid Flare style: %s"), sStyle);
return ERR_FAIL;
}
m_iRadius = pDesc->GetAttributeIntegerBounded(RADIUS_ATTRIB, 0, -1, 100);
m_iLifetime = pDesc->GetAttributeIntegerBounded(LIFETIME_ATTRIB, 0, -1, 1);
m_rgbPrimaryColor = ::LoadRGBColor(pDesc->GetAttribute(PRIMARY_COLOR_ATTRIB));
CString sAttrib;
if (pDesc->FindAttribute(SECONDARY_COLOR_ATTRIB, &sAttrib))
m_rgbSecondaryColor = ::LoadRGBColor(sAttrib);
else
m_rgbSecondaryColor = m_rgbPrimaryColor;
return NOERROR;
}
示例5: OnUserSignedIn
void CMultiverseModel::OnUserSignedIn (const CString &sUsername)
// OnUserSignedIn
//
// The given user has signed in. The given username is the human-readable
// username (not the username key).
{
CSmartLock Lock(m_cs);
ASSERT(!sUsername.IsBlank());
if (!strEquals(sUsername, m_sUsername) || !m_fUserSignedIn)
{
m_sUsername = sUsername;
// Clear out the collection so that we are forced to reload it.
DeleteCollection();
// We're signed in
m_fUserSignedIn = true;
}
}
示例6: AddEntryPermutations
void CSystemCreateStats::AddEntryPermutations (const CString &sPrefix, const TArray<CString> &Attribs, int iPos)
// AddEntryPermutations
//
// Adds permutions
{
// If nothing, then nothing
if (iPos >= Attribs.GetCount())
return;
// Get the base case
CString sNewPrefix;
if (!sPrefix.IsBlank())
sNewPrefix = strPatternSubst(CONSTLIT("%s,%s"), sPrefix, Attribs[iPos]);
else
sNewPrefix = Attribs[iPos];
AddEntry(sNewPrefix);
// Permute with the base case
AddEntryPermutations(sNewPrefix, Attribs, iPos + 1);
// Permute the remainder
AddEntryPermutations(sPrefix, Attribs, iPos + 1);
}
示例7: ParseLinkedFireOptions
ALERROR CDeviceClass::ParseLinkedFireOptions (SDesignLoadCtx &Ctx, const CString &sDesc, DWORD *retdwOptions)
// ParseLinkedFireOptions
//
// Parses a linked-fire options string.
{
DWORD dwOptions = 0;
if (sDesc.IsBlank())
;
else if (strEquals(sDesc, LINKED_FIRE_ALWAYS))
dwOptions |= CDeviceClass::lkfAlways;
else if (strEquals(sDesc, LINKED_FIRE_TARGET))
dwOptions |= CDeviceClass::lkfTargetInRange;
else if (strEquals(sDesc, LINKED_FIRE_ENEMY))
dwOptions |= CDeviceClass::lkfEnemyInRange;
else
{
Ctx.sError = strPatternSubst(CONSTLIT("Invalid linkedFire option: %s"), sDesc);
return ERR_FAIL;
}
*retdwOptions = dwOptions;
return NOERROR;
}
示例8: SelectByCriteria
void SelectByCriteria (SItemTableCtx &Ctx, const CString &sCriteria, TArray<CItemType *> *retList)
{
int i;
// Compute the criteria
CItemCriteria Crit;
if (!sCriteria.IsBlank())
CItem::ParseCriteria(sCriteria, &Crit);
else
CItem::InitCriteriaAll(&Crit);
// Loop over all items that match and add them to
// a sorted table.
retList->DeleteAll();
for (i = 0; i < Ctx.pUniverse->GetItemTypeCount(); i++)
{
CItemType *pType = Ctx.pUniverse->GetItemType(i);
CItem Item(pType, 1);
if (!Item.MatchesCriteria(Crit))
continue;
retList->Insert(pType);
}
}
示例9: pathAddComponent
CString pathAddComponent (const CString &sPath, const CString &sComponent)
// pathAddComponent
//
// Concatenates the given component to the given path and returns
// the result
//
// sPath: full pathname to a directory (e.g. "c:\", "\\lawrence\cdrom", "d:\test")
// sComponent: directory, filename, or wildcard.
{
CString sResult = sPath;
int iPathLength = sResult.GetLength();
char *pString = sResult.GetASCIIZ();
// If the path name does not have a trailing backslash, add one
if (!sPath.IsBlank() && pString[iPathLength-1] != '\\')
sResult.Append(STR_PATH_SEPARATOR);
// Now concatenate the component
sResult.Append(sComponent);
return sResult;
}
示例10: CreateBinaryFromList
bool CreateBinaryFromList (CCodeChain &CC, const CString &sClass, ICCItem *pList, void *pvDest)
// CreateBinaryFromList
//
// Initializes binary structure from a list
{
int iStart = 0;
// Check the class, if provided
if (!sClass.IsBlank())
{
if (pList->GetCount() < 1)
return false;
if (!strEquals(pList->GetElement(0)->GetStringValue(), sClass))
return false;
iStart++;
}
// Load the binary data
DWORD *pDest = (DWORD *)pvDest;
for (int i = iStart; i < pList->GetCount(); i++)
*pDest++ = (DWORD)pList->GetElement(i)->GetIntegerValue();
return true;
}
示例11: OutputImage
bool OutputImage (CG16bitImage &Image, const CString &sFilespec)
{
if (!sFilespec.IsBlank())
{
if (Image.SaveAsWindowsBMP(sFilespec) != NOERROR)
{
printf("Unable to save to '%s'\n", sFilespec.GetASCIIZPointer());
return false;
}
printf("%s\n", sFilespec.GetASCIIZPointer());
}
// Otherwise, clipboard
else
{
if (Image.CopyToClipboard() != NOERROR)
{
printf("Unable to copy to clipboard.\n");
return false;
}
printf("Image copied to clipboard.\n");
}
// Done
return true;
}
示例12: LoadImagesElement
ALERROR CExtension::LoadImagesElement (SDesignLoadCtx &Ctx, CXMLElement *pDesc)
// LoadImagesElement
//
// Loads <Images> element
// (For backwards compatibility)
{
ALERROR error;
int i;
// Figure out if we've got a special folder for the images
CString sOldFolder = Ctx.sFolder;
CString sFolder = pDesc->GetAttribute(FOLDER_ATTRIB);
if (!sFolder.IsBlank())
Ctx.sFolder = pathAddComponent(Ctx.sFolder, sFolder);
// Load all images
for (i = 0; i < pDesc->GetContentElementCount(); i++)
{
CXMLElement *pItem = pDesc->GetContentElement(i);
if (error = LoadDesignType(Ctx, pItem))
return error;
}
// Restore folder
Ctx.sFolder = sOldFolder;
return NOERROR;
}
示例13: CreateFromXML
ALERROR CEffectCreator::CreateFromXML (SDesignLoadCtx &Ctx, CXMLElement *pDesc, const CString &sUNID, CEffectCreator **retpCreator)
// CreateFromXML
//
// Creates the creator from an XML element
{
ALERROR error;
CEffectCreator *pCreator;
// Basic info
CString sEffectUNID = sUNID;
if (sEffectUNID.IsBlank())
{
DWORD dwUNID = pDesc->GetAttributeInteger(UNID_ATTRIB);
if (dwUNID)
sEffectUNID = strFromInt(dwUNID, FALSE);
else
sEffectUNID = STR_NO_UNID;
}
// Create the effect based on the child tag
if (pDesc->GetContentElementCount() == 0)
{
*retpCreator = NULL;
return NOERROR;
}
else if (pDesc->GetContentElementCount() == 1)
{
if (error = CreateSimpleFromXML(Ctx, pDesc->GetContentElement(0), sEffectUNID, &pCreator))
return error;
}
else
{
pCreator = new CEffectGroupCreator;
if (pCreator == NULL)
return ERR_MEMORY;
pCreator->m_sUNID = sEffectUNID;
// Type-specific creation
if (error = pCreator->OnEffectCreateFromXML(Ctx, pDesc, sEffectUNID))
return error;
}
// Sound Effect (resolved later)
pCreator->m_dwSoundUNID = pDesc->GetAttributeInteger(SOUND_ATTRIB);
pCreator->m_iSound = -1;
// Done
*retpCreator = pCreator;
return NOERROR;
}
示例14: LoadFromXML
ALERROR CGroupOfGenerators::LoadFromXML (SDesignLoadCtx &Ctx, CXMLElement *pDesc)
// LoadFromXML
//
// Load from XML
{
int i;
ALERROR error;
// Load content elements
m_Table.InsertEmpty(pDesc->GetContentElementCount());
for (i = 0; i < m_Table.GetCount(); i++)
{
CXMLElement *pEntry = pDesc->GetContentElement(i);
m_Table[i].iChance = pEntry->GetAttributeInteger(CHANCE_ATTRIB);
if (m_Table[i].iChance == 0)
m_Table[i].iChance = 100;
CString sCount = pEntry->GetAttribute(COUNT_ATTRIB);
if (sCount.IsBlank())
m_Table[i].Count = DiceRange(0, 0, 1);
else
m_Table[i].Count.LoadFromXML(sCount);
if (error = IItemGenerator::CreateFromXML(Ctx, pEntry, &m_Table[i].pItem))
return error;
}
// See if we force an average value
CString sAttrib;
if (pDesc->FindAttribute(LEVEL_VALUE_ATTRIB, &sAttrib))
{
TArray<int> Values;
ParseIntegerList(sAttrib, 0, &Values);
m_AverageValue.InsertEmpty(MAX_ITEM_LEVEL + 1);
m_AverageValue[0] = 0;
for (i = 0; i < Values.GetCount(); i++)
m_AverageValue[i + 1] = Values[i];
for (i = Values.GetCount() + 1; i <= MAX_ITEM_LEVEL; i++)
m_AverageValue[i] = 0;
}
else if (pDesc->FindAttribute(VALUE_ATTRIB, &sAttrib))
{
int iValue = strToInt(sAttrib, 0);
m_AverageValue.InsertEmpty(MAX_ITEM_LEVEL + 1);
m_AverageValue[0] = 0;
for (i = 1; i <= MAX_ITEM_LEVEL; i++)
m_AverageValue[i] = iValue;
}
return NOERROR;
}
示例15: GetTypeDesc
CString GetTypeDesc (CDesignType *pType)
{
CString sName = pType->GetTypeName();
if (sName.IsBlank())
return strPatternSubst(CONSTLIT("%08x: [%s]"), pType->GetUNID(), pType->GetTypeClassName());
else
return strPatternSubst(CONSTLIT("%08x: %s [%s]"), pType->GetUNID(), sName, pType->GetTypeClassName());
}