本文整理汇总了C++中CL_Exception函数的典型用法代码示例。如果您正苦于以下问题:C++ CL_Exception函数的具体用法?C++ CL_Exception怎么用?C++ CL_Exception使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了CL_Exception函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CL_GUIComponent_Impl
CL_GUIComponent_Impl *CL_GUIComponent_Impl::create_from_manager(CL_GUIManager *manager)
{
if (manager)
return new CL_GUIComponent_Impl(manager->impl, 0, true);
else
throw CL_Exception("Cannot create component with a null manager!");
}
示例2: catch
CL_Resource CL_ResourceManager::get_resource(
const CL_String &resource_id,
bool resolve_alias,
int reserved)
{
std::map<CL_String, CL_Resource>::const_iterator it;
it = impl->resources.find(resource_id);
if (it != impl->resources.end())
return it->second;
std::vector<CL_ResourceManager>::size_type i;
for (i = 0; i < impl->additional_resources.size(); i++)
{
try
{
return impl->additional_resources[i].get_resource(
resource_id, resolve_alias, reserved);
}
catch (const CL_Exception&)
{
}
}
throw CL_Exception(cl_format("Resource not found: %1", resource_id));
return CL_Resource(impl->document.get_document_element(), *this);
}
示例3: get_input
void CL_Collada_Triangles_Impl::create_vertices(CL_Vec2f *destination, int stride, const CL_String &semantic)
{
CL_Collada_Input_Shared &input = get_input(semantic);
CL_Collada_Source &source = input.get_source();
if (source.is_null())
{
throw CL_Exception("unsupported situation. fixme");
}
std::vector<CL_Vec2f> &pos_array = source.get_vec2f_array();
if (!stride)
stride = sizeof(CL_Vec2f);
char *work_ptr = (char *) destination;
int primitive_stride = this->stride;
unsigned int offset = input.get_offset();
unsigned int max = offset + (triangle_count * 3 * primitive_stride);
for (unsigned int cnt=offset; cnt < max; cnt+=primitive_stride)
{
*( (CL_Vec2f *) work_ptr ) = pos_array[ primitive[cnt] ];
work_ptr += stride;
}
}
示例4: while
CL_ListViewColumnHeader CL_ListViewHeader::remove(const CL_StringRef &column_id)
{
CL_SharedPtr<CL_ListViewColumnHeader_Impl> cur = impl->first_column;
while (cur)
{
if (cur->column_id == column_id)
{
CL_ListViewColumnHeader column(cur);
if (!impl->func_column_removed.is_null())
impl->func_column_removed.invoke(column);
if (!cur->prev_sibling.expired())
cur->prev_sibling.lock()->next_sibling = cur->next_sibling;
if (cur->next_sibling)
cur->next_sibling->prev_sibling = cur->prev_sibling;
if (impl->first_column == cur)
impl->first_column = cur->next_sibling;
if (impl->last_column.lock() == cur)
impl->last_column = cur->prev_sibling;
return column;
}
cur = cur->next_sibling;
}
throw CL_Exception(cl_format("No column found with column id: %1", column_id));
}
示例5: CL_Exception
bool CL_IODeviceProvider_File::seek(int position, CL_IODevice::SeekMode seek_mode)
{
if (handle == invalid_handle)
throw CL_Exception("CL_IODeviceProvider_File::seek(): Unable to get file position pointer, no file open");
#ifdef WIN32
DWORD moveMethod = FILE_BEGIN;
switch (seek_mode)
{
case CL_IODevice::seek_set: moveMethod = FILE_BEGIN; break;
case CL_IODevice::seek_cur: moveMethod = FILE_CURRENT; break;
case CL_IODevice::seek_end: moveMethod = FILE_END; break;
}
DWORD new_pos = SetFilePointer(handle, position, 0, moveMethod);
return (new_pos != INVALID_FILE_SIZE);
#else
int mode = SEEK_SET;
if (seek_mode == CL_File::seek_set)
mode = SEEK_SET;
else if (seek_mode == CL_File::seek_cur)
mode = SEEK_CUR;
else if (seek_mode == CL_File::seek_end)
mode = SEEK_END;
off_t new_pos = lseek(handle, position, mode);
if (new_pos == (off_t) -1)
return false;
else
return true;
#endif
}
示例6: CL_VirtualDirectoryListing
CL_VirtualDirectoryListing CL_VirtualFileSystem::get_directory_listing(const CL_String &path_rel)
{
CL_String path = CL_PathHelp::make_absolute(
"/",
path_rel,
CL_PathHelp::path_type_virtual);
// First see if its a mount point:
int index, size;
size = (int) impl->mounts.size();
for (index = 0; index < size; index++)
{
if (impl->mounts[index].first == path.substr(0, impl->mounts[index].first.length()))
{
return impl->mounts[index].second.get_directory_listing( path.substr(impl->mounts[index].first.length(), path.length()));
}
}
// Try open locally, if we got a file provider attached
if (impl->provider)
{
return CL_VirtualDirectoryListing(
impl->provider,
CL_PathHelp::make_relative(
"/",
path,
CL_PathHelp::path_type_virtual));
}
else
throw CL_Exception(cl_format("Unable to list directory: %1", path));
}
示例7: AllocConsole
CL_ConsoleWindow_Generic::CL_ConsoleWindow_Generic(
const CL_StringRef &title,
int width,
int height)
{
#ifdef WIN32
AllocConsole();
SetConsoleTitle(CL_StringHelp::utf8_to_ucs2(title).c_str());
COORD coord;
coord.X = width;
coord.Y = height;
scrbuf =
CreateConsoleScreenBuffer(
GENERIC_READ | GENERIC_WRITE,
FILE_SHARE_READ | FILE_SHARE_WRITE,
NULL,
CONSOLE_TEXTMODE_BUFFER,
NULL);
if(scrbuf == INVALID_HANDLE_VALUE)
throw CL_Exception("Unable to allocate console screen buffer");
SetStdHandle(STD_OUTPUT_HANDLE, scrbuf);
SetConsoleActiveScreenBuffer(scrbuf);
SetConsoleScreenBufferSize(scrbuf, coord);
#endif
}
示例8: io
void CL_Lib3dsFile::load(CL_IODevice device)
{
CL_Lib3dsIo io(device);
int result = lib3ds_file_read(file, io);
if (!result)
throw CL_Exception("Unable to load 3ds file");
}
示例9: select_nodes
CL_DomNode CL_DomNode::select_node(const CL_DomString &xpath_expression) const
{
std::vector<CL_DomNode> nodes = select_nodes(xpath_expression);
if (nodes.empty())
throw CL_Exception(cl_format("Xpath did not match any node: %1", xpath_expression));
return nodes[0];
}
示例10: service_name
CL_Service_Impl::CL_Service_Impl(CL_Service *service, const CL_String &service_name)
: service_name(service_name), service(service)
{
if (instance != 0)
throw CL_Exception("More than one instance of CL_Service not allowed");
instance = this;
}
示例11: mutex_lock
void CL_NetGameClient_Impl::process()
{
CL_MutexSection mutex_lock(&mutex);
event_arrived.reset();
std::vector<CL_NetGameNetworkEvent> new_events;
new_events.swap(events);
mutex_lock.unlock();
for (unsigned int i = 0; i < new_events.size(); i++)
{
switch (new_events[i].type)
{
case CL_NetGameNetworkEvent::client_connected:
sig_game_connected.invoke();
break;
case CL_NetGameNetworkEvent::event_received:
sig_game_event_received.invoke(new_events[i].game_event);
break;
case CL_NetGameNetworkEvent::client_disconnected:
sig_game_disconnected.invoke();
connection.reset();
break;
default:
throw CL_Exception("Unknown server event type");
}
}
}
示例12: RegSetValueEx
void CL_RegistryKey::set_value_int(const CL_StringRef &name, int value)
{
DWORD v = value;
LONG result = RegSetValueEx(impl->key, name.empty() ? 0 : CL_StringHelp::utf8_to_ucs2(name).c_str(), 0, REG_DWORD, (const BYTE *) &v, sizeof(DWORD));
if (result != ERROR_SUCCESS)
throw CL_Exception(cl_format("Unable to set registry key value %1", name));
}
示例13: if
int App::start(const std::vector<CL_String> &args)
{
CL_String theme;
if (CL_FileHelp::file_exists("../../../Resources/GUIThemeAero/theme.css"))
theme = "../../../Resources/GUIThemeAero";
else if (CL_FileHelp::file_exists("../../../Resources/GUIThemeBasic/theme.css"))
theme = "../../../Resources/GUIThemeBasic";
else
throw CL_Exception("Not themes found");
CL_GUIManager gui(theme);
CL_DisplayWindowDescription win_desc;
win_desc.set_allow_resize(true);
win_desc.set_title("GUILayout Test Application");
win_desc.set_position(CL_Rect(200, 200, 540, 440), false);
win_desc.set_visible(false);
CL_Window window(&gui, win_desc);
window.func_close().set(this, &App::on_close, &window);
CL_GUILayoutCorners layout;
window.set_layout(layout);
window.create_components("Resources/layout.xml");
CL_PushButton *button = CL_PushButton::get_named_item(&window, "MyButton");
button->func_clicked().set(this, &App::on_button_clicked, button);
label = CL_Label::get_named_item(&window, "MyLabel");
window.set_visible(true);
gui.exec();
return 0;
}
示例14: RegCreateKeyEx
CL_RegistryKey CL_RegistryKey::create_key(const CL_StringRef &subkey, unsigned int access_rights, CreateFlags create_flags)
{
DWORD disposition = 0;
HKEY new_key = 0;
LONG result = RegCreateKeyEx(impl->key, CL_StringHelp::utf8_to_ucs2(subkey).c_str(), 0, 0, (create_flags & create_volatile) ? REG_OPTION_VOLATILE : REG_OPTION_NON_VOLATILE, access_rights, 0, &new_key, &disposition);
if (result != ERROR_SUCCESS)
throw CL_Exception(cl_format("Unable to create registry key %1", subkey));
if (disposition != REG_CREATED_NEW_KEY && (create_flags & create_new))
{
RegCloseKey(new_key);
throw CL_Exception(cl_format("Key already exists: %1", subkey));
}
return CL_RegistryKey(new_key);
}
示例15: SHDeleteKey
void CL_RegistryKey::delete_key(PredefinedKey key, const CL_StringRef &subkey, bool recursive)
{
HKEY hkey = CL_RegistryKey_Impl::get_predefined_hkey(key);
if (recursive)
{
DWORD result = SHDeleteKey(hkey, CL_StringHelp::utf8_to_ucs2(subkey).c_str());
if (result != ERROR_SUCCESS)
throw CL_Exception(cl_format("Unable to delete registry key %1", subkey));
}
else
{
LONG result = RegDeleteKey(hkey, CL_StringHelp::utf8_to_ucs2(subkey).c_str());
if (result != ERROR_SUCCESS)
throw CL_Exception(cl_format("Unable to delete registry key %1", subkey));
}
}