本文整理汇总了C++中Registry类的典型用法代码示例。如果您正苦于以下问题:C++ Registry类的具体用法?C++ Registry怎么用?C++ Registry使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Registry类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: TestArray
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);
}
示例2: LoadDataFromRegistry
//*************************************************************************
// 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);
}
示例3: CHECK
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);
}
示例4: GetNumberOfDaysRemaining
//*************************************************************************
// 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;
}
示例5: InitInstance
//
// 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;
}
示例6: STDAPI_
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()
示例7: Registry
//_______________________________________________________
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
}
示例8: Registry
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();
}
}
示例9: RegisterBridge_PCL
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.");
}
示例10: TEST
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>());
}
示例11: SaveRegistrationData
//*************************************************************************
// 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;
}
示例12: TestList
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);
}
示例13: manage
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();
}
示例14: TestObject
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);
}
示例15: RegisterLuaUserDataType
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);
}
}