本文整理汇总了C++中StringLiteral::c_str方法的典型用法代码示例。如果您正苦于以下问题:C++ StringLiteral::c_str方法的具体用法?C++ StringLiteral::c_str怎么用?C++ StringLiteral::c_str使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StringLiteral
的用法示例。
在下文中一共展示了StringLiteral::c_str方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: log
void AnsiTerminalLoggerSink::log(LogMessage const& message) {
MutexLock l(_mutex);
StringLiteral const WhenColorStart = BlueColorStart;
StringLiteral const ThreadNameColorStart = MagentaColorStart;
StringLiteral const AuthorColorStart = GreenColorStart;
StringLiteral const LogLevelColorStart = LogLevelColorMapper()(message.level);
printf(
"%s[%s]%s %s{%s}%s %s[%s]%s %s[%s]%s %s%s%s\n",
WhenColorStart.c_str(),
to_string(message.when).c_str(),
AttributeReset.c_str(),
ThreadNameColorStart.c_str(),
message.thread->c_str(),
AttributeReset.c_str(),
AuthorColorStart.c_str(),
message.author.c_str(),
AttributeReset.c_str(),
LogLevelColorStart.c_str(),
message.level.to_string().c_str(),
AttributeReset.c_str(),
LogLevelColorStart.c_str(),
message.message.c_str(),
AttributeReset.c_str());
}
示例2: read_and_verify_archive_file_signature
static void read_and_verify_archive_file_signature(fstream& fs)
{
static constexpr StringLiteral FILE_START = "!<arch>\n";
static constexpr size_t FILE_START_SIZE = 8;
fs.seekg(std::fstream::beg);
char file_start[FILE_START_SIZE];
fs.read(file_start, FILE_START_SIZE);
verify_equal_strings(VCPKG_LINE_INFO, FILE_START.c_str(), file_start, FILE_START_SIZE, "LIB FILE_START");
}
示例3: read_and_verify_pe_signature
static void read_and_verify_pe_signature(fstream& fs)
{
static constexpr size_t OFFSET_TO_PE_SIGNATURE_OFFSET = 0x3c;
static constexpr StringLiteral PE_SIGNATURE = "PE\0\0";
static constexpr size_t PE_SIGNATURE_SIZE = 4;
fs.seekg(OFFSET_TO_PE_SIGNATURE_OFFSET, ios_base::beg);
const auto offset_to_pe_signature = read_value_from_stream<int32_t>(fs);
fs.seekg(offset_to_pe_signature);
char signature[PE_SIGNATURE_SIZE];
fs.read(signature, PE_SIGNATURE_SIZE);
verify_equal_strings(VCPKG_LINE_INFO, PE_SIGNATURE.c_str(), signature, PE_SIGNATURE_SIZE, "PE_SIGNATURE");
fs.seekg(offset_to_pe_signature + PE_SIGNATURE_SIZE, ios_base::beg);
}
示例4: read
static ArchiveMemberHeader read(fstream& fs)
{
static constexpr size_t HEADER_END_OFFSET = 58;
static constexpr StringLiteral HEADER_END = "`\n";
static constexpr size_t HEADER_END_SIZE = 2;
ArchiveMemberHeader ret;
ret.data.resize(HEADER_SIZE);
fs.read(&ret.data[0], HEADER_SIZE);
if (ret.data[0] != '\0') // Due to freeglut. github issue #223
{
const std::string header_end = ret.data.substr(HEADER_END_OFFSET, HEADER_END_SIZE);
verify_equal_strings(
VCPKG_LINE_INFO, HEADER_END.c_str(), header_end.c_str(), HEADER_END_SIZE, "LIB HEADER_END");
}
return ret;
}