• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ nsAutoCString类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中nsAutoCString的典型用法代码示例。如果您正苦于以下问题:C++ nsAutoCString类的具体用法?C++ nsAutoCString怎么用?C++ nsAutoCString使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了nsAutoCString类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: SetStorageKey

static void
SetStorageKey(nsAutoCString& storageKey, nsCString& hostname, uint32_t aType)
{
  storageKey = hostname;
  switch (aType) {
    case nsISiteSecurityService::HEADER_HSTS:
      storageKey.AppendLiteral(":HSTS");
      break;
    case nsISiteSecurityService::HEADER_HPKP:
      storageKey.AppendLiteral(":HPKP");
      break;
    default:
      NS_ASSERTION(false, "SSS:SetStorageKey got invalid type");
  }
}
开发者ID:LordJZ,项目名称:gecko-dev,代码行数:15,代码来源:nsSiteSecurityService.cpp


示例2: fprintf

/* static */ void
nsBaseWidget::debug_DumpPaintEvent(FILE *                aFileOut,
                                   nsIWidget *           aWidget,
                                   const nsIntRegion &   aRegion,
                                   const nsAutoCString & aWidgetName,
                                   int32_t               aWindowID)
{
  NS_ASSERTION(nullptr != aFileOut,"cmon, null output FILE");
  NS_ASSERTION(nullptr != aWidget,"cmon, the widget is null");

  if (!debug_GetCachedBoolPref("nglayout.debug.paint_dumping"))
    return;

  nsIntRect rect = aRegion.GetBounds();
  fprintf(aFileOut,
          "%4d PAINT      widget=%p name=%-12s id=0x%-6x bounds-rect=%3d,%-3d %3d,%-3d",
          _GetPrintCount(),
          (void *) aWidget,
          aWidgetName.get(),
          aWindowID,
          rect.x, rect.y, rect.width, rect.height
    );

  fprintf(aFileOut,"\n");
}
开发者ID:nhirata,项目名称:releases-mozilla-central,代码行数:25,代码来源:nsBaseWidget.cpp


示例3: tempString

/* static */ void
nsBaseWidget::debug_DumpEvent(FILE *                aFileOut,
                              nsIWidget *           aWidget,
                              nsGUIEvent *          aGuiEvent,
                              const nsAutoCString & aWidgetName,
                              int32_t               aWindowID)
{
  if (aGuiEvent->message == NS_MOUSE_MOVE)
  {
    if (!debug_GetCachedBoolPref("nglayout.debug.motion_event_dumping"))
      return;
  }

  if (aGuiEvent->message == NS_MOUSE_ENTER ||
      aGuiEvent->message == NS_MOUSE_EXIT)
  {
    if (!debug_GetCachedBoolPref("nglayout.debug.crossing_event_dumping"))
      return;
  }

  if (!debug_GetCachedBoolPref("nglayout.debug.event_dumping"))
    return;

  NS_LossyConvertUTF16toASCII tempString(debug_GuiEventToString(aGuiEvent).get());

  fprintf(aFileOut,
          "%4d %-26s widget=%-8p name=%-12s id=0x%-6x refpt=%d,%d\n",
          _GetPrintCount(),
          tempString.get(),
          (void *) aWidget,
          aWidgetName.get(),
          aWindowID,
          aGuiEvent->refPoint.x,
          aGuiEvent->refPoint.y);
}
开发者ID:nhirata,项目名称:releases-mozilla-central,代码行数:35,代码来源:nsBaseWidget.cpp


示例4: PR_GetEnv

bool
GeckoChildProcessHost::PerformAsyncLaunch(std::vector<std::string> aExtraOpts, base::ProcessArchitecture arch)
{
  // If NSPR log files are not requested, we're done.
  const char* origNSPRLogName = PR_GetEnv("NSPR_LOG_FILE");
  const char* origMozLogName = PR_GetEnv("MOZ_LOG_FILE");
  if (!origNSPRLogName && !origMozLogName) {
    return PerformAsyncLaunchInternal(aExtraOpts, arch);
  }

  ++mChildCounter;

  // remember original value so we can restore it.
  // - Note: this code is not called re-entrantly, nor are restoreOrig*LogName
  //   or mChildCounter touched by any other thread, so this is safe.
  static nsAutoCString restoreOrigNSPRLogName;
  static nsAutoCString restoreOrigMozLogName;

  if (origNSPRLogName) {
    if (restoreOrigNSPRLogName.IsEmpty()) {
      restoreOrigNSPRLogName.AssignLiteral("NSPR_LOG_FILE=");
      restoreOrigNSPRLogName.Append(origNSPRLogName);
    }
    SetChildLogName("NSPR_LOG_FILE=", origNSPRLogName);
  }
  if (origMozLogName) {
    if (restoreOrigMozLogName.IsEmpty()) {
      restoreOrigMozLogName.AssignLiteral("MOZ_LOG_FILE=");
      restoreOrigMozLogName.Append(origMozLogName);
    }
    SetChildLogName("MOZ_LOG_FILE=", origMozLogName);
  }

  bool retval = PerformAsyncLaunchInternal(aExtraOpts, arch);

  // Revert to original value
  if (origNSPRLogName) {
    PR_SetEnv(restoreOrigNSPRLogName.get());
  }
  if (origMozLogName) {
    PR_SetEnv(restoreOrigMozLogName.get());
  }

  return retval;
}
开发者ID:linclark,项目名称:gecko-dev,代码行数:45,代码来源:GeckoChildProcessHost.cpp


示例5: GetNSSProfilePath

static nsresult
GetNSSProfilePath(nsAutoCString& aProfilePath)
{
  aProfilePath.Truncate();
  const char* dbDirOverride = getenv("MOZPSM_NSSDBDIR_OVERRIDE");
  if (dbDirOverride && strlen(dbDirOverride) > 0) {
    MOZ_LOG(gPIPNSSLog, LogLevel::Debug,
           ("Using specified MOZPSM_NSSDBDIR_OVERRIDE as NSS DB dir: %s\n",
            dbDirOverride));
    aProfilePath.Assign(dbDirOverride);
    return NS_OK;
  }

  nsCOMPtr<nsIFile> profileFile;
  nsresult rv = NS_GetSpecialDirectory(NS_APP_USER_PROFILE_50_DIR,
                                       getter_AddRefs(profileFile));
  if (NS_FAILED(rv)) {
    NS_WARNING("NSS will be initialized without a profile directory. "
               "Some things may not work as expected.");
    return NS_OK;
  }

#if defined(XP_WIN)
  // Native path will drop Unicode characters that cannot be mapped to system's
  // codepage, using short (canonical) path as workaround.
  nsCOMPtr<nsILocalFileWin> profileFileWin(do_QueryInterface(profileFile));
  if (!profileFileWin) {
    MOZ_LOG(gPIPNSSLog, LogLevel::Error,
           ("Could not get nsILocalFileWin for profile directory.\n"));
    return NS_ERROR_FAILURE;
  }
  rv = profileFileWin->GetNativeCanonicalPath(aProfilePath);
#else
  rv = profileFile->GetNativePath(aProfilePath);
#endif
  if (NS_FAILED(rv)) {
    MOZ_LOG(gPIPNSSLog, LogLevel::Error,
           ("Could not get native path for profile directory.\n"));
    return rv;
  }

  MOZ_LOG(gPIPNSSLog, LogLevel::Debug,
          ("NSS profile at '%s'\n", aProfilePath.get()));
  return NS_OK;
}
开发者ID:spatenotte,项目名称:gecko,代码行数:45,代码来源:nsNSSComponent.cpp


示例6: nsMsgI18NFileSystemCharset

// Charset used by the file system.
const char * nsMsgI18NFileSystemCharset()
{
  /* Get a charset used for the file. */
  static nsAutoCString fileSystemCharset;

  if (fileSystemCharset.IsEmpty()) 
  {
    nsresult rv;
    nsCOMPtr <nsIPlatformCharset> platformCharset = do_GetService(NS_PLATFORMCHARSET_CONTRACTID, &rv);
        if (NS_SUCCEEDED(rv)) {
          rv = platformCharset->GetCharset(kPlatformCharsetSel_FileName,
                                           fileSystemCharset);
        }

    if (NS_FAILED(rv)) 
      fileSystemCharset.Assign("ISO-8859-1");
  }
  return fileSystemCharset.get();
}
开发者ID:cmotc,项目名称:spacehamster,代码行数:20,代码来源:nsMsgI18N.cpp


示例7: GetHostPortKey

static nsresult
GetHostPortKey(TransportSecurityInfo* infoObject, nsAutoCString &result)
{
    nsresult rv;

    result.Truncate();

    nsXPIDLCString hostName;
    rv = infoObject->GetHostName(getter_Copies(hostName));
    NS_ENSURE_SUCCESS(rv, rv);

    int32_t port;
    rv = infoObject->GetPort(&port);
    NS_ENSURE_SUCCESS(rv, rv);

    result.Assign(hostName);
    result.Append(':');
    result.AppendInt(port);

    return NS_OK;
}
开发者ID:Jar-win,项目名称:Waterfox,代码行数:21,代码来源:TransportSecurityInfo.cpp


示例8: pref

bool nsDefaultURIFixup::IsDomainWhitelisted(const nsAutoCString aAsciiHost,
                                            const uint32_t aDotLoc)
{
    if (sDNSFirstForSingleWords) {
        return true;
    }
    // Check if this domain is whitelisted as an actual
    // domain (which will prevent a keyword query)
    // NB: any processing of the host here should stay in sync with
    // code in the front-end(s) that set the pref.

    nsAutoCString pref("browser.fixup.domainwhitelist.");

    if (aDotLoc == aAsciiHost.Length() - 1) {
      pref.Append(Substring(aAsciiHost, 0, aAsciiHost.Length() - 1));
    } else {
      pref.Append(aAsciiHost);
    }

    return Preferences::GetBool(pref.get(), false);
}
开发者ID:Standard8,项目名称:gecko-dev,代码行数:21,代码来源:nsDefaultURIFixup.cpp


示例9: canonicalizeBase

static inline bool
canonicalizeBase(nsAutoCString &spec,
                 nsACString &out)
{
    nsAutoCString greBase, appBase;
    nsresult rv = mozilla::Omnijar::GetURIString(mozilla::Omnijar::GRE, greBase);
    if (NS_FAILED(rv) || !greBase.Length())
        return false;

    rv = mozilla::Omnijar::GetURIString(mozilla::Omnijar::APP, appBase);
    if (NS_FAILED(rv))
        return false;

    bool underGre = !greBase.Compare(spec.get(), false, greBase.Length());
    bool underApp = appBase.Length() &&
                    !appBase.Compare(spec.get(), false, appBase.Length());

    if (!underGre && !underApp)
        return false;

    /**
     * At this point, if both underGre and underApp are true, it can be one
     * of the two following cases:
     * - the GRE directory points to a subdirectory of the APP directory,
     *   meaning spec points under GRE.
     * - the APP directory points to a subdirectory of the GRE directory,
     *   meaning spec points under APP.
     * Checking the GRE and APP path length is enough to know in which case
     * we are.
     */
    if (underGre && underApp && greBase.Length() < appBase.Length())
        underGre = false;

    out.Append("/resource/");
    out.Append(baseName[underGre ? mozilla::Omnijar::GRE : mozilla::Omnijar::APP]);
    out.Append(Substring(spec, underGre ? greBase.Length() : appBase.Length()));
    return true;
}
开发者ID:mikeaich,项目名称:releases-mozilla-central,代码行数:38,代码来源:StartupCacheUtils.cpp


示例10: NS_IMPL_CYCLE_COLLECTION_CLASS

  mScopeObject = aScopeObject;
}

NS_IMPL_CYCLE_COLLECTION_CLASS(nsJSEventListener)

NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsJSEventListener)
  if (tmp->mScopeObject) {
    tmp->mScopeObject = nullptr;
    mozilla::DropJSObjects(tmp);
    NS_IMPL_CYCLE_COLLECTION_UNLINK(mContext)
  }
  tmp->mHandler.ForgetHandler();
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INTERNAL(nsJSEventListener)
  if (MOZ_UNLIKELY(cb.WantDebugInfo()) && tmp->mEventName) {
    nsAutoCString name;
    name.AppendLiteral("nsJSEventListener handlerName=");
    name.Append(
      NS_ConvertUTF16toUTF8(nsDependentAtomString(tmp->mEventName)).get());
    cb.DescribeRefCountedNode(tmp->mRefCnt.get(), name.get());
  } else {
    NS_IMPL_CYCLE_COLLECTION_DESCRIBE(nsJSEventListener, tmp->mRefCnt.get())
  }
  NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mContext)
  NS_IMPL_CYCLE_COLLECTION_TRAVERSE_RAWPTR(mHandler.Ptr())
  NS_IMPL_CYCLE_COLLECTION_TRAVERSE_SCRIPT_OBJECTS
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END

NS_IMPL_CYCLE_COLLECTION_TRACE_BEGIN(nsJSEventListener)
  NS_IMPL_CYCLE_COLLECTION_TRACE_JS_MEMBER_CALLBACK(mScopeObject)
NS_IMPL_CYCLE_COLLECTION_TRACE_END
开发者ID:ak352,项目名称:mozilla-central,代码行数:31,代码来源:nsJSEventListener.cpp


示例11: PrintError

void nsTestLog::PrintError(const char * aCall, const char * aMessage)
{
  const char * trace = mTrace.get();
  printf("ERROR at %s%s reason: %s.\n", trace, aCall, aMessage);
}
开发者ID:Andrel322,项目名称:gecko-dev,代码行数:5,代码来源:TestUConv.cpp


示例12: DelTrace

void nsTestLog::DelTrace(const char * aTrace)
{
  mTrace.Truncate(mTrace.Length() - strlen(aTrace) - strlen(kTraceDelimiter));
}
开发者ID:Andrel322,项目名称:gecko-dev,代码行数:4,代码来源:TestUConv.cpp


示例13: AddTrace

void nsTestLog::AddTrace(const char * aTrace)
{
  mTrace.Append(aTrace);
  mTrace.Append(kTraceDelimiter);
}
开发者ID:Andrel322,项目名称:gecko-dev,代码行数:5,代码来源:TestUConv.cpp



注:本文中的nsAutoCString类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ nsAutoPtr类代码示例发布时间:2022-05-31
下一篇:
C++ nsAttrValue类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap