本文整理匯總了C++中EnsureInit函數的典型用法代碼示例。如果您正苦於以下問題:C++ EnsureInit函數的具體用法?C++ EnsureInit怎麽用?C++ EnsureInit使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了EnsureInit函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。
示例1: EnsureInit
bool OBStereoFacade::HasTetrahedralStereo(unsigned long atomId)
{
EnsureInit();
if (m_tetrahedralMap.find(atomId) != m_tetrahedralMap.end())
return true;
return false;
}
示例2: KeyFlush
void KeyFlush()
{
if (EnsureInit ())
{
ULONG cElements = INFINITE;
ULONG kcKey;
// HRESULT hr =
IDirectInputDevice_GetDeviceData (
g_lpdidKeybd,
sizeof (DIDEVICEOBJECTDATA),
NULL,
(int *) &cElements,
0);
for (kcKey = 0; kcKey < 256; kcKey ++)
{
g_rgtimeElapsed [kcKey] = 0;
g_rgcDowns [kcKey] = 0;
g_rgcUps [kcKey] = 0;
keyd_pressed [kcKey] = 0;
}
FlushQueue ();
}
}
示例3: ScreenForNativeWidget
NS_IMETHODIMP
nsScreenManagerGtk :: ScreenForNativeWidget (void *aWidget, nsIScreen **outScreen)
{
nsresult rv;
rv = EnsureInit();
if (NS_FAILED(rv)) {
NS_ERROR("nsScreenManagerGtk::EnsureInit() failed from ScreenForNativeWidget");
return rv;
}
if (mCachedScreenArray.Count() > 1) {
// I don't know how to go from GtkWindow to nsIScreen, especially
// given xinerama and stuff, so let's just do this
gint x, y, width, height, depth;
x = y = width = height = 0;
gdk_window_get_geometry(GDK_WINDOW(aWidget), &x, &y, &width, &height,
&depth);
gdk_window_get_origin(GDK_WINDOW(aWidget), &x, &y);
rv = ScreenForRect(x, y, width, height, outScreen);
} else {
rv = GetPrimaryScreen(outScreen);
}
return rv;
}
示例4: EnsureInit
const TStrV& TTmInfo::GetDayOfWeekNmV(const TLoc& Loc) {
EnsureInit();
switch (Loc){
case lUs: return UsDayOfWeekNmV;
case lSi: return SiDayOfWeekNmV;
default: Fail; return UsDayOfWeekNmV;
}
}
示例5: EnsureInit
NS_IMETHODIMP nsCacheEntryDescriptor::
nsOutputStreamWrapper::Flush()
{
nsresult rv = EnsureInit();
if (NS_FAILED(rv)) return rv;
return mOutput->Flush();
}
示例6: EnsureInit
TStr TTmInfo::GetMonthNm(const int& MonthN, const TLoc& Loc){
EnsureInit();
IAssert((1<=MonthN)&&(MonthN<=12));
switch (Loc){
case lUs: return UsMonthNmV[MonthN-1];
case lSi: return SiMonthNmV[MonthN-1];
default: Fail; return TStr();
}
}
示例7: lock
nsresult nsCacheEntryDescriptor::
nsInputStreamWrapper::Available(uint64_t *avail)
{
mozilla::MutexAutoLock lock(mLock);
nsresult rv = EnsureInit();
if (NS_FAILED(rv)) return rv;
return mInput->Available(avail);
}
示例8: GetNumberOfScreens
//
// GetNumberOfScreens
//
// Returns how many physical screens are available.
//
NS_IMETHODIMP
nsScreenManagerGtk :: GetNumberOfScreens(PRUint32 *aNumberOfScreens)
{
nsresult rv;
rv = EnsureInit();
if (NS_FAILED(rv)) {
NS_ERROR("nsScreenManagerGtk::EnsureInit() failed from GetNumberOfScreens");
return rv;
}
*aNumberOfScreens = mCachedScreenArray.Count();
return NS_OK;
} // GetNumberOfScreens
示例9: EnsureInit
nsresult nsCacheEntryDescriptor::
nsInputStreamWrapper::Read_Locked(char *buf, uint32_t count, uint32_t *countRead)
{
nsresult rv = EnsureInit();
if (NS_SUCCEEDED(rv))
rv = mInput->Read(buf, count, countRead);
CACHE_LOG_DEBUG(("nsInputStreamWrapper::Read "
"[entry=%p, wrapper=%p, mInput=%p, rv=%d]",
mDescriptor, this, mInput.get(), rv));
return rv;
}
示例10: GetPrimaryScreen
//
// GetPrimaryScreen
//
// The screen with the menubar/taskbar. This shouldn't be needed very
// often.
//
NS_IMETHODIMP
nsScreenManagerGtk :: GetPrimaryScreen(nsIScreen * *aPrimaryScreen)
{
nsresult rv;
rv = EnsureInit();
if (NS_FAILED(rv)) {
NS_ERROR("nsScreenManagerGtk::EnsureInit() failed from GetPrimaryScreen");
return rv;
}
*aPrimaryScreen = mCachedScreenArray.SafeObjectAt(0);
NS_IF_ADDREF(*aPrimaryScreen);
return NS_OK;
} // GetPrimaryScreen
示例11: Detach
/// <summary>
/// Create new process and attach to it
/// </summary>
/// <param name="path">Executable path</param>
/// <param name="suspended">Leave process in suspended state. To resume process one should resume its main thread</param>
/// <param name="forceInit">If 'suspended' is true, this flag will enforce process initialization via second thread</param>
/// <param name="cmdLine">Process command line</param>
/// <param name="currentDir">Startup directory</param>
/// <param name="pStartup">Additional startup params</param>
/// <returns>Status code</returns>
NTSTATUS Process::CreateAndAttach(
const std::wstring& path,
bool suspended /*= false*/,
bool forceInit /*= true*/,
const std::wstring& cmdLine /*= L""*/,
const wchar_t* currentDir /*= nullptr*/,
STARTUPINFOW* pStartup /*= nullptr*/
)
{
Detach();
STARTUPINFOW si = { 0 };
PROCESS_INFORMATION pi = { 0 };
if (!pStartup)
pStartup = &si;
if (!CreateProcessW(
path.c_str(), const_cast<LPWSTR>(cmdLine.c_str()),
NULL, NULL, FALSE, CREATE_SUSPENDED, NULL,
currentDir, pStartup, &pi
))
{
return LastNtStatus();
}
// Get handle ownership
auto status = _core.Open( pi.hProcess );
if (NT_SUCCESS( status ))
{
_nativeLdr.Init();
// Check if process must be left in suspended mode
if (suspended)
{
// Create new thread to make sure LdrInitializeProcess gets called
if (forceInit)
EnsureInit();
}
else
ResumeThread( pi.hThread );
}
// Close unneeded handles
CloseHandle( pi.hThread );
return status;
}
示例12: EnsureInit
//
// ScreenForRect
//
// Returns the screen that contains the rectangle. If the rect overlaps
// multiple screens, it picks the screen with the greatest area of intersection.
//
// The coordinates are in desktop pixels.
//
NS_IMETHODIMP
nsScreenManagerGtk::ScreenForRect(int32_t aX, int32_t aY,
int32_t aWidth, int32_t aHeight,
nsIScreen **aOutScreen)
{
nsresult rv;
rv = EnsureInit();
if (NS_FAILED(rv)) {
NS_ERROR("nsScreenManagerGtk::EnsureInit() failed from ScreenForRect");
return rv;
}
// which screen ( index from zero ) should we return?
uint32_t which = 0;
// Optimize for the common case. If the number of screens is only
// one then this will fall through with which == 0 and will get the
// primary screen.
if (mCachedScreenArray.Count() > 1) {
// walk the list of screens and find the one that has the most
// surface area.
uint32_t area = 0;
nsIntRect windowRect(aX, aY, aWidth, aHeight);
for (int32_t i = 0, i_end = mCachedScreenArray.Count(); i < i_end; ++i) {
int32_t x, y, width, height;
x = y = width = height = 0;
mCachedScreenArray[i]->GetRect(&x, &y, &width, &height);
// calculate the surface area
nsIntRect screenRect(x, y, width, height);
screenRect.IntersectRect(screenRect, windowRect);
uint32_t tempArea = screenRect.width * screenRect.height;
if (tempArea >= area) {
which = i;
area = tempArea;
}
}
}
*aOutScreen = mCachedScreenArray.SafeObjectAt(which);
NS_IF_ADDREF(*aOutScreen);
return NS_OK;
} // ScreenForRect
示例13: AddEvent
IOEventRef IOEventLoop::AddEvent(int fd_or_sig, int16_t events, timeval* timeout,
const std::function<bool()>& callback) {
if (!EnsureInit()) {
return nullptr;
}
std::unique_ptr<IOEvent> e(new IOEvent(this, callback));
e->e = event_new(ebase_, fd_or_sig, events, EventCallbackFn, e.get());
if (e->e == nullptr) {
LOG(ERROR) << "event_new() failed";
return nullptr;
}
if (event_add(e->e, timeout) != 0) {
LOG(ERROR) << "event_add() failed";
return nullptr;
}
if (timeout != nullptr) {
e->timeout = *timeout;
}
e->enabled = true;
events_.push_back(std::move(e));
return events_.back().get();
}
示例14: ScreenForId
NS_IMETHODIMP
nsScreenManagerGtk :: ScreenForId ( uint32_t aId, nsIScreen **outScreen )
{
*outScreen = nullptr;
nsresult rv;
rv = EnsureInit();
if (NS_FAILED(rv)) {
NS_ERROR("nsScreenManagerGtk::EnsureInit() failed from ScreenForId");
return rv;
}
for (int32_t i = 0, i_end = mCachedScreenArray.Count(); i < i_end; ++i) {
uint32_t id;
rv = mCachedScreenArray[i]->GetId(&id);
if (NS_SUCCEEDED(rv) && id == aId) {
NS_IF_ADDREF(*outScreen = mCachedScreenArray[i]);
return NS_OK;
}
}
return NS_ERROR_FAILURE;
}
示例15: EnsureInit
PDMFactory::PDMFactory()
{
EnsureInit();
CreatePDMs();
CreateNullPDM();
}