本文整理汇总了C++中NotFoundException函数的典型用法代码示例。如果您正苦于以下问题:C++ NotFoundException函数的具体用法?C++ NotFoundException怎么用?C++ NotFoundException使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了NotFoundException函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: defined
void WinRegistryKey::open()
{
if (!_hKey)
{
#if defined(POCO_WIN32_UTF8)
std::wstring usubKey;
Poco::UnicodeConverter::toUTF16(_subKey, usubKey);
if (_readOnly)
{
if (RegOpenKeyExW(_hRootKey, usubKey.c_str(), 0, KEY_READ | _extraSam, &_hKey) != ERROR_SUCCESS)
throw NotFoundException("Cannot open registry key: ", key());
}
else
{
if (RegCreateKeyExW(_hRootKey, usubKey.c_str(), 0, NULL, REG_OPTION_NON_VOLATILE, KEY_READ | KEY_WRITE | _extraSam, NULL, &_hKey, NULL) != ERROR_SUCCESS)
throw SystemException("Cannot open registry key: ", key());
}
#else
if (_readOnly)
{
if (RegOpenKeyExA(_hRootKey, _subKey.c_str(), 0, KEY_READ | _extraSam, &_hKey) != ERROR_SUCCESS)
throw NotFoundException("Cannot open registry key: ", key());
}
else
{
if (RegCreateKeyExA(_hRootKey, _subKey.c_str(), 0, NULL, REG_OPTION_NON_VOLATILE, KEY_READ | KEY_WRITE | _extraSam, NULL, &_hKey, NULL) != ERROR_SUCCESS)
throw SystemException("Cannot open registry key: ", key());
}
#endif
}
}
示例2: OpenProcess
void ProcessImpl::killImpl(PIDImpl pid)
{
HANDLE hProc = OpenProcess(PROCESS_TERMINATE, FALSE, pid);
if (hProc)
{
if (TerminateProcess(hProc, 0) == 0)
{
CloseHandle(hProc);
throw SystemException("cannot kill process");
}
CloseHandle(hProc);
}
else
{
switch (GetLastError())
{
case ERROR_ACCESS_DENIED:
throw NoPermissionException("cannot kill process");
case ERROR_NOT_FOUND:
throw NotFoundException("cannot kill process");
case ERROR_INVALID_PARAMETER:
throw NotFoundException("cannot kill process");
default:
throw SystemException("cannot kill process");
}
}
}
示例3: subKeys
void WinRegistryKey::deleteKey()
{
Keys keys;
subKeys(keys);
close();
for (Keys::iterator it = keys.begin(); it != keys.end(); ++it)
{
std::string subKey(_subKey);
subKey += "\\";
subKey += *it;
WinRegistryKey subRegKey(_hRootKey, subKey);
subRegKey.deleteKey();
}
// NOTE: RegDeleteKeyEx is only available on Windows XP 64-bit SP3, Windows Vista or later.
// We cannot call it directly as this would prevent the code running on Windows XP 32-bit.
// Therefore, if we need to call RegDeleteKeyEx (_extraSam != 0) we need to check for
// its existence in ADVAPI32.DLL and call it indirectly.
#if defined(POCO_WIN32_UTF8)
std::wstring usubKey;
Poco::UnicodeConverter::toUTF16(_subKey, usubKey);
typedef LONG (WINAPI *RegDeleteKeyExWFunc)(HKEY hKey, const wchar_t* lpSubKey, REGSAM samDesired, DWORD Reserved);
if (_extraSam != 0)
{
AutoHandle advAPI32(LoadLibraryW(L"ADVAPI32.DLL"));
if (advAPI32.handle())
{
RegDeleteKeyExWFunc pRegDeleteKeyExW = reinterpret_cast<RegDeleteKeyExWFunc>(GetProcAddress(advAPI32.handle() , "RegDeleteKeyExW"));
if (pRegDeleteKeyExW)
{
if ((*pRegDeleteKeyExW)(_hRootKey, usubKey.c_str(), _extraSam, 0) != ERROR_SUCCESS)
throw NotFoundException(key());
return;
}
}
}
if (RegDeleteKeyW(_hRootKey, usubKey.c_str()) != ERROR_SUCCESS)
throw NotFoundException(key());
#else
typedef LONG (WINAPI *RegDeleteKeyExAFunc)(HKEY hKey, const char* lpSubKey, REGSAM samDesired, DWORD Reserved);
if (_extraSam != 0)
{
AutoHandle advAPI32(LoadLibraryA("ADVAPI32.DLL"));
if (advAPI32.handle())
{
RegDeleteKeyExAFunc pRegDeleteKeyExA = reinterpret_cast<RegDeleteKeyExAFunc>(GetProcAddress(advAPI32.handle() , "RegDeleteKeyExA"));
if (pRegDeleteKeyExA)
{
if ((*pRegDeleteKeyExA)(_hRootKey, _subKey.c_str(), _extraSam, 0) != ERROR_SUCCESS)
throw NotFoundException(key());
return;
}
}
}
if (RegDeleteKey(_hRootKey, _subKey.c_str()) != ERROR_SUCCESS)
throw NotFoundException(key());
#endif
}
示例4: open
void WinRegistryKey::deleteValue(const std::string& name)
{
open();
#if defined(POCO_WIN32_UTF8)
std::wstring uname;
Poco::UnicodeConverter::toUTF16(name, uname);
if (RegDeleteValueW(_hKey, uname.c_str()) != ERROR_SUCCESS)
throw NotFoundException(key(name));
#else
if (RegDeleteValueA(_hKey, name.c_str()) != ERROR_SUCCESS)
throw NotFoundException(key(name));
#endif
}
示例5: synchronized
/**
* Gets an object from the cache; the database is not accessed.
*
* @param id the ID of the object
* @return a copy of the object
* @throw NotFoundException if the object is not found or id is invalid
*/
template<class T> T Cache::getObject (dbId id)
{
if (idInvalid (id)) throw NotFoundException (id);
synchronized (dataMutex)
{
const QHash<dbId, T> &hash=objectsByIdHash<T> ();
if (!hash.contains (id)) throw NotFoundException (id);
return hash.value (id);
}
assert (!notr ("Not returned yet"));
throw NotFoundException (id);
}
示例6: while
BufferFrame* BPlusSegment<K,V>::fixLeafFor(const K& key, const bool exclusive) const{
BufferFrame* pageOfKey = &bm.fixPage(segmentId, root, exclusive);
while(!isLeaf(pageOfKey->getData())){
BPlusPage<K, PageID> page(pageOfKey->getData(), pageSize, cmp);
PageID nextPage;
try{
nextPage = page.lookupSmallestGreaterThan(key).value;
}catch(NotFoundException e){
//upper exists?
if (page.getUpperExists()){
nextPage = page.getUpper();
}else{
bm.unfixPage(*pageOfKey, false);
throw NotFoundException();
}
}
BufferFrame* oldBF = pageOfKey;
pageOfKey = &bm.fixPage(segmentId, nextPage, exclusive);
bm.unfixPage(*oldBF, false);
}
return pageOfKey;
}
示例7: void
BundleMetadata const& BundleLoader::createBundleEx( std::string const& path, void ( *MetainfoFunc )( bundle::BundleMetainfo & ) )
{
Metainfo *info = new Metainfo();
try
{
BundleInfo bundleInfo;
bundle::BundleMetainfo metainfo( *info );
MetainfoFunc( metainfo );
bundleInfo.metainfo = info;
bundleInfo.metainfo->setInstallDirectory( path );
bundleInfo.metainfo->cleanup();
m_LoadedBundles.insert( make_pair( path, bundleInfo ) );
}
catch ( Exception &e )
{
delete info;
throw e;
}
BundleMetadata const& meta = info->getBundleData();
if ( meta.getName() == "undefined" )
{
ostringstream msg;
msg << "bundle " << meta.getInstallDirectory() << " does not define a name";
throw NotFoundException( msg.str() );
}
return meta;
}
示例8: NotFoundException
RowFilter::Comparison RowFilter::getComparison(const std::string& comp) const
{
Comparisons::const_iterator it = _comparisons.find(toUpper(comp));
if (it == _comparisons.end())
throw NotFoundException("Comparison not found", comp);
return it->second;
}
示例9: NotFoundException
const std::string& NameValueCollection::operator [] (const std::string& name) const
{
ConstIterator it = _map.find(name);
if (it != _map.end())
return it->second;
else
throw NotFoundException(name);
}
示例10: manager
TextEncoding& TextEncoding::byName(const std::string& encodingName)
{
TextEncoding* pEncoding = manager().find(encodingName);
if (pEncoding)
return *pEncoding;
else
throw NotFoundException(encodingName);
}
示例11: throw
buffer_ptr Mesh::attrib(const attribid_t& attribid_)
{
Attribs::iterator it = _attribs.find(attribid_);
if(it == _attribs.end()){
throw(NotFoundException("Attrib not found"));
}
return buffer_ptr((*it).second);
}
示例12: getElement
T& getElement(const std::string& key) const
{
const std::map<std::string, NAbstract*>::const_iterator iter (_children.find(key));
if (iter == _children.end())
{
throw NotFoundException("Key " + key);
}
T* obj = dynamic_cast<T*>(iter->second);
if (!obj)
{
throw NotFoundException("Key " + key);
}
return *obj;
}
示例13: attr
typename DomainEnumerate<Val>::ValueId
DomainEnumerate<Val>::find(const typename Val::Value& value) const {
Val attr(value, const_cast<DomainEnumerate<Val>*>(this)); //ValueNominal requires non-const pointer to domain
const_iterator found = std::find( values_.begin(), values_.end(), attr );
if( found != values_.end() ) {
return getValueId( found);
}
throw NotFoundException( getId().c_str() );
}
示例14: NotFoundException
Poco::Any SessionPool::getProperty(const std::string& name)
{
PropertyMap::ConstIterator it = _propertyMap.find(name);
if (_propertyMap.end() == it)
throw NotFoundException("Property not found:" + name);
return it->second;
}
示例15: FindNode_Id
DecisionTreeNode* DecisionTree::GetNode(int i_id) const
{
auto it = std::find_if(m_nodes.begin(), m_nodes.end(), FindNode_Id(i_id));
if (it == m_nodes.end())
throw NotFoundException("Node does not find");
return (*it).get();
}