当前位置: 首页>>代码示例>>C++>>正文


C++ NotFoundException函数代码示例

本文整理汇总了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
	}
}
开发者ID:austinsc,项目名称:Poco,代码行数:31,代码来源:WinRegistryKey.cpp

示例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");
		}
	}
}
开发者ID:RobertAcksel,项目名称:poco,代码行数:27,代码来源:Process_WIN32U.cpp

示例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
}
开发者ID:austinsc,项目名称:Poco,代码行数:59,代码来源:WinRegistryKey.cpp

示例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
}
开发者ID:austinsc,项目名称:Poco,代码行数:13,代码来源:WinRegistryKey.cpp

示例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);
}
开发者ID:fb,项目名称:startkladde,代码行数:22,代码来源:Cache_lookup.cpp

示例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;
}
开发者ID:cyberfuzzie,项目名称:HeapDB,代码行数:26,代码来源:bplussegment.cpp

示例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;
	}
开发者ID:anasancho,项目名称:_2RealFramework,代码行数:30,代码来源:_2RealBundleLoader.cpp

示例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;
}
开发者ID:12307,项目名称:poco,代码行数:8,代码来源:RowFilter.cpp

示例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);
}
开发者ID:Victorcasas,项目名称:georest,代码行数:8,代码来源:NameValueCollection.cpp

示例10: manager

TextEncoding& TextEncoding::byName(const std::string& encodingName)
{
    TextEncoding* pEncoding = manager().find(encodingName);
    if (pEncoding)
        return *pEncoding;
    else
        throw NotFoundException(encodingName);
}
开发者ID:as2120,项目名称:ZPoco,代码行数:8,代码来源:TextEncoding.cpp

示例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);
}
开发者ID:catompiler,项目名称:celestial-battle,代码行数:8,代码来源:mesh.cpp

示例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;
            }
开发者ID:ilkos,项目名称:ctree,代码行数:17,代码来源:object.hpp

示例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() );
 }
开发者ID:Mike-Now,项目名称:faif-MLR,代码行数:9,代码来源:Value.hpp

示例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;
}
开发者ID:Akryllax,项目名称:extDB2,代码行数:9,代码来源:SessionPool.cpp

示例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();
			}
开发者ID:TraurigeNarr,项目名称:SupportSDK,代码行数:9,代码来源:DecisionTree.cpp


注:本文中的NotFoundException函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。