void TestBinaryStream::TestArray() { Registry R; R.AddClass<Array>("Array"); R.AddClass<int>("int"); Pointer<Array> A = R.New<Array>(); A->Append(R.New(0)); A->Append(R.New(1)); A->Append(R.New(2)); A->Append(R.New(3)); BinaryStream S; S.SetRegistry(&R); S << A; Object Q; S >> Q; KAI_TEST_FALSE(S.CanRead(1)); KAI_TEST_EQUIV(Q.GetTypeNumber(), Type::Traits<Array>::Number); const Array &B = ConstDeref<Array>(Q); KAI_TEST_EQUIV(B.Size(), 4); KAI_TEST_EQUIV(ConstDeref<int>(B.At(0)), 0); KAI_TEST_EQUIV(ConstDeref<int>(B.At(1)), 1); KAI_TEST_EQUIV(ConstDeref<int>(B.At(2)), 2); KAI_TEST_EQUIV(ConstDeref<int>(B.At(3)), 3); }
//************************************************************************* // Method: LoadDataFromRegistry // Description: loads the serial number and registration key from the registry // and decodes the information // // Parameters: // None // // Return Value: None //************************************************************************* void RegistrationMgr::LoadDataFromRegistry() { Registry registry; regData->SetCustomerType(NormalCustomer); regData->SetNumberOfDaysValid(15); regData->SetFunctionalityType(TimeTrial); regData->SetProductType(Holodeck); regData->SetKeyVersion(HolodeckBasic); regData->SetNumberOfLicensesPurchased(0); regData->SetSerialNumber(""); regData->SetRegistrationKey(""); if (!registry.OpenKey(ROOT_KEY, ROOT_PATH, KEY_QUERY_VALUE)) return; SiString serialNum, regKey; if (!registry.Read(SERIAL_NUMBER_VALUE_NAME, serialNum)) return; if (!registry.Read(REGISTRATION_KEY_VALUE_NAME, regKey)) return; regData->SetSerialNumber(serialNum); regData->SetRegistrationKey(regKey); RegistrationKeyGenerator::GetInstance()->DecodeRegistrationKey(regData); }
void RegistrarProcess::update() { if (operations.empty()) { return; // No-op. } CHECK(!updating); CHECK(error.isNone()); CHECK_SOME(variable); // Time how long it takes to apply the operations. Stopwatch stopwatch; stopwatch.start(); updating = true; // Create a snapshot of the current registry. Registry registry = variable.get().get(); // Create the 'slaveIDs' accumulator. hashset<SlaveID> slaveIDs; foreach (const Registry::Slave& slave, registry.slaves().slaves()) { slaveIDs.insert(slave.info().id()); } foreach (Owned<Operation> operation, operations) { // No need to process the result of the operation. (*operation)(®istry, &slaveIDs, flags.registry_strict); }
//************************************************************************* // Method: GetNumberOfDaysRemaining // Description: returns the number of days remaining for this license // // Parameters: // None // // Return Value: the number of days remaining for this license //************************************************************************* int RegistrationMgr::GetNumberOfDaysRemaining() { DWORD dwHighValue, dwLowValue; ::FILETIME currentFileTime; ULARGE_INTEGER trialStartTime, currentTime, calculatedTime; int numDays; Registry registry; if (!registry.OpenKey(ROOT_KEY, ROOT_PATH, KEY_QUERY_VALUE)) return 0; if (!registry.Read("Config1", dwHighValue)) return 0; if (!registry.Read("Config2", dwLowValue)) return 0; trialStartTime.HighPart = dwHighValue; trialStartTime.LowPart = dwLowValue; GetSystemTimeAsFileTime(¤tFileTime); currentTime.HighPart = currentFileTime.dwHighDateTime; currentTime.LowPart = currentFileTime.dwLowDateTime; calculatedTime.QuadPart = currentTime.QuadPart - trialStartTime.QuadPart; numDays = (int)((calculatedTime.QuadPart * .0000001) / 86400); //calculated in 100ns increments return GetNumberOfDaysValid() - numDays; }
// // FUNCTION: InitInstance(HINSTANCE, int) // bool InitInstance(HINSTANCE hInstance, int nCmdShow) { Registry reg; int max_x, max_y; HWND hWnd; HMENU sys_menu; hInst = hInstance; // Store instance handle in our global variable hWnd = CreateWindow(szWindowClass, szTitle, WS_BORDER | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX, CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, NULL, NULL, hInstance, NULL); g_hWnd = hWnd; // store hwnd in our global variable if (!hWnd) return FALSE; // Add items to system menu sys_menu = GetSystemMenu(g_hWnd, FALSE); AppendMenu(sys_menu, MF_SEPARATOR, 0, ""); AppendMenu(sys_menu, MF_STRING, sys_menu_item_open, "&Open...\tCtrl-O"); // Restore window location and size reg.read_reg(); max_x = GetSystemMetrics(SM_CXSCREEN) - GetSystemMetrics(SM_CXICON); max_y = GetSystemMetrics(SM_CYSCREEN) - GetSystemMetrics(SM_CYICON); SetWindowPos(hWnd, HWND_TOP, min(reg.main_x, max_x), min(reg.main_y, max_y), 320, 240, SWP_SHOWWINDOW); UpdateWindow(hWnd); cur_frame = -1; cur_working_path[0] = '\0'; return true; }
STDAPI_(void) DllEnumRegistrationInfo(REGISTRYINFOPROC pEnumProc, LPARAM lParam) { try { OutputDebugFmt(_T("DllEnumRegistrationInfo()\n")); LPCTSTR prodPrefix = NULL; LPCTSTR compPrefix = NULL; TCHAR szModulePath[MAX_PATH]; COMServer::GetModuleFileName(szModulePath,ARRAYSIZE(szModulePath)); VersionInfo verInfo(szModulePath); prodPrefix = (LPCTSTR)verInfo.GetStringInfo(_T("ProductPrefix")); compPrefix = (LPCTSTR)verInfo.GetStringInfo(_T("ComponentPrefix")); Registry registry; registry.SetComponentId(compPrefix); COMServer::GetModuleFileName(szModulePath,ARRAYSIZE(szModulePath)); RegistryUtil::RegisterComObjectsInTypeLibrary(registry,szModulePath); registry.EnumRegistry(pEnumProc,lParam); } catch(BVR20983Exception e) { OutputDebugFmt(_T("DllRegistrationInfo(): Exception \"%s\" [%ld]>\n"),e.GetErrorMessage(),e.GetErrorCode()); OutputDebugFmt(_T(" Filename \"%s\" Line %d\n"),e.GetFileName(),e.GetLineNo()); } catch(exception& e) { OutputDebugFmt(_T("DllRegistrationInfo(): Exception <%s,%s>\n"),typeid(e).name(),e.what()); } catch(...) { OutputDebugFmt(_T("DllRegistrationInfo(): Exception\n")); } } // of DllEnumRegistrationInfo()
//_______________________________________________________ void WindowManager::initializeWayland() { #if BREEZE_HAVE_KWAYLAND if( !Helper::isWayland() ) return; if( _seat ) { // already initialized return; } using namespace KWayland::Client; auto connection = ConnectionThread::fromApplication( this ); if( !connection ) { return; } Registry *registry = new Registry( this ); registry->create( connection ); connect(registry, &Registry::interfacesAnnounced, this, [registry, this] { const auto interface = registry->interface( Registry::Interface::Seat ); if( interface.name != 0 ) { _seat = registry->createSeat( interface.name, interface.version, this ); connect(_seat, &Seat::hasPointerChanged, this, &WindowManager::waylandHasPointerChanged); } } ); registry->setup(); connection->roundtrip(); #endif }
void Registry::setCurrentRegistry(const glbinding::ContextHandle contextId) { g_mutex.lock(); auto it = s_registries.find(contextId); if (it != s_registries.end()) { t_currentRegistry = it->second; g_mutex.unlock(); } else { g_mutex.unlock(); Registry * registry = new Registry(); g_mutex.lock(); s_registries[contextId] = registry; g_mutex.unlock(); t_currentRegistry = registry; registry->initialize(); } }
void RegisterBridge_PCL(Registry& reg, string parentGroup) { string grp(parentGroup); grp.append("/pcl"); reg.add_function("PclDebugBarrierEnabled", &PclDebugBarrierEnabled, grp, "Enabled", "", "Returns the whether debug barriers are enabled."); reg.add_function("PclDebugBarrierAll", &PclDebugBarrierAll, grp, "", "", "Synchronizes all parallel processes if the executable" "has been compiled with PCL_DEBUG_BARRIER=ON"); reg.add_function("NumProcs", &pcl::NumProcs, grp, "NumProcs", "", "Returns the number of active processes."); reg.add_function("ProcRank", &pcl::ProcRank, grp, "ProcRank", "", "Returns the rank of the current process."); reg.add_function("SynchronizeProcesses", &pcl::SynchronizeProcesses, grp, "", "", "Waits until all active processes reached this point."); reg.add_function("AllProcsTrue", &PclAllProcsTrue, grp, "boolean", "boolean", "Returns true if all processes call the method with true."); reg.add_function("ParallelMin", &ParallelMin<double>, grp, "tmax", "t", "returns the minimum of t over all processes. note: you have to assure that all processes call this function."); reg.add_function("ParallelMax", &ParallelMax<double>, grp, "tmin", "t", "returns the maximum of t over all processes. note: you have to assure that all processes call this function."); reg.add_function("ParallelSum", &ParallelSum<double>, grp, "tsum", "t", "returns the sum of t over all processes. note: you have to assure that all processes call this function."); reg.add_function("ParallelVecMin", &ParallelVecMin<double>, grp, "tmax", "t", "returns the minimum of t over all processes. note: you have to assure that all processes call this function."); reg.add_function("ParallelVecMax", &ParallelVecMax<double>, grp, "tmin", "t", "returns the maximum of t over all processes. note: you have to assure that all processes call this function."); reg.add_function("ParallelVecSum", &ParallelVecSum<double>, grp, "tsum", "t", "returns the sum of t over all processes. note: you have to assure that all processes call this function."); }
TEST(OKFliRegistryTest, TestBasic) { Registry r; r.SetName("TestReg"); EXPECT_EQ("TestReg", r.GetName()); EXPECT_EQ("(empty)", r.GetAllAliases()); EXPECT_FALSE(r.IsRegistered("moof")); EXPECT_FALSE(r.CreateFunctor("moof")); r.Register<RegAddOneXform>(); r.Register<RegAddNXform>(); EXPECT_EQ("RegAddNXform,RegAddOneXform", r.GetAllAliases(",")); auto f = r.CreateFunctor("RegAddNXform"); EXPECT_TRUE(f); auto f2 = r.CreateFunctor("oarph"); EXPECT_FALSE(f2); auto fn = r.CreateFunctor("RegAddOneXform"); EXPECT_TRUE(fn); int x = 1; auto out = fn->Call(rt_datumptr::Reference(&x)); EXPECT_EQ(2, out.GetRef<int>()); }
//************************************************************************* // Method: SaveRegistrationData // Description: reloads registration data from the registry // // Parameters: // None // // Return Value: the single instance of this class //************************************************************************* bool RegistrationMgr::SaveRegistrationData(const SiString &serialNumber, const SiString ®istrationKey) { if ((serialNumber.GetLength() == 0) || (registrationKey.GetLength() == 0)) return false; RegistrationData tempData; tempData.SetSerialNumber(serialNumber); tempData.SetRegistrationKey(registrationKey); if (RegistrationKeyGenerator::GetInstance()->DecodeRegistrationKey(&tempData)) { Registry registry; if (!registry.OpenKey(ROOT_KEY, ROOT_PATH)) return false; SiString serialNum, regKey; if (!registry.Write(SERIAL_NUMBER_VALUE_NAME, serialNumber)) return false; if (!registry.Write(REGISTRATION_KEY_VALUE_NAME, registrationKey)) return false; return true; } return false; }
void TestBinaryStream::TestList() { Registry R; List::Register(R); R.AddClass<void>("void"); R.AddClass<int>("int"); R.AddClass<String>("String"); Pointer<List> list = R.New<List>(); list->Append(R.New(123)); list->Append(R.New(456)); list->Append(R.New("Hello")); BinaryStream stream(R); stream << list; Object result; stream >> result; KAI_TRACE_1(list); KAI_TRACE_1(stream); KAI_TRACE_1(result); KAI_TEST_TRUE(result.Exists()); KAI_TEST_TRUE(result.IsType<List>()); KAI_TEST_EQUIV(ConstDeref<List>(result).Size(), 3); KAI_TEST_EQUIV(result, list); Pointer<List> result_list = result; KAI_TEST_EQUIV(ConstDeref<String>(result_list->Back()), "Hello"); result_list->PopBack(); KAI_TEST_EQUIV(ConstDeref<int>(result_list->Back()), 456); result_list->PopBack(); KAI_TEST_EQUIV(ConstDeref<int>(result_list->Back()), 123); result_list->PopBack(); KAI_TEST_EQUIV(ConstDeref<List>(result_list).Size(), 0); }
void Licensor::init (Gtk::Tooltips& tt, Registry& wr) { /* add license-specific metadata entry areas */ rdf_work_entity_t* entity = rdf_find_entity ( "license_uri" ); _eentry = EntityEntry::create (entity, tt, wr); LicenseItem *i; wr.setUpdating (true); i = manage (new LicenseItem (&_proprietary_license, _eentry, wr)); add (*i); LicenseItem *pd = i; for (struct rdf_license_t * license = rdf_licenses; license && license->name; license++) { i = manage (new LicenseItem (license, _eentry, wr)); add(*i); } // add Other at the end before the URI field for the confused ppl. LicenseItem *io = manage (new LicenseItem (&_other_license, _eentry, wr)); add (*io); pd->set_active(); wr.setUpdating (false); Gtk::HBox *box = manage (new Gtk::HBox); pack_start (*box, true, true, 0); box->pack_start (_eentry->_label, false, false, 5); box->pack_start (*_eentry->_packable, true, true, 0); show_all_children(); }
void TestBinaryStream::TestObject() { Registry R; R.AddClass<int>("int"); BinaryStream S; S.SetRegistry(&R); Pointer<int> N = R.New(42); S << N; Object Q; S >> Q; KAI_TEST_FALSE(S.CanRead(1)); KAI_TEST_EQUIV(Q.GetTypeNumber(), Type::Traits<int>::Number); KAI_TEST_EQUIV(ConstDeref<int>(Q), 42); S.Clear(); KAI_TEST_TRUE(S.Empty()); N.Set("child0", R.New(123)); S << N; Object M; S >> M; KAI_TEST_FALSE(S.CanRead(1)); KAI_TEST_EQUIV(ConstDeref<int>(M), 42); KAI_TEST_TRUE(M.Has("child0")); KAI_TEST_EQUIV(ConstDeref<int>(M.Get("child0")), 123); }
void RegisterLuaUserDataType(Registry& reg, string type, string grp) { string suffix = GetDimensionSuffix<dim>(); string tag = GetDimensionTag<dim>(); // LuaUser"Type" { typedef ug::LuaUserData<TData, dim> T; typedef CplUserData<TData, dim> TBase; string name = string("LuaUser").append(type).append(suffix); reg.add_class_<T, TBase>(name, grp) .template add_constructor<void (*)(const char*)>("Callback") .template add_constructor<void (*)(LuaFunctionHandle)>("handle") .set_construct_as_smart_pointer(true); reg.add_class_to_group(name, string("LuaUser").append(type), tag); } // LuaCondUser"Type" { typedef ug::LuaUserData<TData, dim, bool> T; typedef CplUserData<TData, dim, bool> TBase; string name = string("LuaCondUser").append(type).append(suffix); reg.add_class_<T, TBase>(name, grp) .template add_constructor<void (*)(const char*)>("Callback") .template add_constructor<void (*)(LuaFunctionHandle)>("handle") .set_construct_as_smart_pointer(true); reg.add_class_to_group(name, string("LuaCondUser").append(type), tag); } }
bool Round::SystemGetRegistryResponse::setRegistry(const Registry reg) { JSONDictionary *resultDict = nodeRes->getResultDict(); if (!resultDict) return false; std::string sval; time_t tval; if (reg.getKey(&sval)) { resultDict->set(Registry::KEY, sval); } if (reg.getValue(&sval)) { resultDict->set(Registry::VALUE, sval); } if (reg.getTimestamp(tval)) { resultDict->set(Registry::TS, tval); } if (reg.getLogicalTimestamp(tval)) { resultDict->set(Registry::LTS, tval); } return true; }
FrameType Frame::registerFrameType(const QString& frameTypeName) { Locker lock(mutex); std::call_once(once, [&] { auto headerType = frameTypes.registerValue("com.highfidelity.recording.Header"); Q_ASSERT(headerType == Frame::TYPE_HEADER); }); return frameTypes.registerValue(frameTypeName); }
static void Domain(Registry& reg, string grp) { string suffix = GetDomainSuffix<TDomain>(); string tag = GetDomainTag<TDomain>(); #ifdef UG_PARALLEL { typedef DomainBalanceWeights<TDomain, AnisotropicBalanceWeights<TDomain::dim> > T; string name = string("AnisotropicBalanceWeights").append(suffix); reg.add_class_<T, IBalanceWeights>(name, grp) .template add_constructor<void (*)(TDomain&)>() .add_method("set_weight_factor", &T::set_weight_factor) .add_method("weight_factor", &T::weight_factor) .set_construct_as_smart_pointer(true); reg.add_class_to_group(name, "AnisotropicBalanceWeights", tag); } { typedef BalanceWeightsLuaCallback<TDomain> T; string name = string("BalanceWeightsLuaCallback").append(suffix); reg.add_class_<T, IBalanceWeights>(name, grp) .template add_constructor<void (*)(SmartPtr<TDomain> spDom, const char* luaCallbackName)>() .add_method("set_time", &T::set_time) .add_method("time", &T::time) .set_construct_as_smart_pointer(true); reg.add_class_to_group(name, "BalanceWeightsLuaCallback", tag); } { string name = string("DomainLoadBalancer").append(suffix); typedef DomainLoadBalancer<TDomain> T; typedef LoadBalancer TBase; reg.add_class_<T, TBase>(name, grp) .template add_constructor<void (*)(SmartPtr<TDomain>)>("Domain") .set_construct_as_smart_pointer(true); reg.add_class_to_group(name, "DomainLoadBalancer", tag); } reg.add_function("CreateProcessHierarchy", static_cast<SPProcessHierarchy (*)(TDomain&, size_t, size_t, size_t, int, int)> (&CreateProcessHierarchy<TDomain>), grp, "ProcessHierarchy", "Domain, minNumElemsPerProcPerLvl, " "maxNumRedistProcs, maxNumProcs, minDistLvl, " "maxLvlsWithoutRedist"); reg.add_function("CreateProcessHierarchy", static_cast<SPProcessHierarchy (*)(TDomain&, size_t, size_t, size_t, int, int, IRefiner*)> (&CreateProcessHierarchy<TDomain>), grp, "ProcessHierarchy", "Domain, minNumElemsPerProcPerLvl, " "maxNumRedistProcs, maxNumProcs, minDistLvl, " "maxLvlsWithoutRedist, refiner"); #endif }
void ClassificationValidation::saveToFile(string filename, const double& quality_input_test, const double& predictive_quality) const { ofstream out(filename.c_str()); Registry reg; out<<"# used quality statistic: "<<reg.getClassificationStatisticName(validation_statistic_)<<endl<<endl; out << "Fit to training data = "<<quality_input_test<<endl; out << "Predictive quality = "<<predictive_quality<<endl; }
void RegisterBridge_PCL(Registry& reg, string parentGroup) { string grp(parentGroup); grp.append("/PCL"); reg.add_function("DisableMPIInit", &DisableMPIInitDUMMY, grp, "", "", "Tells PCL to not call MPI_Init and MPI_Finalize."); reg.add_function("PclDebugBarrierEnabled", &PclDebugBarrierEnabledDUMMY, grp, "Enabled", "", "Returns the whether debug barriers are enabled."); reg.add_function("PclDebugBarrierAll", &PclDebugBarrierAllDUMMY, grp, "", "", "Synchronizes all parallel processes if the executable" "has been compiled with PCL_DEBUG_BARRIER=ON"); reg.add_function("NumProcs", &NumProcsDUMMY, grp, "NumProcs", "", "Returns the number of active processes."); reg.add_function("ProcRank", &ProcRankDUMMY, grp, "ProcRank", "", "Returns the rank of the current process."); reg.add_function("SynchronizeProcesses", &SynchronizeProcessesDUMMY, grp, "", "", "Waits until all active processes reached this point."); reg.add_function("AllProcsTrue", &AllProcsTrueDUMMY, grp, "boolean", "boolean", "Returns true if all processes call the method with true."); reg.add_function("ParallelMin", &ParallelMinDUMMY<double>, grp, "tmax", "t", "returns the maximum of t over all processes. note: you have to assure that all processes call this function."); reg.add_function("ParallelMax", &ParallelMaxDUMMY<double>, grp, "tmin", "t", "returns the minimum of t over all processes. note: you have to assure that all processes call this function."); reg.add_function("ParallelSum", &ParallelSumDUMMY<double>, grp, "tsum", "t", "returns the sum of t over all processes. note: you have to assure that all processes call this function."); }
void initializeRotor( Registry & registry, const string & poseMessage ) { registry.registerType( ROTOR_DEFINITION_STRING( carmen_point_t ) ); if ( poseMessage == "carmen_base_odometry" ) { registry.registerMessageType( "carmen_base_odometry", ROTOR_DEFINITION_STRING( carmen_base_odometry_message ) ); registry.subscribeToMessage( "carmen_base_odometry", true ); } else if ( poseMessage == "locfilter_filteredpos_message" ) { registry.registerMessageType( "locfilter_filteredpos_message", ROTOR_DEFINITION_STRING( locfilter_filteredpos_message ) ); registry.subscribeToMessage( "locfilter_filteredpos_message", true ); } registry.registerMessageType( "axt_message", ROTOR_DEFINITION_STRING( axt_message ) ); registry.subscribeToMessage( "axt_message" ); registry.registerType( ROTOR_DEFINITION_STRING( carmen_laser_laser_config_t ) ); registry.registerMessageType( "carmen_robot_frontlaser", ROTOR_DEFINITION_STRING( carmen_robot_laser_message ) ); }
//************************************************************************* // Method: ConvertToFeatureDisabledTrial // Description: converts the functionality to a feature disabled trial // // Parameters: // None // // Return Value: None //************************************************************************* void RegistrationMgr::ConvertToFeatureDisabledTrial() { Registry registry; if (!registry.OpenKey(ROOT_KEY, ROOT_PATH)) return; registry.DeleteValue(SERIAL_NUMBER_VALUE_NAME); registry.DeleteValue(REGISTRATION_KEY_VALUE_NAME); ReloadRegistrationData(); }
void InputStackingOrderTest::init() { using namespace KWayland::Client; // setup connection m_connection = new ConnectionThread; QSignalSpy connectedSpy(m_connection, &ConnectionThread::connected); QVERIFY(connectedSpy.isValid()); m_connection->setSocketName(s_socketName); m_thread = new QThread(this); m_connection->moveToThread(m_thread); m_thread->start(); m_connection->initConnection(); QVERIFY(connectedSpy.wait()); m_queue = new EventQueue(this); QVERIFY(!m_queue->isValid()); m_queue->setup(m_connection); QVERIFY(m_queue->isValid()); Registry registry; registry.setEventQueue(m_queue); QSignalSpy compositorSpy(®istry, &Registry::compositorAnnounced); QSignalSpy shmSpy(®istry, &Registry::shmAnnounced); QSignalSpy shellSpy(®istry, &Registry::shellAnnounced); QSignalSpy seatSpy(®istry, &Registry::seatAnnounced); QSignalSpy allAnnounced(®istry, &Registry::interfacesAnnounced); QVERIFY(allAnnounced.isValid()); QVERIFY(shmSpy.isValid()); QVERIFY(shellSpy.isValid()); QVERIFY(compositorSpy.isValid()); QVERIFY(seatSpy.isValid()); registry.create(m_connection->display()); QVERIFY(registry.isValid()); registry.setup(); QVERIFY(allAnnounced.wait()); QVERIFY(!compositorSpy.isEmpty()); QVERIFY(!shmSpy.isEmpty()); QVERIFY(!shellSpy.isEmpty()); QVERIFY(!seatSpy.isEmpty()); m_compositor = registry.createCompositor(compositorSpy.first().first().value<quint32>(), compositorSpy.first().last().value<quint32>(), this); QVERIFY(m_compositor->isValid()); m_shm = registry.createShmPool(shmSpy.first().first().value<quint32>(), shmSpy.first().last().value<quint32>(), this); QVERIFY(m_shm->isValid()); m_shell = registry.createShell(shellSpy.first().first().value<quint32>(), shellSpy.first().last().value<quint32>(), this); QVERIFY(m_shell->isValid()); m_seat = registry.createSeat(seatSpy.first().first().value<quint32>(), seatSpy.first().last().value<quint32>(), this); QVERIFY(m_seat->isValid()); QSignalSpy hasPointerSpy(m_seat, &Seat::hasPointerChanged); QVERIFY(hasPointerSpy.isValid()); QVERIFY(hasPointerSpy.wait()); screens()->setCurrent(0); Cursor::setPos(QPoint(640, 512)); }
void VKUAuthConfig::Read() { String regPath(VKUApp::GetInstance()->GetAppDataPath() + L"auth.ini"); String authSection(L"auth"); Registry reg; reg.Construct(regPath, false); if(accessTokenValue != null) { delete accessTokenValue; } accessTokenValue = new String(); reg.GetValue(authSection, "access_token", *accessTokenValue); reg.GetValue(authSection, "expires_in", expiresInValue); reg.GetValue(authSection, "user_id", userIdValue); }
TEST_F(TestProperties, TestBuilder) { Registry R; R.AddClass<int>(); R.AddClass<Vector>(); ClassBuilder<PropTest>(R) .Methods .Properties ("num", &PropTest::num) ("p_num", &PropTest::p_num) ("object", &PropTest::object) ; Pointer<PropTest> prop_test = R.New<PropTest>(); ASSERT_TRUE(prop_test); ClassBase const *klass = prop_test.GetClass(); ASSERT_TRUE(klass->HasProperty("num")); ASSERT_TRUE(klass->HasProperty("p_num")); ASSERT_TRUE(prop_test.Has("num")); ASSERT_FALSE(prop_test.Has("p_num")); Pointer<int> N1 = R.New(123); Pointer<int> N2 = R.New(456); Pointer<int> N3 = R.New(789); ASSERT_FALSE(N1.HasParent()); prop_test->p_num = N1; ASSERT_TRUE(N1.HasParent()); ASSERT_TRUE(N1.GetParentHandle() == prop_test.GetHandle()); prop_test.Set("num", N2); ASSERT_TRUE(prop_test->num == *N2); ASSERT_FALSE(N2.HasParent()); prop_test.SetValue("num", 666); ASSERT_TRUE(prop_test->num == 666); ASSERT_FALSE(N2.HasParent()); ASSERT_TRUE(N1.HasParent()); ASSERT_FALSE(N3.HasParent()); prop_test.Set("p_num", N3); ASSERT_FALSE(N1.HasParent()); ASSERT_TRUE(N3.HasParent()); ASSERT_TRUE(N3.GetParentHandle() == prop_test.GetHandle()); prop_test.SetValue("p_num", 42); EXPECT_EQ(*N3, 42); prop_test.SetValue("num", 13); EXPECT_EQ(prop_test->num, 13); }
bool RegisterSerializationCommands(Registry ®, const char* parentGroup) { stringstream grpSS; grpSS << parentGroup << "/Serialization"; std::string grp = grpSS.str(); try { // reg.add_function("LuaList_writeObjects", &LuaList_writeObjects, grp.c_str()); reg.add_function("LuaWrite", &LuaWrite, grp.c_str()); reg.add_function("LuaWriteCout", &LuaWriteCout, grp.c_str()); } UG_REGISTRY_CATCH_THROW(grp); return true; }
bool DestroyWindow() { Registry reg; WINDOWPLACEMENT wp; // Save window position reg.read_reg(); GetWindowPlacement(g_hWnd, &wp); reg.main_x = wp.rcNormalPosition.left; reg.main_y = wp.rcNormalPosition.top; reg.write_reg(); return true; }
STDAPI DllRegisterServer() { HRESULT hr = S_OK; LPCTSTR prodPrefix = NULL; LPCTSTR compPrefix = NULL; TCHAR szModulePath[MAX_PATH]; COMServer::GetModuleFileName(szModulePath,sizeof(szModulePath)/sizeof(szModulePath[0])); VersionInfo verInfo(szModulePath); prodPrefix = (LPCTSTR)verInfo.GetStringInfo(_T("ProductPrefix")); compPrefix = (LPCTSTR)verInfo.GetStringInfo(_T("ComponentPrefix")); try { Registry registry; RegistryUtil::RegisterComObjectsInTypeLibrary(registry,szModulePath,RegistryUtil::AUTO); if( registry.Prepare() ) registry.Commit(); /* as marker for registration of multiple typelibs RegistryUtil::RegisterTypeLib(LIBID_BVR20983_1_SC,LANG_SYSTEM_DEFAULT,_T("1"),1,0,szModulePath,szWindowsDir); RegistryUtil::RegisterTypeLib(LIBID_BVR20983_1_SC,MAKELCID(MAKELANGID(LANG_GERMAN, SUBLANG_NEUTRAL), SORT_DEFAULT),_T("2"),1,0,szModulePath,szWindowsDir); */ } catch(BVR20983Exception e) { LOGGER_ERROR<<e<<endl; hr = SELFREG_E_CLASS; } catch(exception& e) { LOGGER_ERROR<<"Exception "<<typeid(e).name()<<":"<<e.what()<<endl; hr = SELFREG_E_CLASS; } catch(...) { LOGGER_ERROR<<_T("Exception")<<endl; hr = SELFREG_E_CLASS; } EvtLogInstall(NULL!=prodPrefix ? prodPrefix : _T("unknown"),NULL!=compPrefix ? compPrefix : _T("unknown"),TRUE,hr); return hr; } // of DllRegisterServer()
string deriveSecret(string job, Registry registry) { // get the master secret value from the registry byte* master = (byte*) (registry.find("master")->second).c_str(); // Generate the salt byte* salt = generateRandomSalt(DEFAULT_SALT_SIZE); // Derivate the key byte* okm = deriveKey(256, (byte*) master, 256, salt, 256); cout << "salt" << endl << salt << endl << endl; cout << "okm" << endl << okm << endl << endl; cout << "master" << endl << master << endl << endl; // return the OKM and the salt XXX check that sizeof is doing what's // intended Response resp; resp.set_salt(&salt, 256); resp.set_secret(&okm, 256); string string_resp; resp.SerializeToString(&string_resp); return string_resp; }
/** * Reads the master secret and put it in the registry * * @param Registry reg the registry to use * @returns void **/ void readMasterSecret(Registry reg) { string master = (char*) readFile("master"); pair <string, string> master_pair = pair <string, string>("master", master); reg.insert(master_pair); }