本文整理汇总了C++中OmissionTypeName::hasDefaultArgument方法的典型用法代码示例。如果您正苦于以下问题:C++ OmissionTypeName::hasDefaultArgument方法的具体用法?C++ OmissionTypeName::hasDefaultArgument怎么用?C++ OmissionTypeName::hasDefaultArgument使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OmissionTypeName
的用法示例。
在下文中一共展示了OmissionTypeName::hasDefaultArgument方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: isVacuousPreposition
/// Determine whether the preposition in a split is "vacuous", and
/// should be removed.
static bool isVacuousPreposition(StringRef beforePreposition,
StringRef preposition,
StringRef afterPreposition,
const OmissionTypeName ¶mType) {
// Only consider "with" or "using" to be potentially vacuous.
if (!camel_case::sameWordIgnoreFirstCase(preposition, "with") &&
!camel_case::sameWordIgnoreFirstCase(preposition, "using"))
return false;
// If the preposition is "with", check for special cases.
if (camel_case::sameWordIgnoreFirstCase(preposition, "with")) {
// Some words following the preposition indicate that "with" is
// not vacuous.
auto following = camel_case::getFirstWord(afterPreposition);
if (camel_case::sameWordIgnoreFirstCase(following, "coder") ||
camel_case::sameWordIgnoreFirstCase(following, "zone"))
return false;
// If the last word of the argument label looks like a past
// participle (ends in "-ed"), the preposition is not vacuous.
auto lastWord = camel_case::getLastWord(afterPreposition);
if (lastWord.endswith("ed"))
return false;
if (camel_case::sameWordIgnoreFirstCase(following, "delegate") ||
camel_case::sameWordIgnoreFirstCase(following, "frame"))
return true;
}
// If the parameter has a default argument, it's vacuous.
if (paramType.hasDefaultArgument()) return true;
// If the parameter is of function type, it's vacuous.
if (paramType.isFunction()) return true;
// If the first word of the name is a verb, the preposition is
// likely vacuous.
if (getPartOfSpeech(camel_case::getFirstWord(beforePreposition))
== PartOfSpeech::Verb)
return true;
return false;
}
示例2: isVacuousPreposition
/// Determine whether the preposition in a split is "vacuous", and
/// should be removed.
static bool isVacuousPreposition(StringRef beforePreposition,
StringRef preposition,
StringRef afterPreposition,
const OmissionTypeName ¶mType) {
// Only consider "with" or "using" to be potentially vacuous.
if (!camel_case::sameWordIgnoreFirstCase(preposition, "with") &&
!camel_case::sameWordIgnoreFirstCase(preposition, "using"))
return false;
// If the preposition is "with" followed by "zone", never consider
// it vacuous.
if (camel_case::sameWordIgnoreFirstCase(preposition, "with") &&
camel_case::sameWordIgnoreFirstCase(
camel_case::getFirstWord(afterPreposition), "zone"))
return false;
// If the parameter has a default argument, it's vacuous.
if (paramType.hasDefaultArgument()) return true;
// If the parameter is of function type, it's vacuous.
if (paramType.isFunction()) return true;
return false;
}