本文整理汇总了C++中StringRange::empty方法的典型用法代码示例。如果您正苦于以下问题:C++ StringRange::empty方法的具体用法?C++ StringRange::empty怎么用?C++ StringRange::empty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StringRange
的用法示例。
在下文中一共展示了StringRange::empty方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: StringRange
Registry::Registry(StringRange path, bool writable) : _handle(nullptr) {
assert("Empty path" && !path.empty());
int rootKeyNameEnd = String::refer(path).indexOf(L'\\');
StringRange subKeyName = L"";
if (rootKeyNameEnd == -1) {
rootKeyNameEnd = path.length();
} else {
subKeyName = StringRange(path.c_str() + rootKeyNameEnd + 1);
}
if (!rootKeyNameEnd) {
assert("Invalid Registry root key name" && false);
} else if (!String::compare(path, 0, L"HKEY_CLASSES_ROOT", 0, rootKeyNameEnd)) {
*this = Registry::classesRoot();
} else if (!String::compare(path, 0, L"HKEY_CURRENT_CONFIG", 0, rootKeyNameEnd)) {
*this = Registry::currentConfig();
} else if (!String::compare(path, 0, L"HKEY_CURRENT_USER", 0, rootKeyNameEnd)) {
*this = Registry::currentUser();
} else if (!String::compare(path, 0, L"HKEY_LOCAL_MACHINE", 0, rootKeyNameEnd)) {
*this = Registry::localMachine();
} else if (!String::compare(path, 0, L"HKEY_USERS", 0, rootKeyNameEnd)) {
*this = Registry::users();
} else {
assert("Invalid Registry root key name" && false);
}
if (!subKeyName.empty()) {
*this = openKey(subKeyName, writable);
}
}
示例2: openKey
Registry Registry::openKey(StringRange keyName, bool writable) const {
assert("Empty Registry" && *this);
assert("Empty kKeyName" && !keyName.empty());
Registry key;
checkResult(RegOpenKeyExW(_handle, keyName.c_str(), 0
, writable ? KEY_ALL_ACCESS : KEY_READ, &key._handle));
return key;
}
示例3: createKey
Registry Registry::createKey(StringRange keyName, bool writable) {
assert("Empty Registry" && *this);
assert("Empty keyName" && !keyName.empty());
Registry key;
checkResult(RegCreateKeyExW(_handle, keyName.c_str(), 0, nullptr, REG_OPTION_NON_VOLATILE
, writable ? KEY_ALL_ACCESS : KEY_READ, nullptr, &key._handle, nullptr));
return key;
}
示例4: removeKey
void Registry::removeKey(StringRange keyName, bool recursive) {
assert("Empty Registry" && *this);
assert("Empty keyName" && !keyName.empty());
if (recursive) {
Registry key = openKey(keyName, true);
if (key) {
auto i = NamesIterator(key, true);
while (i) {
key.removeKey(*i, true);
i.refresh();
}
}
}
checkResult(RegDeleteKeyW(_handle, keyName.c_str()));
}