本文整理汇总了C++中StringList::IsEmpty方法的典型用法代码示例。如果您正苦于以下问题:C++ StringList::IsEmpty方法的具体用法?C++ StringList::IsEmpty怎么用?C++ StringList::IsEmpty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StringList
的用法示例。
在下文中一共展示了StringList::IsEmpty方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: EvaluationException
StringList
Include::Evaluate(EvaluationContext& context)
{
// check include depth
size_t includeDepth = context.IncludeDepth();
if (includeDepth >= util::kIncludeDepthLimit) {
std::stringstream message;
message << "Reached include depth limit ("
<< util::kIncludeDepthLimit << ")";
throw EvaluationException(message.str());
}
context.SetIncludeDepth(includeDepth + 1);
StringList fileNames = fFileNames->Evaluate(context);
if (!fileNames.IsEmpty()) {
// Only the file referred to by the first element is included.
// bind the target
data::Target* target
= context.Targets().LookupOrCreate(fileNames.ElementAt(0));
String filePath;
data::FileStatus fileStatus;
data::TargetBinder::Bind(*context.GlobalVariables(), target, filePath,
fileStatus);
// open the file
std::ifstream file(filePath.ToCString());
if (file.fail()) {
if (target->IsIgnoreIfMissing())
return StringList::False();
throw EvaluationException(
std::string("include: Failed to open file \"")
+ filePath.ToCString() + "\"");
}
// parse and evaluate it
parser::Parser parser;
parser.SetFileName(filePath.ToStlString());
util::Reference<code::Block> block(parser.Parse(file), true);
block->Evaluate(context);
if (context.GetJumpCondition() == JUMP_CONDITION_JUMP_TO_EOF)
context.SetJumpCondition(JUMP_CONDITION_NONE);
}
// reset include depth
context.SetIncludeDepth(includeDepth);
return StringList::False();
}
示例2: LoadFiltersFromGlobalString
void LoadFiltersFromGlobalString( const IsoString& globalKey )
{
filters.Clear();
String s = PixInsightSettings::GlobalString( globalKey );
if ( !s.IsEmpty() )
{
for ( size_type p = 0; ; )
{
size_type p1 = s.Find( '(', p );
if ( p1 == String::notFound )
break;
size_type p2 = s.Find( ')', p1 );
if ( p2 == String::notFound )
break;
String extStr = s.Substring( p1, p2-p1 );
if ( !extStr.IsEmpty() )
{
StringList extLst;
extStr.Break( extLst, ' ', true );
if ( !extLst.IsEmpty() )
{
FileFilter filter;
for ( StringList::const_iterator i = extLst.Begin(); i != extLst.End(); ++i )
{
size_type d = i->Find( '.' );
if ( d != String::notFound )
filter.AddExtension( i->Substring( d ) );
}
if ( !filter.Extensions().IsEmpty() )
{
String desc = s.Substring( p, p1-p );
desc.Trim();
filter.SetDescription( desc );
filters.Add( filter );
}
}
}
p = p2 + 1;
}
}
}
示例3: parts
StringList
StringListOperations::Apply(const StringList& inputList, size_t maxSize,
const behavior::Behavior& behavior) const
{
if (!HasOperations())
return inputList.SubList(0, maxSize);
uint32_t operations = fOperations;
bool hasSelectorOperation = (operations & PATH_PART_SELECTOR_MASK) != 0;
bool hasPathPartOperation = hasSelectorOperation
|| (operations & (PATH_PART_REPLACER_MASK | TO_PARENT_DIRECTORY)) != 0;
if (hasPathPartOperation && !hasSelectorOperation) {
// Only replacer operations. Continue as if all path parts are selected.
operations |= PATH_PART_SELECTOR_MASK;
}
// If a join shall be performed before to-upper/to-lower, we simply convert
// the join parameter first and join as usual afterwards.
String joinParameterBuffer;
StringPart joinParameter = fJoinParameter;
if (!joinParameter.IsEmpty()
&& (operations & (TO_UPPER | TO_LOWER)) != 0
&& behavior.GetJoinCaseOperator()
== behavior::Behavior::JOIN_BEFORE_CASE_OPERATOR) {
joinParameterBuffer = joinParameter;
if ((operations & TO_UPPER) != 0)
joinParameterBuffer.ToUpper();
else
joinParameterBuffer.ToLower();
joinParameter = joinParameterBuffer;
}
StringList resultList;
StringBuffer buffer;
const StringList& list
= inputList.IsEmpty() && (operations & REPLACE_EMPTY) != 0
? StringList(String(fEmptyParameter)) : inputList;
size_t count = std::min(list.Size(), maxSize);
for (size_t i = 0; i < count; i++) {
String string = list.ElementAt(i);
size_t bufferSizeBeforeElement = buffer.Length();
// If any of the file name/path part selectors/replacers need to be
// applied, we disassemble the string, make the modifications, and
// reassemble it.
if (hasPathPartOperation) {
Path::Parts parts(string);
if ((operations & REPLACE_GRIST) != 0)
parts.SetGrist(fGristParameter);
else if ((operations & SELECT_GRIST) == 0)
parts.UnsetGrist();
if ((operations & REPLACE_ROOT) != 0)
parts.SetRoot(fRootParameter);
else if ((operations & SELECT_ROOT) == 0)
parts.UnsetRoot();
if ((operations & REPLACE_DIRECTORY) != 0)
parts.SetDirectory(fDirectoryParameter);
else if ((operations & SELECT_DIRECTORY) == 0)
parts.UnsetDirectory();
if ((operations & REPLACE_BASE_NAME) != 0)
parts.SetBaseName(fBaseNameParameter);
else if ((operations & SELECT_BASE_NAME) == 0)
parts.UnsetBaseName();
if ((operations & REPLACE_SUFFIX) != 0)
parts.SetSuffix(fSuffixParameter);
else if ((operations & SELECT_SUFFIX) == 0)
parts.UnsetSuffix();
if ((operations & REPLACE_ARCHIVE_MEMBER) != 0)
parts.SetArchiveMember(fArchiveMemberParameter);
else if ((operations & SELECT_ARCHIVE_MEMBER) == 0)
parts.UnsetArchiveMember();
if ((operations & TO_PARENT_DIRECTORY) != 0) {
parts.UnsetBaseName();
parts.UnsetSuffix();
parts.UnsetArchiveMember();
}
parts.GetPath(buffer, behavior);
} else
buffer += string;
if ((operations & TO_UPPER) != 0) {
char* toConvert = buffer.Data() + bufferSizeBeforeElement;
char* end = buffer.Data() + buffer.Length();
std::transform(toConvert, end, toConvert, ::toupper);
} else if ((operations & TO_LOWER) != 0) {
char* toConvert = buffer.Data() + bufferSizeBeforeElement;
char* end = buffer.Data() + buffer.Length();
std::transform(toConvert, end, toConvert, ::tolower);
}
//.........这里部分代码省略.........