本文整理汇总了C++中ConstString::IsEmpty方法的典型用法代码示例。如果您正苦于以下问题:C++ ConstString::IsEmpty方法的具体用法?C++ ConstString::IsEmpty怎么用?C++ ConstString::IsEmpty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ConstString
的用法示例。
在下文中一共展示了ConstString::IsEmpty方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetFullNameForDylib
ConstString PlatformWindows::GetFullNameForDylib(ConstString basename) {
if (basename.IsEmpty())
return basename;
StreamString stream;
stream.Printf("%s.dll", basename.GetCString());
return ConstString(stream.GetData());
}
示例2: ConstString
ConstString
PlatformLinux::GetFullNameForDylib (ConstString basename)
{
if (basename.IsEmpty())
return basename;
StreamString stream;
stream.Printf("lib%s.so", basename.GetCString());
return ConstString(stream.GetData());
}
示例3:
void
SwiftPersistentExpressionState::SwiftDeclMap::AddDecl (swift::ValueDecl *value_decl, bool check_existing, const ConstString &alias)
{
std::string name_str;
if (alias.IsEmpty())
{
name_str = (value_decl->getName().str());
}
else
{
name_str.assign(alias.GetCString());
}
if (!check_existing)
{
m_swift_decls.insert(std::make_pair(name_str, value_decl));
return;
}
SwiftDeclMapTy::iterator map_end = m_swift_decls.end();
std::pair<SwiftDeclMapTy::iterator, SwiftDeclMapTy::iterator> found_range = m_swift_decls.equal_range(name_str);
if (found_range.first == map_end)
{
m_swift_decls.insert(std::make_pair(name_str, value_decl));
return;
}
else
{
SwiftDeclMapTy::iterator cur_item;
bool done = false;
for (cur_item = found_range.first; !done && cur_item != found_range.second; cur_item++)
{
swift::ValueDecl *cur_decl = (*cur_item).second;
if (DeclsAreEquivalent(cur_decl, value_decl))
{
m_swift_decls.erase (cur_item);
break;
}
}
m_swift_decls.insert(std::make_pair(name_str, value_decl));
}
}
示例4: GetSharedModule
//.........这里部分代码省略.........
platform_module_spec.GetFileSpec())) {
// printf ("sdk[%u]: '%s'\n", sdk_idx, local_file.GetPath().c_str());
error = ResolveExecutable(platform_module_spec, module_sp, nullptr);
if (module_sp) {
// Remember the index of the last SDK that we found a file
// in in case the wrong SDK was selected.
m_last_module_sdk_idx = sdk_idx;
error.Clear();
return error;
}
}
}
}
// Not the module we are looking for... Nothing to see here...
module_sp.reset();
// This may not be an SDK-related module. Try whether we can bring in the
// thing to our local cache.
error = GetSharedModuleWithLocalCache(module_spec, module_sp,
module_search_paths_ptr,
old_module_sp_ptr, did_create_ptr);
if (error.Success())
return error;
// See if the file is present in any of the module_search_paths_ptr
// directories.
if (!module_sp && module_search_paths_ptr && platform_file) {
// create a vector of all the file / directory names in platform_file
// e.g. this might be
// /System/Library/PrivateFrameworks/UIFoundation.framework/UIFoundation
//
// We'll need to look in the module_search_paths_ptr directories for
// both "UIFoundation" and "UIFoundation.framework" -- most likely the
// latter will be the one we find there.
FileSpec platform_pull_apart(platform_file);
std::vector<std::string> path_parts;
ConstString unix_root_dir("/");
while (true) {
ConstString part = platform_pull_apart.GetLastPathComponent();
platform_pull_apart.RemoveLastPathComponent();
if (part.IsEmpty() || part == unix_root_dir)
break;
path_parts.push_back(part.AsCString());
}
const size_t path_parts_size = path_parts.size();
size_t num_module_search_paths = module_search_paths_ptr->GetSize();
for (size_t i = 0; i < num_module_search_paths; ++i) {
// Create a new FileSpec with this module_search_paths_ptr
// plus just the filename ("UIFoundation"), then the parent
// dir plus filename ("UIFoundation.framework/UIFoundation")
// etc - up to four names (to handle "Foo.framework/Contents/MacOS/Foo")
for (size_t j = 0; j < 4 && j < path_parts_size - 1; ++j) {
FileSpec path_to_try(module_search_paths_ptr->GetFileSpecAtIndex(i));
// Add the components backwards. For
// .../PrivateFrameworks/UIFoundation.framework/UIFoundation
// path_parts is
// [0] UIFoundation
// [1] UIFoundation.framework
// [2] PrivateFrameworks
//
// and if 'j' is 2, we want to append path_parts[1] and then
// path_parts[0], aka
// 'UIFoundation.framework/UIFoundation', to the module_search_paths_ptr
// path.
for (int k = j; k >= 0; --k) {
path_to_try.AppendPathComponent(path_parts[k]);
}
if (path_to_try.Exists()) {
ModuleSpec new_module_spec(module_spec);
new_module_spec.GetFileSpec() = path_to_try;
Error new_error(Platform::GetSharedModule(
new_module_spec, process, module_sp, NULL, old_module_sp_ptr,
did_create_ptr));
if (module_sp) {
module_sp->SetPlatformFileSpec(path_to_try);
return new_error;
}
}
}
}
}
const bool always_create = false;
error = ModuleList::GetSharedModule(
module_spec, module_sp, module_search_paths_ptr, old_module_sp_ptr,
did_create_ptr, always_create);
if (module_sp)
module_sp->SetPlatformFileSpec(platform_file);
return error;
}
示例5: g_CFBag
bool
ObjCLanguage::GetFormatterPrefixSuffix (ValueObject& valobj, ConstString type_hint,
std::string& prefix, std::string& suffix)
{
static ConstString g_CFBag("CFBag");
static ConstString g_CFBinaryHeap("CFBinaryHeap");
static ConstString g_NSNumberChar("NSNumber:char");
static ConstString g_NSNumberShort("NSNumber:short");
static ConstString g_NSNumberInt("NSNumber:int");
static ConstString g_NSNumberLong("NSNumber:long");
static ConstString g_NSNumberFloat("NSNumber:float");
static ConstString g_NSNumberDouble("NSNumber:double");
static ConstString g_NSData("NSData");
static ConstString g_NSArray("NSArray");
static ConstString g_NSString("NSString");
static ConstString g_NSStringStar("NSString*");
if (type_hint.IsEmpty())
return false;
prefix.clear();
suffix.clear();
if (type_hint == g_CFBag ||
type_hint == g_CFBinaryHeap)
{
prefix = "@";
return true;
}
if (type_hint == g_NSNumberChar)
{
prefix = "(char)";
return true;
}
if (type_hint == g_NSNumberShort)
{
prefix = "(short)";
return true;
}
if (type_hint == g_NSNumberInt)
{
prefix = "(int)";
return true;
}
if (type_hint == g_NSNumberLong)
{
prefix = "(long)";
return true;
}
if (type_hint == g_NSNumberFloat)
{
prefix = "(float)";
return true;
}
if (type_hint == g_NSNumberDouble)
{
prefix = "(double)";
return true;
}
if (type_hint == g_NSData ||
type_hint == g_NSArray)
{
prefix = "@\"";
suffix = "\"";
return true;
}
if (type_hint == g_NSString ||
type_hint == g_NSStringStar)
{
prefix = "@";
return true;
}
return false;
}