本文整理汇总了C++中Version::isNull方法的典型用法代码示例。如果您正苦于以下问题:C++ Version::isNull方法的具体用法?C++ Version::isNull怎么用?C++ Version::isNull使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Version
的用法示例。
在下文中一共展示了Version::isNull方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: handleSupportedCompilers
/// \brief Extract the minimum compiler versions as requested on the command
/// line by the switch \c -for-compilers.
///
/// \param ProgName The name of the program, \c argv[0], used to print errors.
/// \param Error If an error occur while parsing the versions this parameter is
/// set to \c true, otherwise it will be left untouched.
static CompilerVersions handleSupportedCompilers(const char *ProgName,
bool &Error) {
if (SupportedCompilers.getNumOccurrences() == 0)
return CompilerVersions();
CompilerVersions RequiredVersions;
llvm::SmallVector<llvm::StringRef, 4> Compilers;
llvm::StringRef(SupportedCompilers).split(Compilers, ",");
for (llvm::SmallVectorImpl<llvm::StringRef>::iterator I = Compilers.begin(),
E = Compilers.end();
I != E; ++I) {
llvm::StringRef Compiler, VersionStr;
std::tie(Compiler, VersionStr) = I->split('-');
Version *V = llvm::StringSwitch<Version *>(Compiler)
.Case("clang", &RequiredVersions.Clang)
.Case("gcc", &RequiredVersions.Gcc).Case("icc", &RequiredVersions.Icc)
.Case("msvc", &RequiredVersions.Msvc).Default(NULL);
if (V == NULL) {
llvm::errs() << ProgName << ": " << Compiler
<< ": unsupported platform\n";
Error = true;
continue;
}
if (VersionStr.empty()) {
llvm::errs() << ProgName << ": " << *I
<< ": missing version number in platform\n";
Error = true;
continue;
}
Version Version = Version::getFromString(VersionStr);
if (Version.isNull()) {
llvm::errs()
<< ProgName << ": " << *I
<< ": invalid version, please use \"<major>[.<minor>]\" instead of \""
<< VersionStr << "\"\n";
Error = true;
continue;
}
// support the lowest version given
if (V->isNull() || Version < *V)
*V = Version;
}
return RequiredVersions;
}
示例2: Version
TEST(VersionTest, Interface) {
Version V;
ASSERT_TRUE(V.isNull());
ASSERT_TRUE(Version(1) < Version(1, 1));
ASSERT_TRUE(Version(1) < Version(2));
ASSERT_TRUE(Version(1, 1) < Version(2));
ASSERT_TRUE(Version(1, 1) == Version(1, 1));
ASSERT_EQ(Version(1).getMajor(), unsigned(1));
ASSERT_EQ(Version(1).getMinor(), unsigned(0));
ASSERT_EQ(Version(1, 2).getMinor(), unsigned(2));
}
示例3: main
int main(int, char * [])
{
// enlist all versions
std::cout << std::endl << std::endl << "[VERSIONS]" << std::endl << std::endl;
std::cout << "# Versions: " << Meta::versions().size() << std::endl << std::endl;
for (Version v : Meta::versions())
std::cout << v.toString() << std::endl;
// enlist all enums
std::cout << std::endl << std::endl << "[ENUMS]" << std::endl << std::endl;
if (Meta::stringsByGL())
{
std::cout << "# Enums: " << Meta::enums().size() << std::endl << std::endl;
for (GLenum e : Meta::enums()) // c++ 14 ...
std::cout << " (" << std::hex << std::showbase << std::internal << std::setfill('0') << std::setw(8)
<< static_cast<std::underlying_type<GLenum>::type>(e) << ") " << Meta::getString(e) << std::dec << std::endl;
std::cout << std::dec;
}
else
std::cout << std::endl << "warning: Enums cannot be enlisted since the glbinding used was compiled without GL_BY_STRINGS support." << std::endl;
// enlist all extensions
std::cout << std::endl << std::endl << "[EXTENSIONS]" << std::endl << std::endl;
if (Meta::stringsByGL())
{
std::cout << " # Extensions: " << Meta::extensions().size() << std::endl << std::endl;
for (GLextension e : Meta::extensions())
{
const Version v = Meta::getRequiringVersion(e);
std::cout << " " << Meta::getString(e) << " " << (v.isNull() ? "" : v.toString()) << std::endl;
}
}
else
std::cout << std::endl << "warning: EXTENSIONS cannot be enlisted since the glbinding used was compiled without GL_BY_STRINGS support." << std::endl;
// print some gl infos (query)
std::cout << std::endl
<< "OpenGL Revision: " << Meta::glRevision() << " (gl.xml)" << std::endl << std::endl;
return 0;
}
示例4: main
int main(int, char * [])
{
// enlist all versions
std::cout << std::endl << std::endl << "[VERSIONS]" << std::endl << std::endl;
std::cout << "# Versions: " << aux::Meta::versions().size() << std::endl << std::endl;
for (Version v : aux::Meta::versions())
std::cout << v.toString() << std::endl;
// enlist all enums
std::cout << std::endl << std::endl << "[ENUMS]" << std::endl << std::endl;
std::cout << "# Enums: " << aux::Meta::enums().size() << std::endl << std::endl;
for (GLenum e : aux::Meta::enums()) // c++ 14 ...
std::cout << " (" << std::hex << std::showbase << std::internal << std::setfill('0') << std::setw(8)
<< static_cast<std::underlying_type<GLenum>::type>(e) << ") " << aux::Meta::getString(e) << std::dec << std::endl;
std::cout << std::dec;
// enlist all extensions
std::cout << std::endl << std::endl << "[EXTENSIONS]" << std::endl << std::endl;
std::cout << " # Extensions: " << aux::Meta::extensions().size() << std::endl << std::endl;
for (GLextension extension : aux::Meta::extensions())
{
const Version v = aux::Meta::version(extension);
std::cout << " " << aux::Meta::getString(extension) << " " << (v.isNull() ? "" : v.toString()) << std::endl;
}
// print some gl infos (query)
std::cout << std::endl
<< "OpenGL Revision: " << aux::Meta::glRevision() << " (gl.xml)" << std::endl << std::endl;
return 0;
}