本文整理汇总了C++中String_256::IsEmpty方法的典型用法代码示例。如果您正苦于以下问题:C++ String_256::IsEmpty方法的具体用法?C++ String_256::IsEmpty怎么用?C++ String_256::IsEmpty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类String_256
的用法示例。
在下文中一共展示了String_256::IsEmpty方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Parse
BOOL WebAddress::Parse(const String_256& InString)
{
//First set all the member strings to zero.
Absolute=FALSE;
Scheme.Empty();
NetLoc.Empty();
Path.Empty();
Parameters.Empty();
Query.Empty();
Fragment.Empty();
Scheme.Empty();
//If InString="", that's all we need to do...
if (InString.IsEmpty())
return TRUE;
//And set up a couple of strings we can play around with
String_256 StringToParse=InString;
//If the parse string is empty, we need do nothing, because all our fields are
//already blank. Return TRUE.
if (StringToParse.IsEmpty()) return TRUE;
//Now set up some strings. These are all hard coded cos it reduces code size
//This shouldn't matter for purposes of internationalisation, because URLs
//are an international system.
String_256 sNetloc="//";
INT32 iLowerCaseA=INT32 ('a');
INT32 iLowerCaseZ=INT32 ('z');
INT32 iUpperCaseA=INT32 ('A');
INT32 iUpperCaseZ=INT32 ('Z');
char cBackslash='\\';
char cSlash='/';
char cHash='#';
char cColon=':';
char cQuestionmark='?';
char cSemicolon=';';
//First we want to find the Fragment section of the URL.
//This should start with a #
INT32 iFound=StringToParse.FindNextChar(cHash);
//If we've found a #, copy the whole identifier into the "fragment" member variable
if(iFound>=0)
StringToParse.Split(&StringToParse, &Fragment, iFound, FALSE);
//Now search the parse string for a scheme (the bit at the start,
//e.g. http:). To do this we search for a colon.
iFound=StringToParse.FindNextChar(cColon);
//Have we found a colon?
if(iFound>=0)
{
BOOL IsAScheme=TRUE;
//Yes. We now need to check that everything before that colon is a letter.
for (INT32 iStringPtr=(iFound-1); iStringPtr>=0; iStringPtr--)
{
if (!StringBase::IsAlpha(StringToParse[iStringPtr]))
{
IsAScheme=FALSE;
}
}
//Was everything before the colon a letter?
if (IsAScheme)
//Yes, so split the string after that colon
StringToParse.Split(&Scheme, &StringToParse, iFound, TRUE);
}
//Now look for a network location
iFound=StringToParse.Sub(sNetloc);
//Have we found a //?
if(iFound>=0)
{
//Yes. So find the next / (or the end of the string)
//To do this, set up a string pointer that starts from two
//characters after iFound
INT32 iStringPtr=iFound+2;
//And move that string pointer forwards until
//either it points at a slash or it reaches the end of the
//string
while (iStringPtr<StringToParse.Length() && StringToParse[iStringPtr]!=cSlash)
{
iStringPtr++;
}
StringToParse.Split(&NetLoc, &StringToParse, iStringPtr, FALSE);
}
//Now look for query information.
iFound=StringToParse.FindNextChar(cQuestionmark);
//.........这里部分代码省略.........
示例2: LoadFile
BOOL OpMenuLoad::LoadFile(CCLexFile* pFileToLoad, UINT32 nPrefFilter)
{
// Make sure we have a valid file to load.
/* TRACEUSER( "JustinF", _T("In OpMenuLoad::LoadFile(%p, %u)\n"),
(LPVOID) pFileToLoad, nPrefFilter);
*/ ERROR3IF(!pFileToLoad, "Null CCLexFile* in OpMenuLoad::LoadFile");
// Find out the position of the filter selected by the user in the open dialog
INT32 SelectedPos = 0;
#if !defined(EXCLUDE_FROM_RALPH) && !defined(EXCLUDE_FROM_XARALX)
SelectedPos = BaseFileDialog::SelectedFilter;
#endif
// Go get the first filter in the list
Filter* pFilter = Filter::GetFirst();
// Do we know which filter was used? (we know nothing about things in the recent file
// list). If we don't, then use the preferred one, by default the generic filter.
if (nPrefFilter != FILTERID_USERCHOICE || SelectedPos == 0)
{
// We know nothing. We will have to go and have a look at all the possibles
// We will find the Filter Family and ask it to try and load the file.
UINT32 nID = (nPrefFilter != FILTERID_USERCHOICE) ? nPrefFilter : FILTERID_GENERIC;
while (pFilter != NULL && pFilter->FilterID != nID)
{
// Try the next filter
pFilter = Filter::GetNext(pFilter);
}
}
else
{
// We know which type of filter the user had selected in the file dialog
// Find the filter that the user chose.
while (pFilter != NULL)
{
// This is the filter?
if (pFilter->GetFlags().CanImport &&
pFilter->pOILFilter->Position == SelectedPos)
break;
// Try the next filter
pFilter = Filter::GetNext(pFilter);
}
}
// Check that the Filter existed
if (pFilter == NULL)
{
// It did not...
InformError(_R(IDT_CANT_FIND_FILTER));
return FALSE;
}
// Get pointer to current doc 'cos we'll need it several times...
Document* pCurDoc = Document::GetCurrent();
// If this is not a filter family, check for compatibility before asking
// filter to load the file.
// This means the user has chosen an explicit filter to handle the import
PathName Path = pFileToLoad->GetPathName();
String_256 FilePath = Path.GetPath();
// FilePath will be null if a pathname is not valid
if (!pFilter->IS_KIND_OF(FilterFamily) && !FilePath.IsEmpty())
{
UINT32 Size = 1024;
size_t FileSize;
ADDR FilterBuf = pFilter->LoadInitialSegment(Path, &Size, &FileSize);
// If there has been a problem in the load initial segment then fail now.
if (FilterBuf == NULL)
{
// Tell the user about the problem and get out now while the goings good
InformError();
return FALSE;
}
// Inform any filters that we are about to do a HowCompatible call.
// This would allow a set of filters which have common functionality hidden in a
// filter that cannot import and cannot export handle this call and hence set
// itself up. This would allow it to maybe cache a result which should only be
// checked by the first filter in the group.
pFilter->PreHowCompatible();
// Change this to be less than 8 as the filters like the Accusoft forms return
// 8 and 9 to make sure that they are last in the chain.
if (pFilter->HowCompatible(Path, FilterBuf, Size, UINT32(FileSize)) < 8)
{
// Not 100% happy with this file - ask for confirmation.
ErrorInfo Question;
Question.ErrorMsg = _R(IDW_OPENQUERY_NOTSURE);
Question.Button[0] = _R(IDB_OPENQUERY_OPEN);
Question.Button[1] = _R(IDB_OPENQUERY_DONTOPEN);
if ((ResourceID)AskQuestion(&Question) != _R(IDB_OPENQUERY_OPEN))
{
// User asked for this to be cancelled.
TRACEUSER( "Tim", _T("Filter compatibility was less than 10\n"));
// Close the file, report the abort and finish.
//.........这里部分代码省略.........