本文整理汇总了C++中ConstString::GetCString方法的典型用法代码示例。如果您正苦于以下问题:C++ ConstString::GetCString方法的具体用法?C++ ConstString::GetCString怎么用?C++ ConstString::GetCString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ConstString
的用法示例。
在下文中一共展示了ConstString::GetCString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetPropertyAtIndex
//bool
//OptionValueProperties::GetQualifiedName (Stream &strm)
//{
// bool dumped_something = false;
//// lldb::OptionValuePropertiesSP parent_sp(GetParent ());
//// if (parent_sp)
//// {
//// parent_sp->GetQualifiedName (strm);
//// strm.PutChar('.');
//// dumped_something = true;
//// }
// if (m_name)
// {
// strm << m_name;
// dumped_something = true;
// }
// return dumped_something;
//}
//
lldb::OptionValueSP
OptionValueProperties::GetValueForKey (const ExecutionContext *exe_ctx,
const ConstString &key,
bool will_modify) const
{
lldb::OptionValueSP value_sp;
size_t idx = m_name_to_index.Find (key.GetCString(), SIZE_MAX);
if (idx < m_properties.size())
value_sp = GetPropertyAtIndex(exe_ctx, will_modify, idx)->GetValue();
return value_sp;
}
示例2: extension
//------------------------------------------------------------------
/// Returns true if the filespec represents an implementation source
/// file (files with a ".c", ".cpp", ".m", ".mm" (many more)
/// extension).
///
/// @return
/// \b true if the filespec represents an implementation source
/// file, \b false otherwise.
//------------------------------------------------------------------
bool
FileSpec::IsSourceImplementationFile () const
{
ConstString extension (GetFileNameExtension());
if (extension)
{
static RegularExpression g_source_file_regex ("^(c|m|mm|cpp|c\\+\\+|cxx|cc|cp|s|asm|f|f77|f90|f95|f03|for|ftn|fpp|ada|adb|ads)$",
llvm::Regex::IgnoreCase);
return g_source_file_regex.Execute (extension.GetCString());
}
return false;
}
示例3: if
size_t
ValueObjectSynthetic::GetIndexOfChildWithName (const ConstString &name)
{
UpdateValueIfNeeded();
uint32_t found_index = UINT32_MAX;
bool did_find = m_name_toindex.GetValueForKey(name.GetCString(), found_index);
if (!did_find && m_synth_filter_ap.get() != NULL)
{
uint32_t index = m_synth_filter_ap->GetIndexOfChildWithName (name);
if (index == UINT32_MAX)
return index;
m_name_toindex.SetValueForKey(name.GetCString(), index);
return index;
}
else if (!did_find && m_synth_filter_ap.get() == NULL)
return UINT32_MAX;
else /*if (iter != m_name_toindex.end())*/
return found_index;
}
示例4: property
void
OptionValueProperties::AppendProperty(const ConstString &name,
const ConstString &desc,
bool is_global,
const OptionValueSP &value_sp)
{
Property property(name, desc, is_global, value_sp);
m_name_to_index.Append(name.GetCString(),m_properties.size());
m_properties.push_back(property);
value_sp->SetParent (shared_from_this());
m_name_to_index.Sort();
}
示例5: RemapPath
bool PathMappingList::RemapPath(const ConstString &path,
ConstString &new_path) const {
const char *path_cstr = path.GetCString();
// CLEANUP: Convert this function to use StringRefs internally instead
// of raw c-strings.
if (!path_cstr)
return false;
const_iterator pos, end = m_pairs.end();
for (pos = m_pairs.begin(); pos != end; ++pos) {
const size_t prefixLen = pos->first.GetLength();
if (::strncmp(pos->first.GetCString(), path_cstr, prefixLen) == 0) {
std::string new_path_str(pos->second.GetCString());
new_path_str.append(path.GetCString() + prefixLen);
new_path.SetCString(new_path_str.c_str());
return true;
}
}
return false;
}
示例6: RegisterPersistentDecl
void ClangPersistentVariables::RegisterPersistentDecl(const ConstString &name,
clang::NamedDecl *decl) {
m_persistent_decls.insert(
std::pair<const char *, clang::NamedDecl *>(name.GetCString(), decl));
if (clang::EnumDecl *enum_decl = llvm::dyn_cast<clang::EnumDecl>(decl)) {
for (clang::EnumConstantDecl *enumerator_decl : enum_decl->enumerators()) {
m_persistent_decls.insert(std::pair<const char *, clang::NamedDecl *>(
ConstString(enumerator_decl->getNameAsString()).GetCString(),
enumerator_decl));
}
}
}
示例7: scoped_timer
uint32_t
SymbolFileSymtab::FindFunctions(const ConstString &name, const ClangNamespaceDecl *namespace_decl, uint32_t name_type_mask, bool include_inlines, bool append, SymbolContextList& sc_list)
{
Timer scoped_timer (__PRETTY_FUNCTION__,
"SymbolFileSymtab::FindFunctions (name = '%s')",
name.GetCString());
// If we ever support finding STABS or COFF debug info symbols,
// we will need to add support here. We are not trying to find symbols
// here, just "lldb_private::Function" objects that come from complete
// debug information. Any symbol queries should go through the symbol
// table itself in the module's object file.
return 0;
}
示例8:
bool
Symbol::SetReExportedSymbolName(const ConstString &name)
{
if (m_type == eSymbolTypeReExported)
{
// For eSymbolTypeReExported, the "const char *" from a ConstString
// is used as the offset in the address range base address.
m_addr_range.GetBaseAddress().SetOffset((intptr_t)name.GetCString());
return true;
}
return false;
}
示例9:
bool
operator < (const SourceInfo &rhs) const
{
if (function.GetCString() < rhs.function.GetCString())
return true;
if (line_entry.file.GetDirectory().GetCString() < rhs.line_entry.file.GetDirectory().GetCString())
return true;
if (line_entry.file.GetFilename().GetCString() < rhs.line_entry.file.GetFilename().GetCString())
return true;
if (line_entry.line < rhs.line_entry.line)
return true;
return false;
}
示例10: FindTypes_Impl
uint32_t
Module::FindTypes (const SymbolContext& sc, const ConstString &name, const ClangNamespaceDecl *namespace_decl, bool append, uint32_t max_matches, TypeList& types)
{
uint32_t retval = FindTypes_Impl(sc, name, namespace_decl, append, max_matches, types);
if (retval == 0)
{
const char *stripped = StripTypeName(name.GetCString());
return FindTypes_Impl(sc, ConstString(stripped), namespace_decl, append, max_matches, types);
}
else
return retval;
}
示例11: new_path_str
bool
PathMappingList::RemapPath (const ConstString &path, ConstString &new_path) const
{
const char *path_cstr = path.GetCString();
if (!path_cstr)
return false;
const_iterator pos, end = m_pairs.end();
for (pos = m_pairs.begin(); pos != end; ++pos)
{
const size_t prefixLen = pos->first.GetLength();
if (::strncmp (pos->first.GetCString(), path_cstr, prefixLen) == 0)
{
std::string new_path_str (pos->second.GetCString());
new_path_str.append(path.GetCString() + prefixLen);
new_path.SetCString(new_path_str.c_str());
return true;
}
}
return false;
}
示例12: if
//----------------------------------------------------------------------
// We "guess" the language because we can't determine a symbol's language
// from it's name. For example, a Pascal symbol can be mangled using the
// C++ Itanium scheme, and defined in a compilation unit within the same
// module as other C++ units. In addition, different targets could have
// different ways of mangling names from a given language, likewise the
// compilation units within those targets.
//----------------------------------------------------------------------
lldb::LanguageType
Mangled::GuessLanguage () const
{
ConstString mangled = GetMangledName();
if (mangled)
{
if (GetDemangledName(lldb::eLanguageTypeUnknown))
{
const char *mangled_name = mangled.GetCString();
if (CPlusPlusLanguage::IsCPPMangledName(mangled_name))
return lldb::eLanguageTypeC_plus_plus;
else if (ObjCLanguage::IsPossibleObjCMethodName(mangled_name))
return lldb::eLanguageTypeObjC;
}
}
return lldb::eLanguageTypeUnknown;
}
示例13:
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));
}
}
示例14: AddNameLookup
void BreakpointResolverName::AddNameLookup(ConstString name,
FunctionNameType name_type_mask) {
ObjCLanguage::MethodName objc_method(name.GetCString(), false);
if (objc_method.IsValid(false)) {
std::vector<ConstString> objc_names;
objc_method.GetFullNames(objc_names, true);
for (ConstString objc_name : objc_names) {
Module::LookupInfo lookup;
lookup.SetName(name);
lookup.SetLookupName(objc_name);
lookup.SetNameTypeMask(eFunctionNameTypeFull);
m_lookups.push_back(lookup);
}
} else {
Module::LookupInfo lookup(name, name_type_mask, m_language);
m_lookups.push_back(lookup);
}
}
示例15: FromItaniumName
bool RichManglingContext::FromItaniumName(const ConstString &mangled) {
bool err = m_ipd.partialDemangle(mangled.GetCString());
if (!err) {
ResetProvider(ItaniumPartialDemangler);
}
if (Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_DEMANGLE)) {
if (!err) {
ParseFullName();
LLDB_LOG(log, "demangled itanium: {0} -> \"{1}\"", mangled, m_ipd_buf);
} else {
LLDB_LOG(log, "demangled itanium: {0} -> error: failed to demangle",
mangled);
}
}
return !err; // true == success
}